I would use Axis2-1.6.2 at least, and not any-longer Axis2-1.5.1; There has 
some many things changed, enhanced in the JAX-WS area since Axis2-1.5.1. 

 

You are 100% right: aar and service.xml is very badly documented how to us it 
joint within a JAX-WS service packaged as .AAR file. 

 

If something goes wrong, somewhere and sometimes, funny fallbacks to defaults 
take place. 

 

I was for days and weeks in JAX-WS code, to get a AXIS2/JAX-WS web-service from 
which I can take down using VS 2010 my web service client stubs. and even then 
when simple things have been running nicel and fast, I had to debug to find why 
I get certain JAX-related run-time-errors mainly in the area of handling or 
raising faults. Or I tried to answer me why a fault is raised by AXIS2/JAX-WS. 
One of the most famous thing I discovered once was, that I had to drop an  
@xxxx annotation to make my code running, because defaults where delivered 
properly, while doing it correctly by hand coded @annotations ended up in 
erroneous conditions taking bad code-path-ways later, ending in run-time-errors.

 

I would further suggest to use the jar-file approach and forget about the aar 
approach and have a greater chance for well running code examples to be found 
on the internet.

 

Further important is the following: Generating WSDL and client stub code using 
VS2010: One can generate WSDL at a client just using the EPR to a running axis2 
service developed using only JAX-WS @annotations. (in my case on AXIS2-1.6.2, 
Tomcat, JAVA 6, OpenVMS), While one can add @annotations to indicate a wsdl 
file/content to use, to fine tune certain things. Going this way can have 
advantages but it also complicates things mainly in the area of mappings, and 
it adds complexity to the overall model. A change at a method needs to add the 
proper thing in the wsdl service side; and so on; And the same is true if you 
use a service.xml file not exactly matching  your service derived from 
annotations.

 

As a hint which further helped me: 

I turned on a lot of axis2 jax-ws log4j loggers, always the relevant ones, so 
you need the axis2 code as well and fined which loggers you need to turn on.  
(this said once; there are developers they prefer logging over debugging, and 
they are developers which prefer debugging over logging, I use both in case of 
troubles.)

 

Josef - Just back from the Amazonas with 40°C and 95% humidity,

 

 

 

 

Von: Justin Garrick [mailto:justingarr...@gmail.com] 
Gesendet: Montag, 22. Oktober 2012 19:37
An: java-user@axis.apache.org
Betreff: Deploying a JAX-WS service with Axis2 1.5.1?

 

I'm trying to deploy a very simple JAX-WS service (w/ implicit SEI) in Axis2 
1.5.1:

 

package com.service.my <http://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 
<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 <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 <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 
<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 
<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/axis-user@ws.apache.org/msg43143.html 
<http://www.mail-archive.com/axis-user@ws.apache.org/msg43143.html> 

http://markmail.org/message/5zcygqox2ug443u3#query:+page:1+mid:s74u7nmcpshzhm6r+state:results
 
<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?

 

Reply via email to