Tag Archives: metro

deploy jax-ws or metro web services on tomcat server

When deploy jax-ws application on tomcat you maybe get this issue

SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.NoSuchMethodError: javax.xml.ws.soap.Addressing.responses()Ljavax/xml/ws/soap/AddressingFeature$Responses;
java.lang.NoSuchMethodError: javax.xml.ws.soap.Addressing.responses()Ljavax/xml/ws/soap/AddressingFeature$Responses;

This error occur cause the version JAXWS we use difference with the version JAX-WS ship with java. We can check version ship with java by run wsimport

in $JAVA_HOME/bin by follow command:

wsimport -version

So solution you can using wsimport or wsgen ship with java version to build web service or web service client.
But what happend if you still want using new version JAX-WS?
Well let me show you solution. The answer for that is using the endorsed overriding mechanism.
This guide will help you on Tomcat 6 and 7.

  • Create folder endorsed in $CATALINA_HOME
  • Copy following file in $JAXWS_HOME/lib jax-ws.api.jar,jaxb-api.jar,webservices-api.jar into endorsed

With above change your tomcat will work well with version JAX-WS that you want.
If it still not work so that must has problem on tomcat’s startup script(linux/unix). In that case you must add following parameter into startup script(linux/unix) in JAVA_OPTS parameters

 export JAVA_OPTS="$JAVA_OPTS" -Djava.endorsed.dirs="path of endoresed folder"

How to create web service client using Metro JAX-WS

In this tutorial i demo how to create web service client from wsdl using JAX-WS
Let’s start

1.  Prepare JAX-WS

Go to this https://jax-ws.java.net/ and choose version you want to download that suite for your environment. I’m using tomcat 7 and JDK 7 so i using latest one now JAX-WS 2.2.8

Unzip to any folder in my for example: E:\JAXWS-RI

2. Setup environment

– create OS enviroment JAVA_HOME point to your java sdk

– create JAXWS_HOME point to your unzip folder

3. Generate code client

We will using wsimport tool in $JAXWS_HOME\bin to create web service client from wsdl resource. We can using wsdl file or http url point that wsdl resource.
Following command will generate class runtime and source code( –keep parameter tell tool keep source code for us)

E:\JAXWS-RI\bin>wsimport -keep IpnWebRetrieval.xml

After that you can copy code to any IDE tool to write your own project or create lib to import to your project.