Hi,
Is it possible to handle multiple requests in one endpoint without annotations?
Hi,
Is it possible to handle multiple requests in one endpoint without annotations?
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.
HI,
SWS-129 created.
Thank you!
Done. I've also moved PayloadMethodEndpointAdapter and MessageMethodEndpointAdapter from the sandbox, so that you can have methods like:
Code:Source handleMyMessage(Source request);These adapters are loaded by default by the MessageDispatcher, because they don't need any additional configuration.Code:void handleMyMessage(MessageContext request);
Hi Arjen,
I'm very interested with this MethodEndpointMapping, but still confused.
I would like to have something like this :
But this is where I'm stuck ...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"/>
Is it possible the "methodPayload" bean defined as above ?
What would be the MyEndpoint class extended from ?
Thanks.
Your class doesn't have to extends from anything, it can be a POJO. The idea is to write a class like such:
and wire it up as follows:Code:public class MyEndpoint { public Source handleMyMessage(Source request) { ... return response; } }
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 simpleCode:<bean class="org.springframework.ws.server.endpoint.mapping.SimpleMethodEndpointMapping"> <property name="endpoints"> <bean class="something.MyEndpoint"/> </property> </bean>.
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.