Announcement Announcement Module
Collapse
No announcement yet.
how does spring ws identify the operation it needs to hit Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how does spring ws identify the operation it needs to hit

    Typically we have more than one operation for a single serivice end point url.In JAX ws or Axis or CXF we call the service
    typically by specifying endpoint url and operation name explicitly for every client call,but in spring ws typically this is client call
    to a service

    Code:
    Response1 response1 = (Response1) template.marshalSendAndReceive(url,request1);  
    
    Response2 response2 = (Response2) template.marshalSendAndReceive(url,request2);
    here we are actually specifying url and request object varies for every client service call how does spring identify which operation it needs to hit as your not specifying any operation name while calling the service.

    Solicit you to throw some light on the same.

  • #2
    Hi

    Think of WebServices as endpoints for exchanging documents/messages, not as named operations.
    With this mental switch it's easier to imagine Spring's endpoint lookup mechanism.

    First - there is an interface org.springframework.ws.soap.server.SoapEndpointMap ping extending org.springframework.ws.server.EndpointMapping which has one purpose - to return/determine/lookup an object which will be used to invoke your endpoint.

    Then - there are several implementations of the above depending on what addressing mechanism you're using. The names should self-explanatory:
    • PayloadRootQNameEndpointMapping
    • PayloadRootAnnotationMethodEndpointMapping
    • SoapActionEndpointMapping
    • SoapActionAnnotationMethodEndpointMapping
    • SimpleActionEndpointMapping
    • AnnotationActionEndpointMapping
    See the pattern? It's 3 XML-side methods x 2 Java mapping methods. In Java you can specify the mapping by annotation or by explicit map in Spring's XML config. On the XML side you have 3 methods:
    • Determine the endpoint by checking root element of the first (and I hope the only) SOAP:Body child
    • Determine the endpoint by checking Soap-Action HTTP header
    • Determine the endpoint by checking WS-Addressing SOAP:Header child elements
    The first method is the most similar to "old-school" thinking of SOAP messages as wrappers to RPC invocations - the wrapper element (SOAP:Body only child) represents method name.
    The second method (Soap-Action) is SOAP 1.1 default style (also old-school and not so clean because it combines HTTP transport with SOAP messages)
    WS-Addressing is (IMO) the best way to determine the desired, server-side endpoint.

    And in conclusion - how to specify the mapping at client's side? Use marshallSendAndReceive version which takes WebServiceMessageCallback as a parameter. There are two most important implementations:
    • ActionCallback (WS-Addressing)
    • SoapActionCallback (Soap-Action)

    I hope this explains a bit

    regards
    Grzegorz Grzybek

    Comment

    Working...
    X