axis2 客户端

webservice

axis2 客户端

所需jar包

axiom-api-1.2.11.jar
axis2-adb-1.5.5.jar
axis2-kernel-1.5.5.jar
commons-logging-1.1.1.jar
log4j-1.2.15.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
wsdl4j.jar
XmlSchema-1.4.3.jar
axiom-impl-1.2.11.jar
neethi-2.0.5.jar
wstx-asl-3.2.9.jar
activation-1.1.jar
axis2-transport-local-1.5.5.jar
axis2-transport-http-1.5.5.jar
commons-httpclient-3.1.jar
mail-1.4.jar
httpcore-4.0.jar
commons-codec-1.3.jar

 

 

程序代码

RPCServiceClient serviceClient = null;
  Options options = null;
  try {
   serviceClient = new RPCServiceClient();
   options = serviceClient.getOptions();
   
  } catch (AxisFault e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
       
  EndpointReference targetEPR = new EndpointReference(
          "http://127.0.0.1:8080/services/Crm4Aicbs");
  
  options.setTo(targetEPR);
        // 指定do_login方法的参数值
   Object[] opAddEntryArgs = new Object[] {"<?xml version=\"1.0\" encoding=\"utf-8\"?><record><loginName>admin</loginName><password>password</password>record>"};
        // 指定do_login方法返回值的数据类型的Class对象
        Class[] classes = new Class[] {String.class};
        // 指定要调用的do_login方法及WSDL文件的命名空间
        QName opAddEntry = new QName("", "do_login");
        // 调用example方法并输出该方法的返回值
        Object[] results = serviceClient.invokeBlocking(opAddEntry, opAddEntryArgs, classes);
        //输出返回值
      System.out.println(results[0]);

 

 

你可能感兴趣的:(axis2)