Question

We have a legacy web service using Axis 1.4 to receive SOAP calls. Currently the servlet-mapping in the web.xml is using the url-pattern /services/* so that anything under services will map to the AxisServlet. Our wsdd file looks something like this:

<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> 

 <service name="MyService" provider="java:RPC">
  <parameter name="allowedMethods" value="*"/>
  <parameter name="className" value="com.foo.MyService"/>
  <wsdlFile>path/to/wsdl.wsdl</wsdlFile>
 </service>

 <transport name="http">
  <requestFlow>
   <handler type="java:org.apache.axis.handlers.http.URLMapper"/>
   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
  </requestFlow>
 </transport>

 <globalConfiguration>
  <requestFlow>
   <handler type="java:com.foo.AxisRequestHandler"/>
  </requestFlow>
  <responseFlow>
   <handler type="java:com.foo.AxisResponseHandler"/>
  </responseFlow>
 </globalConfiguration>

</deployment>

We now no longer want everything under services to go to Axis, only services/MyService so that we can use other technologies for other requests under services.

So, I changed the web.xml url-pattern for thew AxisServlet to services/MyService. Then, I wanted to remove the URLMapper from the wsdd and have my AxisRequestHandler send all requests to MyService. So, the wsdd now looks like this:

<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> 

 <service name="MyService" provider="java:RPC">
  <parameter name="allowedMethods" value="*"/>
  <parameter name="className" value="com.foo.MyService"/>
  <wsdlFile>path/to/wsdl.wsdl</wsdlFile>
 </service>

 <transport name="http">
  <requestFlow>
   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
  </requestFlow>
 </transport>

 <globalConfiguration>
  <requestFlow>
   <handler type="java:com.foo.AxisRequestHandler"/>
  </requestFlow>
  <responseFlow>
   <handler type="java:com.foo.AxisResponseHandler"/>
  </responseFlow>
 </globalConfiguration>

</deployment>

And in the AxisRequestHandler I have this:

public void invoke(MessageContext context) throws AxisFault
{
    context.setTargetService("MyService");
}

This all works great when actually making the SOAP calls. However, when I go to /services/MyService?wsdl to server up the WSDL file, I get the following error:

error

I've put debug logs in the AxisRequestHandler, and whenever I hit the wsdl, it never hits my handler. Is there something I'm missing here?

Was it helpful?

Solution

After debugging through the Axis code a while, I found that there is a generateWSDL method for the handlers. I added this to AxisRequestHandler:

public void generateWSDL(MessageContext context) throws AxisFault
{
    context.setTargetService("MyService");
}

This method gets called when hitting /services/MyService?wsdl , causing the right service to be set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top