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];
 }

 

posted @ 2015-09-22 16:58  晨羲  阅读(1915)  评论(0编辑  收藏  举报