Deploying a JAX-WS service with Axis2 1.5.1?
Justin Garrick <[email protected]>
| Newsgroups | gmane.text.xml.axis.user |
|---|---|
| Message-ID | <CAFO261XnH8_oq8eE5en22BsvSW6MS_AH=ffQiYovLNyF1eXHww@mail.gmail.com> |
I'm trying to deploy a very simple JAX-WS service (w/ implicit SEI) in
Axis2 1.5.1:
package com.service.my;
import javax.annotation.Resource;
import javax.jws.HandlerChain;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.soap.SOAPException;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.soap.Addressing;
import javax.xml.ws.soap.MTOM;
@WebService(serviceName = "MyService", targetNamespace = "
http://my.service.com")
@MTOM
@Addressing
@XmlSeeAlso({ ObjectFactory.class })
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@HandlerChain(file = "my-handler-chain.xml")
public class MyService {
@Resource
private WebServiceContext context;
@WebMethod(operationName = "submit", action = "submit")
public @WebResult String submit(@WebParam(partName = "MyInfo", name =
"MyInfo", targetNamespace = "http://my.service.com") final MyInfo request)
throws Exception {
return "OK";
}
}
I'm wiring it up via a services.xml:
<service name="MyService" scope="soapsession" targetNamespace="
http://my.service.com">
<Description>My Service Endpoint</Description>
<messageReceivers>
<messageReceiver
class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver" mep="
http://www.w3.org/2004/08/wsdl/in-out"/>
</messageReceivers>
<parameter locked="false"
name="ServiceClass">com.service.my.MyService</parameter>
<parameter name="enableMTOM">true</parameter>
<module ref="addressing"/>
</service>
The service is successfully deployed (I can see it at
http://localhost/axis2/services/listServices) and a WSDL is generated.
However, when I submit a request to the service, I get an error message
stating that "The service class cannot be found for this AxisService."
This appears to be caused by the following code in
org.apache.axis2.jaxws.server.JAXWSMessageReceiver:
Parameter endpointDescParam
= service.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);
if (endpointDescParam == null) {
throw new
RuntimeException(Messages.getMessage("JAXWSMessageReceiverNoServiceClass"));
}
This issue has cropped up several times before (between 2008 - 2012), but
doesn't appear to have ever been resolved:
http://www.mail-archive.com/[email protected]/msg43143.html
http://markmail.org/message/5zcygqox2ug443u3#query:+page:1+mid:s74u7nmcpshzhm6r+state:results
Note that this is NOT a miswiring/wrong ServiceClass as theorized in the
threads above. The ServiceClass is obviously correct, as Axis is able to
generated a WSDL for the class. Additionally, if inspected in a debugger,
one can see that the svcClassParam variable in
JAXWSMessageReceiver#receive() is properly resolved.
The JAX-WS Guide<http://axis.apache.org/axis2/java/core/docs/jaxws-guide.html#DeployService>
states
that:
Axis2 provides two mechanisms for deploying JAX-WS services:
1. *The service may be packaged and deployed as an AAR, just like any
other service within Axis2. Like with all AARs, a services.xml file
containing the relevant metadata is required for the service to deploy
correctly.*
2. The service may be packaged in a jar file and placed into the
servicejars directory. The JAXWSDeployer will examine all jars within
that directory and deploy those classes that have JAX-WS annotations which
identify them as Web services.
Is it not possible to deploy a JAX-WS service in the manner described by
(1)? If so, shouldn't the documentation be updated to reflect that?