File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes web service with jax-ws Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "web service with jax-ws" Watch "web service with jax-ws" New topic

web service with jax-ws

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 761
I'm trying to create web service using jax-ws and following the instructions as shown in the following article by sun.

Creating Simple Web Service Using JAX-WS _

i'm using tomcat 5.0 as container

I have created a service implementation class as shown in the code bellow

now what the article says is as follows

he @WebService annotation declares the class as a web service. The name property in the @WebService annotation lets you define the web service name (the wdsl ortType attribute in WDSL 1.1). The serviceName property lets you define the WDSL service name. These properties are optional; if undefined, sensible default values will be derived from the class name.

The @WebMethod annotation is used to indicate which methods are to be exposed by this web service. Again, this annotation takes optional parameters that can be used to customize the WDSL values, though the default values are often quite sufficient. Note again that, apart from the annotations, this class is a perfectly normal Java class.

The annotations are processed by the JDK annotation processing tool, or Apt. Although Apt can be used as a command-line tool, in general you should integrate it into your build process. To do this using Ant, you need to declare the Apt task, as follows. The class is provided in the jaxws-tools.jar file:

you can find it in the link.

However i'm not able to understand what is apt and what the following xml content shows and where does it should go.

Till now i have written in one implementation class as shown in the code block.

created 1 cmd file as follows

But it is giving me the following error.

what might be the cause of this error ???

If more clarification needed please do let me know.


I tried to run the cmd file after removing
wsgen.bat -cp %CLASSPATH% india.StockQuoteImpl LINE

the class is getting complied fine.
[ February 07, 2008: Message edited by: Jigar Naik ]

Jigar Naik

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 761
yippy.. i got the solution.

wsgen command was generating the web method(.java files) but it wasn't able to compile the generated java files.

i needed to set the classpath for one of the jar file of jaxb which is being used in generated java files. and it for compiled.

I agree. Here's the link:
subject: web service with jax-ws
jQuery in Action, 3rd edition