Announcement Announcement Module
Collapse
No announcement yet.
XPathParam Annotation Only Loading First Element From SOAP Request Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XPathParam Annotation Only Loading First Element From SOAP Request

    I have the following annotated endpoint method:

    Code:
    	@PayloadRoot(localPart = "GetUserRequest", namespace = "http://mydomain.com/schemas/MyService")
    	public Source provisionDevice(
    			@XPathParam("//ns:Username") String username,
    			@XPathParam("//ns:Password") String password)) {
    		LOG.debug("\n" + 
    			      "username: " + username + "\n" + 
    			      "password: " + password + "\n");
    		return null;
    	}
    Using the following SOAP request:
    Code:
    <?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
            <soapenv:Body>
                    <GetUserRequest xmlns="http://mydomain.com/schemas/MyService">
                            <Username>USERNAME</Username>
                            <Password>PASSWORD</Password>
                    </GetUserRequest >
            </soapenv:Body>
    </soapenv:Envelope>

    ... the annotated method is only ever able to get the first GetUserRequest child element from the SOAP request. In the soap request above, only username in the annotated method will be set. But if I switch <Password> and <Username> around like so:

    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
            <soapenv:Body>
                    <GetUserRequest xmlns="http://mydomain.com/schemas/MyService">
                            <Password>PASSWORD</Password>
                            <Username>USERNAME</Username>
                    </GetUserRequest >
            </soapenv:Body>
    </soapenv:Envelope>
    ... only password in the annotated endpoint method is set.

    What's going on here?

    BTW: I've tried several different kinds of XPaths (more explicit ones, namespace agnostic ones, etc.), but to no avail.

    Here's the log of what's going on:
    Code:
    org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter  - Accepting incoming [[email protected]5] to [http://localhost:80/soap/MyService]
    org.apache.jk.server.JkCoyoteHandler  - doRead [B@7f6155 0 0
    org.apache.jk.common.JkInputStream  - doRead 0 473 473 false 0 0
    org.apache.axiom.om.util.StAXUtils  - Created XMLInputFactory = class com.ctc.wstx.stax.WstxInputFactory for classloader=WebappClassLoader
    org.apache.axiom.om.util.StAXUtils  - Size of XMLInputFactory map =1
    org.apache.axiom.om.util.StAXUtils  - XMLStreamReader is com.ctc.wstx.sr.ValidatingStreamReader
    org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder  - Build the OMElelment EnvelopeBy the StaxSOAPModelBuilder
    org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder  - Build the OMElelment BodyBy the StaxSOAPModelBuilder
    org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder  - Build the OMElelment GetUserRequestBy the StaxSOAPModelBuilder
    org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder  - Build the OMElelment UsernameBy the StaxSOAPModelBuilder
    org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder  - Build the OMElelment PasswordBy the StaxSOAPModelBuilder
    org.springframework.ws.server.MessageTracing.received  - Received request [SaajSoapMessage {http://mydomain.com/schemas/MyService}GetUserRequest]
    org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping  - Looking up endpoint for [{http://mydomain.com/schemas/MyService}GetUserRequest]
    org.springframework.ws.soap.server.SoapMessageDispatcher  - Endpoint mapping [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping@13cca0e] maps request to endpoint [public javax.xml.transform.Source package.name.endpoint.MyServiceServiceAnnotationEndpoint.getUser(java.lang.String,java.lang.String)]
    org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor  - Request: <GetUserRequest xmlns="http://mydomain.com/schemas/MyService">
    <Username>USERNAME
    org.springframework.ws.soap.server.SoapMessageDispatcher  - Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter@b481ba]
    org.springframework.beans.factory.support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'MyServiceAnnotatedEndpoint'
    package.name.endpoint.MyServiceServiceAnnotationEndpoint  -
    username: USERNAME
    password:
    org.springframework.ws.server.MessageTracing.sent  - MessageDispatcher with name 'MyService-soap' sends no response for request [SaajSoapMessage {http://mydomain.com/schemas/MyService}GetUserRequest]
    org.springframework.ws.transport.http.MessageDispatcherServlet  - Successfully completed request
    Last edited by Temujin_12; May 15th, 2009, 01:02 PM.

  • #2
    I figured out what the problem was.

    I noticed this in the log:
    Code:
    org.springframework.ws.server.MessageTracing.received  - Received request [SaajSoapMessage {http://mydomain.com/schemas/MyService}GetUserRequest]
    Realizing that I didn't necessarily want to use SAAJ, I added an AxiomSoapMessageFactory to my beans (see 4.1.3.2 from docs):

    Code:
    <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory">
        <property name="payloadCaching" value="true"/>
    </bean>
    Now all of the endpoint parameters come through.

    Hope this helps someone!

    Comment

    Working...
    X