Results 1 to 7 of 7

Thread: MethodEndpointMapping

  1. #1
    Join Date
    Nov 2005
    Posts
    17

    Default MethodEndpointMapping

    Hi,

    Is it possible to handle multiple requests in one endpoint without annotations?

  2. #2
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Theoretically, yes. In fact, in the sandbox, there is a MethodEndpointMapping which does this: the SimpleMethodEndpointMapping. The idea is that you define a method prefix, and possibly a suffix, and register endpoint beans with that mapping.

    So if the prefix is "handle" (the default), and the incoming message has a payload root called <GetFlights xmlns="http://something">, the handleGetFlights method is invoked.

    If you create an issue, I can move this mapping from the sandbox.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3
    Join Date
    Nov 2005
    Posts
    17

    Default

    HI,
    SWS-129 created.

    Thank you!

  4. #4
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Done. I've also moved PayloadMethodEndpointAdapter and MessageMethodEndpointAdapter from the sandbox, so that you can have methods like:

    Code:
    Source handleMyMessage(Source request);
    Code:
     
    void handleMyMessage(MessageContext request);
    These adapters are loaded by default by the MessageDispatcher, because they don't need any additional configuration.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  5. #5

    Default

    Hi Arjen,

    I'm very interested with this MethodEndpointMapping, but still confused.
    I would like to have something like this :
    Code:
    <bean id="methodPayload" class="org.springframework.ws.???">
       <property name="mappings">
           <props>
               <prop key="{namespace}GetMethodARequest>myEndpoint</prop>
               <prop key="{namespace}GetMethodBRequest>myEndpoint</prop>
           </props>
        </property>
    </bean>
    
    <bean id="myEndpoint" class="com.mycompany.MyEndpoint"/>
    But this is where I'm stuck ...
    Is it possible the "methodPayload" bean defined as above ?
    What would be the MyEndpoint class extended from ?

    Thanks.

  6. #6
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Your class doesn't have to extends from anything, it can be a POJO. The idea is to write a class like such:

    Code:
    public class MyEndpoint {
    
      public Source handleMyMessage(Source request) {
        ...
        return response;
      }
    }
    and wire it up as follows:

    Code:
    <bean class="org.springframework.ws.server.endpoint.mapping.SimpleMethodEndpointMapping">
      <property name="endpoints">
         <bean class="something.MyEndpoint"/>
      </property>
    </bean>
    As a result, the MyEndpoint.handleMyMesage will be invoked whenever a message comes in with MyMessage as payload root local name. So it's more convention-based, though you can define the prefix and suffix the SimpleMethodEndpointMapping looks for (by default "handle", and an empty string respectively). There is no way to map namespaces: like the name says, it's simple .
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  7. #7

    Default

    Thanks Arjen for your reply.

    Maybe I miss something, I did not find SimpleMethodEndpointMapping class, where is it ?
    Why there is no interceptors properties as in PayloadRootQNameEndpointMapping or in SoapActionEndpointMapping ?

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •