Book Image

Java 7 JAX-WS Web Services

By : Deepak Vohra
Book Image

Java 7 JAX-WS Web Services

By: Deepak Vohra

Overview of this book

<p>Web services are applications that use open, XML-based standards and transport protocols to exchange data with clients. <br /><br />In the book Developing a JAX-WS Web Service using the wsimport clientjar Option, we shall create a JAX-WS web service with Java 7. We shall discuss the new clientjar option in the wsimport tool or the wsimport ant task which is used to generate JAX-WS portable artifacts from a service wsdl. Subsequently, we use the web service artifacts to invoke the web service from a web service client.</p>
Table of Contents (8 chapters)

Creating the implementation class


Next, create the implementation class. Select File | New File. In New File, select Java in Categories and Java Class in File Types, and click on Next:

Specify the Class Name (HelloWSImpl), Package (hellows), and click on Finish:

The web service implementation class HelloWSImpl is annotated with the @WebService annotation and implements the HelloWS interface. The implementation class contains a method hello that takes a String parameter for name and returns a Hello message containing the name. The implementation class is listed as follows:

package hellows;
import javax.jws.*;
@WebService(portName = "HelloWSPort", serviceName = "HelloWSService", targetNamespace = "http://hellows/", endpointInterface = "hellows.HelloWS")
public class HelloWSImpl implements HelloWS {
public String hello(String name) {
// replace with your impl here
return "Hello "+name +" Welcome to Web Services!";
}
}

Similarly, add a Java interface for a SEI. The SEI declares public methods...