RPCServiceClient-調用webservice客戶端


import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

public void callRemoteFun(){

  RPCServiceClient client = null;

  try {
    client = new RPCServiceClient();
    Options options = client.getOptions(); 
    // 創建一個遠程的訪問地址  
    EndpointReference target = new EndpointReference("http://...");
    options.setTo(target);
  } catch (AxisFault e) {
    e.printStackTrace();
  }

  Object[] objargs = new Object[] { "001" , "1.00" , "3" , "123456" , "5" };
  Class[] getobj = new Class[] { String.class };
  Object[] response = client.invokeBlocking(new QName("{SERVICE_NAMESPACE}", "{serviceName}"), objargs,getobj);  
  String result = (String) response[0];
}

 

 轉自:http://blog.csdn.net/fengyun111999/article/details/7517599


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM