Announcement Announcement Module
Collapse
No announcement yet.
MethodEndpointMapping Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MethodEndpointMapping

    Hi,

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

  • #2
    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.

    Comment


    • #3
      HI,
      SWS-129 created.

      Thank you!

      Comment


      • #4
        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.

        Comment


        • #5
          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.

          Comment


          • #6
            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 .

            Comment


            • #7
              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.

              Comment

              Working...
              X