Announcement Announcement Module
Collapse
No announcement yet.
405 Error on accessing an XSD (spring-ws) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 405 Error on accessing an XSD (spring-ws)

    Hi.

    Im having trouble making a call to a web service using spring-ws.

    I have created a service which is working on a Tomcat server with the following setup...

    Web.xml
    Code:
    	<servlet>
            <servlet-name>spring-ws</servlet-name>
            <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
            
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>spring-ws</servlet-name>
            <url-pattern>/services/*</url-pattern>
        </servlet-mapping>
    Spring-ws-servlet.xml
    Code:
    	<bean id="getConfig" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
    	  <property name="schema" ref="getConfigSchema"/>
    	  <property name="portTypeName" value="Configuration"/>
    	  <property name="locationUri" value="https://XXX.YYY.ZZZ:1234/services/ConfigService"/>
    	</bean>
    	
    	<bean id="getConfigSchema" class="org.springframework.xml.xsd.SimpleXsdSchema">
    	    <property name="xsd" value="classpath:/XSD/XXXYYYZZZZ.xsd"/>
    	</bean>
    When using the Eclipse Web Service Explorer to test the service, the status outputs the following when directing it towards the wsdl.

    Code:
    IWAB0380E Errors were encountered while validating XML schemas.
    XSD: The location XXXYYYZZZZ.xsd' has not been resolved
    XSD: Attribute group reference 'http://XXX/YYY/ZZZ#MessageAttributes' is unresolved
    XSD: Type reference 'http://XXX/YYY/ZZZ#Status' is unresolved
    XSD: Attribute group reference 'http://XXX/YYY/ZZZ#MessageAttributes' is unresolved
    XSD: Type reference 'http://XXX/YYY/ZZZ#Status' is unresolved
    IWAB0381I http://111.222.333.444:8080/DFAWebservices/services/getConfig.wsdl was successfully opened.
    I can then send and receive message through the webservice without any trouble.
    However, when trying to invoke a service using spring, I continually receive the following output...
    Code:
    org.apache.cxf.phase.PhaseInterceptorChain doIntercept
    INFO: Interceptor has thrown exception, unwinding now
    org.apache.cxf.interceptor.Fault: Could not send Message.
    	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
    	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
    	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
    	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
    	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
    	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
    	at $Proxy57.getConfig(Unknown Source)
    	at uk.org.barnardos.contactpoint.datafeedagent.TestWS.testService(TestWS.java:75)
    	at uk.org.barnardos.contactpoint.datafeedagent.TestWS.main(TestWS.java:106)
    Caused by: java.io.IOException: Not Found
    	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1929)
    	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1832)
    	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
    	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:159)
    	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
    	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:591)
    	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    	... 8 more
    Using Wireshark to monitor the network traffic while the request takes place, I get a 405 error when the service tries to access http ://111.222.333.444:8080/DFAWebservices/services/XXXYYYZZZZ.xsd which I assume is the cause of the IOException and the first error when registering the wsdl with Eclipse WSE. The problem here is that the xsd file is obviously not available at this location, so I need to know how I can change this and subsequently eliminate this problem.

    Any help would be very gratefully received.

    Thanks in advance.

    Dave.

  • #2
    Hi

    The problem is with naming WSDL and XSD definitions.
    MessageDispatcherServlet, while initializing, checks all WSDL and XSD defs in application contexts and "publishes" them under the name from XML - the name comes from ID attribute.
    You have WSDL Definition with the name "getConfig" - so getConfig.wsdl can be returned by MessageDispatcherServlet.
    But the name of XSD is getConfigSchema instead of XXXYYYZZZZ, so it can not be found (you can find getConfigSchema.xsd).

    Look for the entries in your logfile produced by:
    Code:
    logger.debug("Published [" + schema + "] as " + beanName + XSD_SUFFIX_NAME);
    The 405 error code you get comes from messageReceiverHandlerAdapter.handle() which allows only POST methods.

    regards
    Grzegorz Grzybek

    Comment


    • #3
      Ahh that all makes sense now - thanks for the clarification.

      With that problem out of the way, I now find myself up against new issue.

      Comment

      Working...
      X