First page Back Continue Last page Graphics

Troubleshooting Web Services: Sample Client


Sample Client for Web Service

The sample Java client for a Web service initializes a proxy to the Web service, exposing the Web service operations as methods on the proxy. You then need to add code to invoke the Web service by using the methods exposed on the proxy. The client contains a comment (“// Add your own code here”) indicating where to add your code. The example in the slide is from a sample client for a Web service called GreetingService with an operation called sayHelloTo. The custom code calls sayHelloTo, passing an argument to it, and prints the result.

To create a sample client for a Web service, right-click the Web service in the Applications Navigator and select Create Client for Web Service Annotations from the context menu. In the Port Endpoints dialog box, select the options for connecting to a remote application server (or accept the default to connect to the integrated server) and click OK.

Note that sample Java clients are not automatically updated to match your service; if you make any changes to the Web service, then you must create another sample Java client.