Friday, March 19, 2010

WebServiceClient test code

Following is the sample test code to test the webservice

import javax.xml.rpc.Call;
import javax.xml.rpc.Service;
import javax.xml.namespace.QName;

public class TestClient {
  public static void main(String [] args) {
    try {
      String endpoint = "http://localhost:8080/axis/test.jws";
      Service  service = new Service();
      Call   call = (Call) service.createCall();
      call.setOperationName(new QName(endpoint, "addInt"));
      call.setTargetEndpointAddress( new java.net.URL(endpoint) );
      Integer ret = (Integer)call.invoke(new Object[]{new Integer(5), new Integer(6)});
      System.out.println("addInt(5, 6) = " + ret);
    } catch (Exception e) {
           System.err.println("Execution failed. Exception: " + e);
    }
  }
}

src attachment

Related Posts:

  • Universal sql file executorNeed to execute the sql files without client installation on the box download sqlsexecutor installer which will execute any sql file of database type Mysql,Oracle,Sybase and Mssql. download link https://sourceforge.net/pro… Read More
  • WebServiceClient test codeFollowing is the sample test code to test the webservice import javax.xml.rpc.Call; import javax.xml.rpc.Service; import javax.xml.namespace.QName; public class TestClient {   public static void main(String [] args) { … Read More
  • Coherenc samples and clustering with help of oracle coherence tutorialsAll below explanation and samples are done by reading the document provided by the oracle coherence. The simplest and most flexible way to create caches in Coherence is to use the cache configuration descriptor to define att… Read More
  • Send and Receive files from remote systemSend and receive files from java socket programing Sender : 1. Create a Scoket connection ServerSocket servsock = new ServerSocket(13267); 2. Checks for the socket acceptence from socket client Socket sock = servsock.acc… Read More
  • MySql DB commandsfor mysql : create database test; grant all on test.* to test@'localhost' identified by 'test'; grant all on test.* to test@'%' identified by 'test'; to run scripts in mysql mysql> source <path to sql file> MySql… Read More

0 comments:

Post a Comment