Q: How does Axis figure out which deployed service to call?

A: Axis has a very flexible dispatch mechanism, with three built-in
   options, and the ability to customize your own.  Dispatch to a
   service in Axis really means setting the service field in the
   MessageContext as it flows through the various Handlers in your
   configuration.  Once the service is set, the engine will be able
   to call it at the appropriate time.  So who does the setting?  Any
   Handler who wants to.

   The default dispatch mechanism for Axis is by URL, so that if you
   access http://myhost/axis/services/WeatherReport, you will get the
   "WeatherReport" service.  This mechanism works because the HTTP
   transport in Axis has the URLMapper (org.apache.axis.handlers.http.
   URLMapper) Handler deployed on the request chain.  The URLMapper
   takes the incoming URL, extracts the last part of it as the service
   name, and attempts to look up a service by that name in the
   current EngineConfiguration.

   Similarly you could deploy the HTTPActionHandler to dispatch via
   the SOAPAction HTTP header.  You can also feel free to set the
   service in your own custom way - for instance, if you have a
   transport which funnels all messages through a single service, you
   can just set the service in the MessageContext before your transport
   calls the AxisEngine.  Or if you dispatch based on the contents of
   a SOAP header, or the time of day, you could write a Handler which
   did that.

   If no Handler has set the service by the time someone needs to
   deserialize the SOAP message, we will attempt to look it up using
   the namespace of the first body element.  So for instance:

   <SOAP:Body>
     <ns:MyMethod xmlns:ns="http://xml.apache.org/axis/Weather"/>
   </SOAP:Body>

   This message would look up "http://xml.apache.org/axis/Weather"; in
   the namespace mapping list to see if there was an associated
   service.

Q: How do I associate a namespace mapping with my service?

A: The WSDD for your service should look something like this:

   <service name="MyService" provider="java:RPC">
     <namespace>http://my.com/MyServiceNamespace</namespace>
     ...
   </service>

Reply via email to