spring-guides / gs-consuming-web-service

Consuming a SOAP web service :: Learn how to create a client that consumes a WSDL-based service
http://spring.io/guides/gs/consuming-web-service
Apache License 2.0
136 stars 164 forks source link

XML Exception with Java-WS #60

Open mjmk3 opened 1 year ago

mjmk3 commented 1 year ago

this is the code for java webservices and keep get the same error with soapUI and the same error for the xml, I'm working with jdk 8

I have issue with the endpoint of the java web services as it's show in the code but it's keep giving me this response as bellow:

Error loading[http://localhost:8096/ws/biller_customer_authentication]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Premature end of file

@EnableWs
@Configuration
public class WSConfig 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 = "biller_customer_authentication")
    public DefaultWsdl11Definition billerCustomerAuthentication(XsdSchema billerCustomerAuthenticationSchema) {
        DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
        wsdl11Definition.setPortTypeName("BillerCustomerAuthenticationPort");
        wsdl11Definition.setLocationUri("/ws");
        wsdl11Definition.setTargetNamespace("http://localhost:8096");
        wsdl11Definition.setSchema(billerCustomerAuthenticationSchema );
        return wsdl11Definition;
    }

    @Bean
    public XsdSchema billerCustomerAuthenticationSchema() {
        return new SimpleXsdSchema(new ClassPathResource("xsd/biller.xsd"));
    }
}