• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Need help using annotations with Axis2

 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anyone please help me out!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"?
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Carlo LF",

Please check your private messages regarding an important administrative matter.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic