Announcement Announcement Module
Collapse
No announcement yet.
Unable to Include and Access MessageContext on Endpoint Method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to Include and Access MessageContext on Endpoint Method

    I am needing to retrieve several header elements from the SOAP envelope and use this information to determine the appropriate action within my endpoint handling method. I was able to retrieve the element values using an endpoint interceptor, but cannot access the MessageContext to retrieve the property values from the endpoint. Adding the MessageContext as a parameter in the handing method results in a "No adapter for endpoint" error. My endpoint class is annotated with @Endpoint and I am using the @RequestPayload annotation in conjunction with the request object within the handler method.

    public PutCMSDataResponse handleCmsDataRequest(@RequestPayload PutCMSDataRequest putCMSDataRequest, MessageContext messageContext) throws Exception {
    ...
    }


    My spring servlet is configured as follows:

    <bean id="marshallingPayloadMethodProcessor" class="org.springframework.ws.server.endpoint.adap ter.method.MarshallingPayloadMethodProcessor">
    <constructor-arg ref="castorMarshaller"/>
    <constructor-arg ref="castorMarshaller"/>
    </bean>

    <bean id="defaultMethodEndPointAdapter" class="org.springframework.ws.server.endpoint.adap ter.DefaultMethodEndpointAdapter">
    <property name="methodArgumentResolvers">
    <list>
    <ref bean="marshallingPayloadMethodProcessor"/>
    </list>
    </property>
    <property name="methodReturnValueHandlers">
    <list>
    <ref bean="marshallingPayloadMethodProcessor"/>
    </list>
    </property>
    </bean>

    I am new to Spring-WS and any direction and/or detailed documentation you could point me to would be greatly appreciated. Thanks in advance!

  • #2
    Resolved by adding the org.springframework.ws.server.endpoint.adapter.met hod.MessageContextMethodArgumentResolver class to the list of methodArgumentResolvers.

    Comment


    • #3
      Originally posted by mpressley View Post
      Resolved by adding the org.springframework.ws.server.endpoint.adapter.met hod.MessageContextMethodArgumentResolver class to the list of methodArgumentResolvers.
      Can you please elaborate further on this on what you had to change in the definition of <bean class="org.springframework.ws.server.endpoint.adap ter.DefaultMethodEndpointAdapter">

      Comment


      • #4
        Originally posted by aprajitha View Post
        Can you please elaborate further on this on what you had to change in the definition of <bean class="org.springframework.ws.server.endpoint.adap ter.DefaultMethodEndpointAdapter">
        I simply added a bean to to the list of "methodArgumentResolvers". Below is the Spring Servlet entry with the modification.

        <bean id="defaultMethodEndPointAdapter" class="org.springframework.ws.server.endpoint.adap ter.DefaultMethodEndpointAdapter">
        <property name="methodArgumentResolvers">
        <list>
        <ref bean="marshallingPayloadMethodProcessor"/>
        <bean class="org.springframework.ws.server.endpoint.adap ter.method.MessageContextMethodArgumentResolver"/>
        </list>
        </property>
        <property name="methodReturnValueHandlers">
        <list>
        <ref bean="marshallingPayloadMethodProcessor"/>
        </list>
        </property>
        </bean>

        Comment


        • #5
          Hi. I am new to spring WS and I have created one webservice. I am using same Endpoint like yours. I need to access the parameters of my request. can you please tell me how you processed.

          eg:

          public PutCMSDataResponse handleCmsDataRequest(@RequestPayload PutCMSDataRequest putCMSDataRequest, MessageContext messageContext) throws Exception {
          ...
          }

          In this endpoint class, how you accessed the "putCMSDataRequest" variables in this request. I am getting null . Can you please provide your full configuration and your SOAP request

          Comment

          Working...
          X