views:

28

answers:

1

I have a SOAP web service which I call from two clients using axis2. Can the web service know from which of these two clients the call originated from? If so, how do I know that during runtime? Is there any API provided to lookup the name of the invoker of a particular web service by that web service. Thanks.

A: 

Not generally - the HTTP headers sometimes contain some info, but that depends on the client. The best way to determine your caller is to have some known context, such as an ID, passed between your client and service. This can be sent in your SOAP body (as an argument to a service), in a SOAP header or as part of the transport protocol (such as using an HTTP session cookie).

Depending on where the context is held makes different behaviours possible - in the SOAP body means you can use your service implementation to do the handling (perhaps running a DB look-up or similar); in a SOAP Header means you can add a header handler to all services that require the context and set the service invocation up correctly; in the transport protocol means that the context is divorced from the SOAP messages, and a transport handler can be used to correlate the contexts.

ajborley