This week's book giveaway is in the Spring forum.
We're giving away four copies of Java Persistence with Spring Data and Hibernate and have Cătălin Tudose on-line!
See this thread for details.
Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

JAX-WS wsgen using Maven2

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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">
<soap:operation 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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ganesh Meenashisundaram
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic