Search code examples
springspring-mvcsoapspring-batchspring-ws

Spring Web Service - Unable to find WSDL


I have created Spring Web service and deployed in the Weblogic service . I got below logs:

Jun 19, 2014 9:21:29 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Jun 19, 2014 9:21:30 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Thu Jun 19 21:21:30 IST 2014]; root of context hierarchy
Jun 19, 2014 9:21:31 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3b14dd4: defining beans []; root of factory hierarchy
Jun 19, 2014 9:21:31 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 2041 ms
Jun 19, 2014 9:21:32 PM org.springframework.ws.transport.http.MessageDispatcherServlet initServletBean
INFO: FrameworkServlet 'test-ws': initialization started
Jun 19, 2014 9:21:32 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'test-ws-servlet': startup date [Thu Jun 19 21:21:32 IST 2014]; parent: Root WebApplicationContext
Jun 19, 2014 9:21:32 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/test-ws-servlet.xml]
Jun 19, 2014 9:21:32 PM org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping afterPropertiesSet
INFO: Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
Jun 19, 2014 9:21:32 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@213f529: defining beans [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping#0,org.springframework.ws.server.endpoint.adapter.method.dom.DomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter#0,org.springframework.ws.soap.server.endpoint.SoapFaultAnnotationExceptionResolver#0,org.springframework.ws.soap.server.endpoint.SimpleSoapExceptionResolver#0,getCptSkuDetailsWebService,getSkuDetailsWebService,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,skuDetails,skuDetailsSchema,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@3b14dd4
Jun 19, 2014 9:21:33 PM org.springframework.ws.soap.saaj.SaajSoapMessageFactory afterPropertiesSet
INFO: Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
Jun 19, 2014 9:21:33 PM org.springframework.ws.transport.http.MessageDispatcherServlet initServletBean
INFO: FrameworkServlet 'test-ws': initialization completed in 1167 ms

But when I try to hit the URL cant able to find the WSDL saying 404 .

Please find the web.xml

 <servlet>
    <servlet-name>test-ws</servlet-name>
    <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
    <init-param>
        <param-name>transformWsdlLocations</param-name>
        <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>test-ws</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>test-ws</servlet-name>
    <url-pattern>*.wsdl</url-pattern>
   </servlet-mapping>

  <context-param>
    <param-name>contextConfigLocation</param-name>
        <param-value></param-value>
</context-param>

  <listener>
     <listener-class>
         org.springframework.web.context.ContextLoaderListener
      </listener-class>
    </listener>

Please find the test-ws-servlet.xml file

  <bean id="testDetails"
    class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
    <property name="schema" ref="testDetailsSchema" />
    <property name="portTypeName" value="GetTestServicePortType" />
    <property name="locationUri" value="/testDetailsService/" />
  </bean>

  <bean id="testDetailsSchema" class="org.springframework.xml.xsd.SimpleXsdSchema">
    <property name="xsd" value="/schemas/TestDetails.xsd" />
  </bean>

URL i used is :

http://localhost:7001/<projectName>/<locationUri>/<beanid>.wsdl

Please help me in this case. I can understand from logs that WSDL has been generated, if my understanding is wrong please help in that. Also please help me in finding the WSDL. Is the URL I am using to access the WSDL is correct ?


Solution

  • Should work like this

    http://localhost:7001/<projectName>/<locationUri>.wsdl
    

    beanid is redundant, because one locationUri presumes only one WebService, so only one WSDL.

    See here: https://docs.spring.io/spring-ws/docs/current/reference/#tutorial-publishing-wsdl