I have an existing application using embedded jetty, that configures
servlets manually rather than through services.xml. Using Axis2
1.4.1, I have generated code using wsdl2code and configured my
service per some posts that I saw on this topic. My servlet looks
like this:
public class ParlayAxisServlet extends AxisServlet {
final private Logger logger =
LoggerFactory.getLogger(this.getClass());
private String serviceName;
public ParlayAxisServlet(String serviceName) {
this.serviceName = serviceName;
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
logger.debug("initializing parlay axis servlet");
AxisService service;
try {
service =
AxisService.createService(serviceName,axisConfiguration);
axisConfiguration.addService(service);
axisConfiguration.startService(service.getName());
logger.debug("parlay axis servlet initialized for service
name: " + service.getName());
} catch (AxisFault e) {
throw new ServletException("unable to init servlet", e);
}
}
}
I am testing this using Altova XMLSpy 2009 Enterprise, using its SOAP
features. I open the original WSDL that the code was generated from,
and execute an operation. The server gets the request and routes it
to the service operation as expected. The service implementation
looks like:
public class TerminalLocationService implements
TerminalLocationServiceSkeletonInterface {
/**
* Auto generated method signature
*
* @param getLocation2
* @throws PolicyException :
* @throws ServiceException :
*/
public GetLocationResponseE getLocation (GetLocationE
getLocation2) throws PolicyException,ServiceException {
GetLocation requestObject = getLocation2.getGetLocation();
if(requestObject == null) throw new
ServiceException("request object is null");
org.apache.axis2.databinding.types.URI addressURI =
requestObject.getAddress();
if(addressURI == null) throw new
ServiceException("address URI is null");
throw new ServiceException("got to the bottom of the operation
implementation");
}
}
When it gets here, the request object is null, as if axis did not
parse the request XML being sent. In order to try and debug this, I
put some logging into the generated
TerminalLocationServiceMessageReceiverInOut.java and discovered that
invokeBusinessLogic() is never being called. Then upon closer
inspection of my logs I see:
org.apache.axis2.AxisFault: request object is null
at
org
.apache
.axis2
.rpc
.receivers
.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:158)
at
org
.apache
.axis2
.receivers
.AbstractInOutMessageReceiver
.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at
org
.apache
.axis2
.receivers
.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at
org
.apache
.axis2
.transport
.http
.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
502)
So the generated receiver is never being called. Is there something
special I have to do to make axis use this receiver rather than the
AbstractMessageReceiver that I now see in my log output?
Thanks in advance!
Robert Olivier