uCosminexus Application Server, Web Service Development Guide

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

4.5.2 Creating an implementation class for the Web Service client

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

The following is an example for creating an implementation class of the Web Service client that invokes a Web Service once:

package com.example.sample.client;
 
import com.example.sample.TestJaxWs;
import com.example.sample.TestJaxWsService;
import com.example.sample.UserDefinedException;
 
public class TestClient {
 public static void main( String[] args ) {
 try {
  TestJaxWsService service = new TestJaxWsService();
  TestJaxWs port = service.getTestJaxWs();
  
  String returnValue = port.jaxWsTest1( "Invocation test.", 1003 );
  
  System.out.println( "[RESULT] " + returnValue );
 }
 catch( UserDefinedException e ){
  e.printStackTrace();
 }
 }
 
}

The created TestClient.java is stored in c:\temp\jaxws\works\fromwsdl\client\src\com\example\sample\client\directory with the UTF-8 format. The com.example.sample, TestJaxWs, TestJaxWsService, TestJaxWs, and jaxWsTest1 change according to the package name, class name, and method name in the class of the generated Java source. For developing 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.