O'Reilly logo

Java 7 JAX-WS Web Services by Deepak Vohra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a client class

Create a client Java class hellowsclient.HelloWSClient. In the Java client application, create an instance of the HelloWSService service:

hellows.HelloWSService service=new HelloWSService();

The Service class will be created during the build, which is explained later. Obtain a proxy to the service from the service using the getHelloWSPort() method:

hellows.HelloWS port = service.getHelloWSPort();

Invoke the hello(String) method of the service using the service proxy:

String result = port.hello("John Smith.");

Output the result of the web service method invocation. The Java client class is listed as follows:

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package hellowsclient; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required