This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS wsgen using Maven2" Watch "JAX-WS wsgen using Maven2" New topic
Author

JAX-WS wsgen using Maven2

Sarvotham Pai
Greenhorn

Joined: Apr 25, 2004
Posts: 1
Hi

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

<build>
<finalName>MPS-AXIS</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>wsgen</goal>
</goals>
<configuration>
<sei>com.web.webservice.Hello</sei>
<genWsdl>true</genWsdl>
<keep>true</keep>
<verbose>true</verbose>

</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

My impl class is

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


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


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

}

following is the wsdl generated

<definitions targetNamespace="http://webservice.web.main.ieso.ips.hp.com/" name="HelloService" xmlns:tns="http://webservice.web.main.ieso.ips.hp.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema>
<xsd:import namespace="http://webservice.web.main.ieso.ips.hp.com/" schemaLocation="HelloService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="Hello">
<operation name="sayHello">
<input message="tns:sayHello"/>
<output message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="HelloPortBinding" type="tns:Hello">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello">
<soapperation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="HelloService">
<port name="HelloPort" binding="tns:HelloPortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>

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
Greenhorn

Joined: Jan 19, 2010
Posts: 2
Greetings,

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.

Thanks,
Ganesh.


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
Greenhorn

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.

Thanks,
Ganesh.
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAX-WS wsgen using Maven2