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 JAX-WS wsgen using Maven2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS wsgen using Maven2" Watch "JAX-WS wsgen using Maven2" New topic

JAX-WS wsgen using Maven2

Sarvotham Pai

Joined: Apr 25, 2004
Posts: 1

I am new to webservice and trying sample webservice using JAX-WS.
Following is my pom.xml, which is calling wsgen.




My impl class is

import javax.jws.WebMethod;
import javax.jws.WebService;

public class Hello
private String message = new String("Hello, ");

public String sayHello(String name) {
return message + name + ".";


following is the wsdl generated

<definitions targetNamespace="" name="HelloService" xmlns:tns="" xmlns:xsd="" xmlns:soap="" xmlns="">
<xsd:import namespace="" schemaLocation="HelloService_schema1.xsd"/>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
<portType name="Hello">
<operation name="sayHello">
<input message="tns:sayHello"/>
<output message="tns:sayHelloResponse"/>
<binding name="HelloPortBinding" type="tns:Hello">
<soap:binding transport="" style="document"/>
<operation name="sayHello">
<soapperation soapAction=""/>
<soap:body use="literal"/>
<soap:body use="literal"/>
<service name="HelloService">
<port name="HelloPort" binding="tns:HelloPortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>

wsdl is generated in a different directory and is not got included in the .war file.

I deployed the .war file in weblogic and tried to access the wsdl and i am not able to access the same(http://localhost:8001/MPS-AXIS/HelloService?wsdl).and also i am not able to run the wsimport for the same reason.

What changes i need to do inorder to access the wsdl using web browser after deploying the .war file, so that i will be able to call wsimport.
Ganesh Meenashisundaram

Joined: Jan 19, 2010
Posts: 2

I have the same issue. Were you able to get an answer to your problem.
Here is my pom.xml snippet

And here is the implementation class

Issues, I face with this:

1. The wsdl is getting generated in a seperate folder and does not get included in the .war file.
2. I am not able to access the wsdl url using browser like http://localhost:8080/TestProject/TestService?wsdl
3. How do I specify/configure the SOAP address location in the generated wsdl.

Any help or pointers in this regard would be highly appreciated.


Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
1. Move web service code into a separate project whose packaging should be set to JAR. Then delcare that project as dependency in your project containing WAR code. That is how I build applications using maven.
3. The web service endpoint address is defined in web.xml/sun-jaxws.xml files.

My Blog
Ganesh Meenashisundaram

Joined: Jan 19, 2010
Posts: 2
Hi Vinod,

Thanks for the response. I will move it to a seperate jar and have it as a dependency in my war application.
However, I was wondering, how can I deploy it on Jboss 5 application server. I do not have a choice for Sun Application Server?
And, even in the jar file, where should the generated WSDL file should go?
Also, when I generate the WSDL using wsgen, how do I specify the soap:address location. In the WSDL, it says 'REPLACE_WITH_ACTUAL_URL' ?

Here is my generated WSDL

Thanks a lot.

Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
See here JAX-WS web service and JBoss. Once web service is deployed the, app server will change the value of 'REPLACE_WITH_ACTUAL_URL', you need not worry about that.
wood burning stoves
subject: JAX-WS wsgen using Maven2
It's not a secret anymore!