"Oracle Certified Master, Java EE 5 Enterprise Architect" Certified. TOGAF 9 Foundation Certified. Software Architect with more than 8 years of professional hands-on software development experience; utilizing best practices, Object Oriented designs and open standards in developing Portals and enterprise multi-tier applications. BSc from Jordan University faculty of Engineering & Technology – Electrical Engineer Department. Mohammad is a DZone MVB and is not an employee of DZone and has posted 8 posts at DZone. You can read more from them at their website. View Full User Profile

JAX-WS Five Minute Tutorial

03.29.2010
| 238651 views |
  • submit to reddit
This tutorial is for people who want to run a JAX-WS example (Endpoint + Client) in just five minutes.

What you need to run this example:

  1. JDK 1.6
  2. Eclipse .
  3. Be Excited ;)

 Note:- You can download the source code for this example from the resources section.

Developing WebService End Point

1) Open Eclipse, and create a java project "WS-Server".

2) Create WS-Service Endpoint Interface:

package juma.mohammad;

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

@WebService
public interface Greeting {
@WebMethod String sayHello(String name);
}

3) Create WS-Service Endpoint Implementation class:

package juma.mohammad;

import javax.jws.WebService;

@WebService(endpointInterface = "juma.mohammad.Greeting")
public class GreetingImpl implements Greeting {

@Override
public String sayHello(String name) {
return "Hello, Welcom to jax-ws " + name;
}

}

4) Create Endpoint Publisher class:

package juma;

import javax.xml.ws.Endpoint;

import juma.mohammad.GreetingImpl;

public class WSPublisher {
public static void main(String[] args) {
Endpoint.publish("http://localhost:8080/WS/Greeting",new GreetingImpl());
}
}

5) Run the WSPublisher…. Guess what .. your WebService is published..
Wow.. check your service wsdl http://localhost:8080/WS/Greeting?wsdl

Developing WebService Client :

1) Open eclipse and create a new java project WS-Client

2) As you know we need to generate the client stubs... but how? 

open your command line, and enter the wsimport command:

CD %CLIENT_PROJECT_HOME%\src
wsimport –s . http://localhost:8080/WS/Greeting?wsdl

You will find 6 java classes generated, and compiled under src/juma/mohammad.

You can remove *.class files , no need for them :)

3) Now Lets create Client Class which will be dependent on the stubs:

package juma;

import juma.mohammad.Greeting;
import juma.mohammad.GreetingImplService;

public class Client {
public static void main(String[] args){

GreetingImplService service = new GreetingImplService();
Greeting greeting = service.getGreetingImplPort();
System.out.println("------->> Call Started");
System.out.println(greeting.sayHello("Ali"));
System.out.println("------->> Call Ended");
}
}

4) Run the Client Class.... the output should looks like:

------->>  Call Started
Hello, Welcom to jax-ws Ali
------->> Call Ended

Congratulations.... you managed to develop jax-ws Endpoint , Client..

The next tutorial will be how to deploy your Web Service on Tomcat.

Legacy
Article Resources: 
Published at DZone with permission of Mohammad Juma, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Fayez Alrafeea replied on Mon, 2010/03/29 - 3:42am

Nice and very simple.

Thank you.

Sebastián Open replied on Mon, 2010/03/29 - 9:34pm

I'm looking fordward for your next article... A few days ago I tried to "manually" develop and deploy a jax-ws web service to tomcat, and it was a real pain... I had to do it with netbeans and later study the generated .war file. have a look at my try at stackoverflow for details...

Sebastián Open replied on Mon, 2010/03/29 - 9:36pm

ah, I've also found this article very helpful...

Rudi Flager replied on Tue, 2010/03/30 - 2:55am

I realy liked your article, only one small step is missing, the usage of "wsgen" on the serverside to generate the service classes.

Shifong Chang replied on Wed, 2010/03/31 - 3:54pm

One question for step 5 of Developing WebService End Point; how to run the WSPublisher?

Nirav Purohit replied on Thu, 2010/04/01 - 3:19pm

Thanks.

Staring up with JAX-WS has never been so easy!!

Mohammad Juma replied on Sun, 2010/04/04 - 1:14am

@Shifong Chang

Run it as normal java application , nothing special here ;)

Paul Hodor replied on Fri, 2010/04/09 - 3:48pm

Thanks, the tutorial was very helpful. I looked through several others, but the simplicity of this one makes the process much clearer.

One question: How do you control the server that is launched in step 4, such as stopping, restarting, etc?

 

Sam Bos replied on Tue, 2010/07/20 - 5:15pm

Helpful and easy to follow

Rene Unternaehrer replied on Wed, 2010/12/01 - 9:46am

Thank you very much. A short introduction that actually works. I tried a lot but this one is unique. Could you also provide some information how to deploy this webservice now the easiest way on a glassfish V3 server? That would great.

Mohammad Juma replied on Fri, 2010/12/03 - 2:42pm

@Rene

this article maybe useful for you

http://java.dzone.com/articles/jax-ws-deployment-five-minute

Deepak Sharma replied on Sat, 2010/12/25 - 12:54pm

Can you please tell me how to write the wsgen command with full details. Many thanks Deepak

Tom Healy replied on Mon, 2011/03/21 - 12:26pm

Hi Mohammad,

I deployed the webservice to tomcat (jakarta tomcat 5.0.27) and got the error...

Provider org.apache.xalan.processor.TransformerFactoryImpl not found

I removed the xml-apis.jar from common/endorsed and tried again this time with no error. Howver, when I trya and access the service with the url http://localhost:8080/greetingWS/greeting I get a http 404. Any idea what I am doing wrong?

Thanks Tom

Khaled Jawhar replied on Tue, 2011/05/10 - 4:49am

i am using tomcat7.0,jdk1.6,and i downloaded the jax-wsri jar files. first i created folder named ws in webapps in tomcat folder. then in ws folder i created WEB-INF folder and META-INF.and in WEB-INF i created folder classes&folder lib. then i created the web service class as follows package hello; import javax.jws.WebMethod; import javax.jws.WebService; import javax.jws.*; import javax.xml.ws.Endpoint; HelloWorld{ Hello(){ String s; s="Hello"; return s; } public static void main(String[] args) { Endpoint.publish("http://localhost:8080/ws/hello", new HelloWorld()); } } i compiled it and saved HelloWorld.class in:webappswsWEB-INF/classesHelloWorld.class after that i created web.xml that is <?xml version="1.0" encoding="UTF-8"?> com.sun.xml.ws.transport.http.servlet.WSServletContextListener Hello HelloWorld Hello /HelloWorld and saved it in webapps/ws/WEB-INF then i created sun-jaxws <?xml version="1.0" encoding="UTF-8"?> and save it in webapps/ws/WEB-INF i moved also all jar files from jaxws-ri to webappswsWEB-INFlib directory after that i run tomcat and browse through the address http://localhost:8080/ws/HelloWorld/ but i am receiving the requested resource is not available. i don't know if anybody can help regards

Nos Doughty replied on Tue, 2011/05/24 - 7:47am

Superb!

I was pulling my hair out trying to work out how to put a quick WS together. All the other tutorials I found were an exercise in frustration. This is exactly 100% perfect to get started quickly and go from there. Thank you!

 

Khaled Jawhar replied on Sat, 2011/06/04 - 5:19am

i have created a war file and save it in tomcat/webapps folder.this war file contains the code of the server that will read xml file and return it as table in a Jframe.i coded it in java and it is a web service where i create a war file after compiling the code and creating web.xml,and sun-jaxws.xml,and saving the jar files in lib directory. when the client is running the following server i am getting an error Exception in thread "AWT-EventQueue-0" com.sun.xml.internal.ws.protocol.soap.Mes sageCreationException: Couldn't create SOAP message due to exception: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,95] Message: XML document structures must start and end within the same entity. the client and server codes are written below, server code: Java Syntax (Toggle Plain Text) package primary;import java.io.*;import java.net.*;import java.io.File;import java.io.IOException;import java.util.List;import java.util.*;import org.jdom.Document;import org.jdom.Element;import org.jdom.JDOMException;import org.jdom.input.SAXBuilder;import javax.swing.*;import javax.swing.table.*;import javax.swing.event.*;import java.awt.*; import java.awt.event.*;import java.awt.event.WindowAdapter;import java.awt.print.*;import java.awt.print.PrinterException;import javax.imageio.*;import javax.jws.WebService;import javax.jws.WebMethod;import javax.jws.*;import javax.xml.ws.Endpoint;import java.io.Serializable;@WebService public class tallyserver { @WebMethod public Object readtally(String s){Object o1=new Object(); try { try{ int total=0; String s1,s2=""; double cashkz=0,cash$=0; Vector columns; Vector data=new Vector(); Vector data1=new Vector(); JFrame f=new JFrame(); JPanel p=new JPanel(); JTextField t=new JTextField(5); JTextField t1=new JTextField(5); JLabel j1=new JLabel("cash$"); JLabel j2=new JLabel("cashkz"); JPanel p1=new JPanel(); String path1=""; String path=""; JTextField t2=new JTextField(5); final JTextField t3=new JTextField(5); JLabel jl=new JLabel("file name"); path=s; path1="c:\\Tally9.0\\" +path; System.out.println(path1); File xmlFile = new File(path1); columns = new Vector(); columns.add("name"); columns.add("quantity"); columns.add("total price"); SAXBuilder builder = new SAXBuilder(); Document document = (Document) builder.build(xmlFile); Element rootNode = document.getRootElement(); List l1 = rootNode.getChildren("BODY"); Element first = (Element) l1.get(0); List l2 = first.getChildren("IMPORTDATA"); Element second = (Element) l2.get(0); List l3 = second.getChildren("REQUESTDATA"); Element third = (Element) l3.get(0); List l4 = third.getChildren("TALLYMESSAGE"); for (int i = 0; i < l4.size(); i++) { Element forth = (Element) l4.get(i); List l5 = forth.getChildren("VOUCHER"); Element fifth = (Element) l5.get(0); String expected = fifth.getAttribute("VCHTYPE").getValue(); if(expected.equals("Sales")) { List l10=fifth.getChildren("LEDGERENTRIES.LIST"); Element seventh = (Element) l10.get(0); List l11=seventh.getChildren("AMOUNT"); Element eighth = (Element) l11.get(0); String tot = eighth.getText(); int spaceIndex = tot.indexOf(' '); String value5=""; value5= tot.substring(0,spaceIndex); value5=value5.substring(1,value5.length()-1); List l6 = fifth.getChildren("ALLINVENTORYENTRIES.LIST"); for (int j = 0; j < l6.size(); j++) {Element sixth = (Element) l6.get(j); List l7=sixth.getChildren("STOCKITEMNAME"); List l8=sixth.getChildren("ACTUALQTY"); List l9=sixth.getChildren("AMOUNT"); Element goal=(Element) l7.get(0); Element goal1=(Element) l8.get(0); Element goal2=(Element) l9.get(0); String value = goal.getText(); String value1 = goal1.getText(); String value2=goal2.getText(); String value4=""; int Index = value2.indexOf(' '); if (Index==-1) {value4=value2; } else {value4=value2.substring(0,Index); } Vector row=new Vector(); row.addElement(value); row.addElement(value1); row.addElement(value4); data.addElement(row); cashkz=cashkz+Double.parseDouble(value4); } } else if(expected.equals("Payment")) { List payment1=fifth.getChildren("ALLLEDGERENTRIES.LIST"); for (int j = 0; j < payment1.size(); j++) {Element paymente1 = (Element) payment1.get(j); List payment2=paymente1.getChildren("LEDGERNAME"); Element paymente2 = (Element) payment2.get(0); List payment3=paymente1.getChildren("AMOUNT"); Element paymente3 = (Element) payment3.get(0); String ps,ps1; ps=paymente2.getText(); ps1=paymente3.getText(); String value6=""; if (!ps.equals("Rocha Kz")) { int Ind = ps1.indexOf(' '); value6= ps1.substring(0,Ind); if (Ind==-1) value6=ps1; } else {int Ind = ps1.indexOf(' '); value6= ps1.substring(0,Ind); value6=value6.substring(0,value6.length()-1); cashkz=cashkz-Double.parseDouble(value6); } Vector row1=new Vector(); row1.addElement(ps); row1.addElement(value6); data1.addElement(row1); } } else if(expected.equals("Contra")) {List contra1=fifth.getChildren("ALLLEDGERENTRIES.LIST"); Element contraelement1 = (Element) contra1.get(0); List contra2=contraelement1.getChildren("AMOUNT"); Element contraelement2 = (Element) contra2.get(0); String cs,cs1,cs2; cs=contraelement2.getText(); int cind1 = cs.indexOf('='); int cind2 = cind1+6; int cind3 = cs.indexOf(' '); if (cind3==-1) cs2=cs; else { cs2= cs.substring(0,cind3); cs2= cs2.substring(0,cs2.length()-1); } if (cind1==-1) cs1=cs; else { cs1= cs.substring(cind1,cind2); cs1= cs1.substring(2,cs1.length()); } cashkz=cashkz-Double.parseDouble(cs2); cash$=Double.parseDouble(cs1); } } t.setText(Double.toString(cash$)); t1.setText(Double.toString(cashkz)); final JTable table = new JTable(data, columns); Vector columns1; columns1 = new Vector(); columns1.add("name"); columns1.add("amount"); final JTable table1 = new JTable(data1, columns1); table1.setRowSelectionAllowed( true ); table1.setColumnSelectionAllowed( true ); JScrollPane scrollPane1 = new JScrollPane(table1); table.setRowSelectionAllowed( true ); table.setColumnSelectionAllowed( true ); JScrollPane scrollPane = new JScrollPane(table); p.add( scrollPane ,BorderLayout.CENTER); p.add( scrollPane1 ,BorderLayout.CENTER); p.add(j1); p.add(t); p.add(j2); p.add(t1); f.add(p); Object o=new Object(); o=(JFrame)f; return o; } catch(JDOMException jdomex) { System.out.println(jdomex.getMessage()); } } catch(IOException ioException) { ioException.printStackTrace(); }return o1; }public static void main(String[] args){ System.out.println("server");}}package primary; import java.io.*; import java.net.*; import java.io.File; import java.io.IOException; import java.util.List; import java.util.*; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; import javax.swing.*; import javax.swing.table.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.awt.event.WindowAdapter; import java.awt.print.*; import java.awt.print.PrinterException; import javax.imageio.*; import javax.jws.WebService; import javax.jws.WebMethod; import javax.jws.*; import javax.xml.ws.Endpoint; import java.io.Serializable; @WebService public class tallyserver { @WebMethod public Object readtally(String s) {Object o1=new Object(); try { try{ int total=0; String s1,s2=""; double cashkz=0,cash$=0; Vector columns; Vector data=new Vector(); Vector data1=new Vector(); JFrame f=new JFrame(); JPanel p=new JPanel(); JTextField t=new JTextField(5); JTextField t1=new JTextField(5); JLabel j1=new JLabel("cash$"); JLabel j2=new JLabel("cashkz"); JPanel p1=new JPanel(); String path1=""; String path=""; JTextField t2=new JTextField(5); final JTextField t3=new JTextField(5); JLabel jl=new JLabel("file name"); path=s; path1="c:\\Tally9.0\\" +path; System.out.println(path1); File xmlFile = new File(path1); columns = new Vector(); columns.add("name"); columns.add("quantity"); columns.add("total price"); SAXBuilder builder = new SAXBuilder(); Document document = (Document) builder.build(xmlFile); Element rootNode = document.getRootElement(); List l1 = rootNode.getChildren("BODY"); Element first = (Element) l1.get(0); List l2 = first.getChildren("IMPORTDATA"); Element second = (Element) l2.get(0); List l3 = second.getChildren("REQUESTDATA"); Element third = (Element) l3.get(0); List l4 = third.getChildren("TALLYMESSAGE"); for (int i = 0; i < l4.size(); i++) { Element forth = (Element) l4.get(i); List l5 = forth.getChildren("VOUCHER"); Element fifth = (Element) l5.get(0); String expected = fifth.getAttribute("VCHTYPE").getValue(); if(expected.equals("Sales")) { List l10=fifth.getChildren("LEDGERENTRIES.LIST"); Element seventh = (Element) l10.get(0); List l11=seventh.getChildren("AMOUNT"); Element eighth = (Element) l11.get(0); String tot = eighth.getText(); int spaceIndex = tot.indexOf(' '); String value5=""; value5= tot.substring(0,spaceIndex); value5=value5.substring(1,value5.length()-1); List l6 = fifth.getChildren("ALLINVENTORYENTRIES.LIST"); for (int j = 0; j < l6.size(); j++) {Element sixth = (Element) l6.get(j); List l7=sixth.getChildren("STOCKITEMNAME"); List l8=sixth.getChildren("ACTUALQTY"); List l9=sixth.getChildren("AMOUNT"); Element goal=(Element) l7.get(0); Element goal1=(Element) l8.get(0); Element goal2=(Element) l9.get(0); String value = goal.getText(); String value1 = goal1.getText(); String value2=goal2.getText(); String value4=""; int Index = value2.indexOf(' '); if (Index==-1) {value4=value2; } else {value4=value2.substring(0,Index); } Vector row=new Vector(); row.addElement(value); row.addElement(value1); row.addElement(value4); data.addElement(row); cashkz=cashkz+Double.parseDouble(value4); } } else if(expected.equals("Payment")) { List payment1=fifth.getChildren("ALLLEDGERENTRIES.LIST"); for (int j = 0; j < payment1.size(); j++) {Element paymente1 = (Element) payment1.get(j); List payment2=paymente1.getChildren("LEDGERNAME"); Element paymente2 = (Element) payment2.get(0); List payment3=paymente1.getChildren("AMOUNT"); Element paymente3 = (Element) payment3.get(0); String ps,ps1; ps=paymente2.getText(); ps1=paymente3.getText(); String value6=""; if (!ps.equals("Rocha Kz")) { int Ind = ps1.indexOf(' '); value6= ps1.substring(0,Ind); if (Ind==-1) value6=ps1; } else {int Ind = ps1.indexOf(' '); value6= ps1.substring(0,Ind); value6=value6.substring(0,value6.length()-1); cashkz=cashkz-Double.parseDouble(value6); } Vector row1=new Vector(); row1.addElement(ps); row1.addElement(value6); data1.addElement(row1); } } else if(expected.equals("Contra")) {List contra1=fifth.getChildren("ALLLEDGERENTRIES.LIST"); Element contraelement1 = (Element) contra1.get(0); List contra2=contraelement1.getChildren("AMOUNT"); Element contraelement2 = (Element) contra2.get(0); String cs,cs1,cs2; cs=contraelement2.getText(); int cind1 = cs.indexOf('='); int cind2 = cind1+6; int cind3 = cs.indexOf(' '); if (cind3==-1) cs2=cs; else { cs2= cs.substring(0,cind3); cs2= cs2.substring(0,cs2.length()-1); } if (cind1==-1) cs1=cs; else { cs1= cs.substring(cind1,cind2); cs1= cs1.substring(2,cs1.length()); } cashkz=cashkz-Double.parseDouble(cs2); cash$=Double.parseDouble(cs1); } } t.setText(Double.toString(cash$)); t1.setText(Double.toString(cashkz)); final JTable table = new JTable(data, columns); Vector columns1; columns1 = new Vector(); columns1.add("name"); columns1.add("amount"); final JTable table1 = new JTable(data1, columns1); table1.setRowSelectionAllowed( true ); table1.setColumnSelectionAllowed( true ); JScrollPane scrollPane1 = new JScrollPane(table1); table.setRowSelectionAllowed( true ); table.setColumnSelectionAllowed( true ); JScrollPane scrollPane = new JScrollPane(table); p.add( scrollPane ,BorderLayout.CENTER); p.add( scrollPane1 ,BorderLayout.CENTER); p.add(j1); p.add(t); p.add(j2); p.add(t1); f.add(p); Object o=new Object(); o=(JFrame)f; return o; } catch(JDOMException jdomex) { System.out.println(jdomex.getMessage()); } } catch(IOException ioException) { ioException.printStackTrace(); } return o1; } public static void main(String[] args) { System.out.println("server"); } } client code: Java Syntax (Toggle Plain Text) import javax.xml.*;import java.net.*;import primary.Tallyserver;import primary.TallyserverService;import javax.swing.*;import javax.swing.table.*;import javax.swing.event.*;import java.io.*;import java.util.*;import java.util.StringTokenizer;import java.awt.*; import java.awt.event.*;import java.awt.event.WindowAdapter;import java.awt.print.*;import java.awt.print.PrinterException;public class tallyclient{public static void main(String[] args){try{ JFrame frame=new JFrame("Tally"); JPanel p=new JPanel(); JButton button = new JButton("access server"); final JTextField t=new JTextField(5); p.add(t); p.add(button); frame.add(p); frame.setSize(200,100); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { TallyserverService service=new TallyserverService(); final Tallyserver port = service.getTallyserverPort(); JFrame frame1=new JFrame("khaled"); frame1=(JFrame)port.readtally(t.getText()); frame1.setSize(200,100); frame1.setVisible(true); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }); }catch(Exception e) { e.printStackTrace(); }}}import javax.xml.*; import java.net.*; import primary.Tallyserver; import primary.TallyserverService; import javax.swing.*; import javax.swing.table.*; import javax.swing.event.*; import java.io.*; import java.util.*; import java.util.StringTokenizer; import java.awt.*; import java.awt.event.*; import java.awt.event.WindowAdapter; import java.awt.print.*; import java.awt.print.PrinterException; public class tallyclient{ public static void main(String[] args){ try{ JFrame frame=new JFrame("Tally"); JPanel p=new JPanel(); JButton button = new JButton("access server"); final JTextField t=new JTextField(5); p.add(t); p.add(button); frame.add(p); frame.setSize(200,100); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { TallyserverService service=new TallyserverService(); final Tallyserver port = service.getTallyserverPort(); JFrame frame1=new JFrame("khaled"); frame1=(JFrame)port.readtally(t.getText()); frame1.setSize(200,100); frame1.setVisible(true); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }); } catch(Exception e) { e.printStackTrace(); } } }

Ronald Tagoe replied on Wed, 2011/07/06 - 6:16am

Mohammad please i will like to deploy the web service i created using java netbeans onto the internet can u please help me out thanx

Edwin Jaws replied on Sat, 2011/07/30 - 2:07pm

Hi! Mohammad when I go into juma/mohammad to try to compile the classes javac I am using java6 and Tomcat 6. root@squezze:~/ws/juma/mohammad# javac GreetingImpl.java GreetingImpl.java:6: cannot find symbol symbol: class Greeting public class GreetingImpl implements Greeting { ^ GreetingImpl.java:8: method does not override or implement a method from a supertype @Override ^ 2 errors root@squezze:~/ws/juma/mohammad#

Edwin Jaws replied on Sat, 2011/07/30 - 2:09pm

Roman Würsch replied on Wed, 2011/11/30 - 4:27am

KISS ---> As i like...

 Thanks a lot.

Kumeta Tahat replied on Sun, 2012/02/05 - 9:14am

The class EndPoint ... where is it coming from? which jar?

Mohammad Juma replied on Tue, 2012/03/27 - 7:58am in response to: Kumeta Tahat

It is included in the JDK itself .

Semika Siriwardana replied on Thu, 2012/05/10 - 11:25pm

I could not create the 'Client.java'. It has only set of *.class files with in the src folder.

 When I write the following code,

 

GreetingImplService service = new GreetingImplService();

 

It gives compiler error. Please explain the things in fully.

 

Regards

Semika

Carla Brian replied on Tue, 2012/06/19 - 5:50pm

This is a brief tutorial yet a good one. I've learned a lot from this one. - Instant Tax Solutions Scam

jaizon lubaton replied on Thu, 2012/06/21 - 3:35pm

Your tutorial is clear, i got jax-ws endpoint published in Tomcat.

Mohammad Juma replied on Tue, 2012/07/03 - 6:49am in response to: jaizon lubaton

Congratulations :)

 

you can refer to this tutorial for web service deployment on Tomcat :

http://java.dzone.com/articles/jax-ws-deployment-five-minute

 

 

Hamid Seleman replied on Mon, 2012/11/26 - 3:23pm

 Hi there,

Great post! simple and importantly, it works.

btw, I have to issue command to generate the cliet stub differently as follows:

wsimport http://localhost:8080/WS/Greeting?wsdl -s .

regards,

Alexander Podkutin replied on Sun, 2013/02/24 - 1:47pm

Thank you, very helpfull!

Praveen Das replied on Fri, 2013/02/15 - 4:45am

 Thank You, was simple and understandable.

For anybody who are using Maven Projects please use below command to Generate Classes -

ex: 

1. Go to Project Home

2. wsgen -s src/main/java -d target/jax-ws-maven-poc/WEB-INF/classes -cp target/jax-ws-maven-poc/WEB-INF/classes com.hcl.jaxws.impl.SampleWSImpl


It creates the classes in package under src/main/java


Just in case it helps somebody :)


Regards,

PD

Amruta Mistry replied on Thu, 2013/02/28 - 4:24am

Hi ,

I have created Maven based project where i am looking for pom configuration which will help me to generate client.Because when i m trying to use wsimport it throws an error.


Thanks

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.