uCosminexus Application Server, Web Service Development Guide
You create the implementation class for the Web Service client that uses the Web Service.
The following is an example of creation of a Web Service client that invokes the Web Service once:
package com.sample.client;
import java.io.File;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import com.sample.UserInfoImpl;
import com.sample.UserData;
import com.sample.UserInfoService;
import com.sample.UserInfoException_Exception;
public class TestClient {
public static void main( String[] args ) {
try {
//Generating-the-DataHandler-object
File imagefile = new File("image.jpg");
FileDataSource fdSource = new FileDataSource(imagefile);
DataHandler dhandler = new DataHandler(fdSource);
UserInfoService service = new UserInfoService();
UserInfoImpl_port = service.getUserInfoImplPort();
UserData userdata = port.getUserData("1", dhandler );
System.out.print( "[RESULT] " + userdata.getMessage() );
System.out.println( " Name:" + userdata.getName()
+ ", Section:" + userdata.getSection() );
}
catch( UserInfoException_Exception e ){
e.printStackTrace();
catch( Exception e ){
e.printStackTrace();
}
}
}
|
The created TestClient.java is stored in c:\temp\jaxws\works\attachments\client\src\com\sample\client\directory with the UTF-8 format.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.