JAX-WS web service eclipse tutorial

In this tutorial,we will see how we can develop JAX-WS endpoint and client step by step.

Web service Tutorial Content:

Prerequisites 

  1. JDK 1.6
  2. Eclipse IDE

Steps for creating JAX-WS webservice endpoint.

1) Open Eclipse IDE
2) Create java project named “JAXWSServer”

3)Create new package named “org.arpit.javapostsforlearning.webservice”

4)Create JAXWSService Endpoint Interface.
HelloWorld.java

5)Create JAXWSService Endpoint implementation class.
HelloWorldImpl.java

6) Create Endpoint publisher.
HelloWorldWSPublisher.java

Run above program.Your webservice is published.You can check your service wsdl at http://localhost:8080/WS/HelloWorld?wsdl

Steps for creating JAXWS Client

1)Open eclipse and create a new java project JAXWSClient.

3) Now we need to generate the client stubs.So open your command line, and enter the wsimport command:

you will find java classes generated and compiled under src->org->arpit->javapostsforlearning->webservice

4) Lets create client class now.
create JAXWSClient.java under src->org.arpit.javapostsforlearning.webservice.client

5) Run above program and you will get following output.

Congratulation, you have successfully created web service endpoint and client.Now in next post, we will deploy it on Tomcat.

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *