File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Need help using annotations with Axis2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Need help using annotations with Axis2" Watch "Need help using annotations with Axis2" New topic
Author

Need help using annotations with Axis2

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Hi Ranchers,

I am trying to use the java annotations instead of xml files to deploy a web service some problems arise. I followed this tutorial to create jax-ws web services.

The web service is a simple hello world :


It is compiled this way :
javac -cp /usr/local/tomcat/webapps/axis2/WEB-INF/lib/axis2-jaxws-api-1.4.1.jar ServiceTest.java

And deployed in a directory named "pojo" under the WEB-INF directory of the Axis2 web application inside Tomcat :
cp ServiceTest.class /usr/local/tomcat/webapps/axis2/WEB-INF/pojo

In the "axis2.xml" configuration file :
<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>

So the pojo seems to be well deployed according to the Tomcat logs :
[INFO] Deploying pojo: ServiceTest - /usr/local/tomcat/webapps/axis2/WEB-INF/pojo/ServiceTest.class

The service and its method "hello" appear in the services list at "http://127.0.0.1:8080/axis2/services/listServices".

But when trying to access the wsdl description file of the service at "http://127.0.0.1:8080/axis2/services/ServiceTestService?wsdl" the result is :



However the wsdl2 is available at "http://127.0.0.1:8080/axis2/services/ServiceTestService?wsdl2".

Moreover when trying to invoke the service by using the url call "http://127.0.0.1:8080/axis2/services/ServiceTestService/hello" the result is :
<faultstring>Incoming message protocol does not match endpoint protocol.</faultstring>

The same service without annotations and deployed with a "services.xml" file as an "aar" archive in the "services" directory works fine.

So how to enable the use of annotated services by Axis2 ?

Thanks by advance for your help.
Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Could anyone please help me out!
Upananda Singha
Greenhorn

Joined: Jan 12, 2009
Posts: 3
Hi all,

I am also getting exactly the same problem. Not getting the wsdl1 generated if I use annotations
and bundle as a jar without the services.xml file.

Hi Srikanth, have you got any solution to this...

Can anybody help please.

Upananda
Carlo LF
Greenhorn

Joined: Jan 28, 2009
Posts: 3
I had the same error invoking the service with ?wsdl.

Then I read that running Tomcat with Jdk1.5 you have to copy java jaxws-rt.jar and jaxws-tools.jar from the jax-ws RI to tomcat. I first did this by copying the jars to the SHARED directory of Tomcat. No succes... Then I copied them to the axis2 web application's WEB-INF/lib - and then it was ok invoking the url with the ?wsdl argument.

The other problem stays: if invoke the service with an argument like "http://localhost:8080/axis2/services/HelloWorld.HelloWorldImplPort/sayHi?text=hehheh", then I get an exception :
<faultstring>
Incoming message protocol does not match endpoint protocol.
</faultstring>

I don't know how to solve it: maybe you have to generate client classes with jax-ws "wsgen"?
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
"Carlo LF",

Please check your private messages regarding an important administrative matter.


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Carlo LF wrote:Then I read that running Tomcat with Jdk1.5 you have to copy java jaxws-rt.jar and jaxws-tools.jar from the jax-ws RI to tomcat.


In Tomcat 6.x you don't need to copy anything. You simply modify conf/catalina.properties to load the JAX-WS jars.

# List of comma-separated paths defining the contents of the "shared"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,
# the "common" loader will be used as Catalina's "shared" loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
# Please note that for single jars, e.g. bar.jar, you need the URL form
# starting with file:.
shared.loader=C:/opt/jaxws-ri/lib/*.jar


See Running JAX-WS Samples with Tomcat 6.x

Carlo LF wrote:if invoke the service with an argument like "http://localhost:8080/axis2/services/HelloWorld.HelloWorldImplPort/sayHi?text=hehheh", then I get an exception :
<faultstring>
Incoming message protocol does not match endpoint protocol.
</faultstring>

SOAP Web services do not use URI query parameters. Only a (non-SOAP) web service with an HTTP GET binding using {http://schemas.xmlsoap.org/wsdl/http/}urlEncoded message parameters can do that. (Example using urlReplacement)

Carlo LF wrote:I don't know how to solve it: maybe you have to generate client classes with jax-ws "wsgen"?

wsgen is used to auto-generate web services classes from code - it doesn't generate clients.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help using annotations with Axis2
 
Similar Threads
axis2
services.xml cannot be found in my .jar files
Axis2-1.4 help
Reg: Deployment exception
Axis: WSDL2Java classpath problem