0

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.

cuser1
  • 65
  • 1
  • 2
  • 9

1 Answers1

0

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());
zThulj
  • 149
  • 7
  • Is it possible for you to have only 1 xsd (instead of 2 ) ? – zThulj Jun 26 '17 at 13:28
  • For now, add the '.getXsdSchemas()' that I just add into the answer. (Sorry, i've done it from my mobile I forgot the get) – zThulj Jun 26 '17 at 13:43
  • What is the error when you launch your app ? Can be because of the 'primary' – zThulj Jun 26 '17 at 13:56
  • 1
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'REL-6-MM7-1-4' defined in class path resource [hello/WebServiceConfig.class]: Invocation of init method failed; nested exception is java.lang.NullPointerException – cuser1 Jun 26 '17 at 14:16