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 ?
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.
Please check your private messages regarding an important administrative matter.
posted 11 years ago
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.
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# "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:.