views:

4421

answers:

3

We are working with tomcat + axis2 + POJO for web service implementation, and we encountered some issues with POJO and axis2 that are a show stopper for us. It seems that axis2 and POJO implementation of SOAP parsing ignores the names of the xml elements and just assign values to the arguments according to the order of the xml elements in the SOAP message. This thing causes a lot of problems in complex APIs.

After some swimming in the documentation swamp of axis2 I was more confused then I came in, so I really need some help.

I understand that JAX-WS and axis2 doesn't have those issues (correct me if I'm wrong), but I can't seem to know how to develop and deploy such solution.

I wrote a POJO, and annotated it with the JAX-WS annotations, I executed wsgen on the class, and packed all in an aar file along with this services.xml file:

<service name="TESTService" >
 <description>
  TEST web service
 </description>
 <messageReceivers>
  <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver" />
  <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
 </messageReceivers>
 <parameter name="ServiceClass">com.test.WsdlImpl</parameter>
</service>

When I try to execute a web service call I get an exception in tomcat:

 [ERROR] The service class cannot be found for this AxisService.
java.lang.RuntimeException: The service class cannot be found for this AxisService.
    at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:95)
    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:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)

Please help me by explaining how to deploy a JAX-WS with tomcat + axis2 (if CXF works with tomcat I can use it also), or direct me to a GOOD tutorial that covers tomcat+axis2.

Thanks!!

+1  A: 

Straight from Axis2 Web site, this is a tutorial covering Axis2 and Jax-Ws. You get the above error probably because the axis2-jaxws-1.3.jar is missing. Check your classpath.

You can of course use CXF with Tomcat and my personal opinion is that you would be better off with it.

kgiannakakis
Thanks for the quick reply.I saw the tutorial that you liked, and I follow it's steps, to this result.I will try to see if I don't have the axis2-jaxws-1.3.jar file and report.Can you please elaborate on using tomcat + cxf + jax-ws?
A: 

As well as CXF, another good option would be Apache Tuscany - makes turning POJOs into services extremely easy.

ajborley
A: 

I was advised to use the official Sun implementation of the JAX-WS layer (Metro 1.4) and it has worked very well so far. The major thing is that it knows how to generate the artifacts as needed at runtime inside the webserver.

When I have reached production qualtiy on our stuff here, I'll probably do a write up of the steps needed.

Thorbjørn Ravn Andersen