uCosminexus Application Server, Web Service Development Guide

[Contents][Glossary][Index][Back][Next]

5.5.2 Creating an implementation class for the Web Service client

Create an implementation class for the Web Service client that uses Web Services.

The following is an example for creating Web Service clients that invokes Web Services once:

package com.sample.client;
 
import com.sample.AddNumbersImpl;
import com.sample.AddNumbersImplService;
import com.sample.AddNumbersFault_Exception;
 
public class TestClient {
 public static void main( String[] args ) {
  try {
   AddNumbersImplService service = new AddNumbersImplService();
   AddNumbersImpl port = service.getAddNumbersImplPort();
   
   int returnValue = port.add( 205, 103 );
   
   System.out.println( "[RESULT] " + returnValue );
  }
  catch( AddNumbersFault_Exception e ){
   e.printStackTrace();
  }
 }
 
}

The created TestClient.java is stored in the c:\temp\jaxws\works\fromjava\client\src\com\sample\client\directory in UTF-8 format.

Note that com.sample, AddNumbersImpl, AddNumbersImplService, AddNumbersImplPort, and add change according to the package name, class name, and method name in the class of the generated Java sources. When you want to develop a Web Service with a different configuration, you must review, and if necessary revise, the coding of the package name, class name, and the method name in the class.