Unable to load wsdl using GUI tool using spring boot

421 Views Asked by At

I am new to both SOAP & spring boot technologies.However i have created soap webservice using below reference link. https://spring.io/guides/gs/producing-web-service/

  @EnableWs
    @Configuration
    public class WebServiceConfig extends WsConfigurerAdapter {
        @Bean
        public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
            MessageDispatcherServlet servlet = new MessageDispatcherServlet();
            servlet.setApplicationContext(applicationContext);
            servlet.setTransformWsdlLocations(true);
            return new ServletRegistrationBean(servlet, "/ws/*");
        }

        @Bean(name = "REL-6-MM7-1-4")
        @Primary
        public DefaultWsdl11Definition defaultWsdl11Definition() {
            DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
            wsdl11Definition.setPortTypeName("MMSPort");
            wsdl11Definition.setLocationUri("/ws");
            wsdl11Definition.setTargetNamespace("http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-4");
            wsdl11Definition.setSchemaCollection(getXsdCollection());
            return wsdl11Definition;
        }

        @Bean
        public XsdSchemaCollection getXsdCollection() {
            return new XsdSchemaCollection() {

                public XsdSchema[] getXsdSchemas() {
                    return new XsdSchema[]{new SimpleXsdSchema(new ClassPathResource("REL-6-MM7-1-4.xsd")), new SimpleXsdSchema(new ClassPathResource("SoapEnvelope.xsd"))};
                }

                public XmlValidator createValidator() {
                    throw new UnsupportedOperationException();
                }
            };
        }

Please find xsd posted.

1

There are 1 best solutions below

4
On

This is the error that happen when you are not using the correct url into soap ui. You need to search the right location of your XSD in the browser and make sure you can access to it.

Then you need to check the URL you are pasting into SOAP UI and see if the relative URLs actually are correct. If they aren't, you have to use the correct location.

Edit : In your case, I see the following code :

@Bean(name = "REL-6-MM7-1-4")

So I think that your ws is exposed at : http://localhost:8080/ws/REL-6-MM7-1-4.wsdl

Edit 2 : In your case, you also need to provide multiple xsd. You can do it by adding :

@Bean
public XsdSchemaCollection getXsdCollection() {
    return new XsdSchemaCollection() {

        public XsdSchema[] getXsdSchemas() {
            return new XsdSchema[]{new SimpleXsdSchema(new ClassPathResource("REL-6-MM7-1-4.xsd")), new SimpleXsdSchema(new ClassPathResource("SoapEnvelope.xsd"))};
        }

        public XmlValidator createValidator() {
            throw new UnsupportedOperationException();
        }
    };
}

and by using it at :

wsdl11Definition.setSchema(getXsdCollection());