import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HTTPConstants;
public static void invokeRemoteFuc2() throws Exception {
EndpointReference targetEPR = new EndpointReference("http://10.0.5.115/brm/services/RuleEngine1374389539674484");
Options options = new Options();
options.setAction("http://tempuri.org/getSerTypeList");// 调用接口方法
options.setTo(targetEPR);
options.setProperty(HTTPConstants.CHUNKED, "false");// 设置不受限制.
ServiceClient sender = null;
try {
sender = new ServiceClient();
sender.setOptions(options);
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", "");
OMElement method = fac.createOMElement("getSerTypeList", omNs);
OMElement name = fac.createOMElement("prestr", omNs);// 设置入参名称
OMElement name2 = fac.createOMElement("key", omNs);// 设置入参名称
name.setText("hawei");// 设置入参值
name2.setText("6181a1fb89564b589283ad578baa7d5e");
//method.addChild(name);
//method.addChild(name2);
method.build();
System.out.println("method:" + method.toString());
OMElement response = sender.sendReceive(method);
System.out.println("response:" + response);
OMElement elementReturn = response.getFirstElement();
System.out.println("cityCode:" + elementReturn.getText());
} catch (AxisFault e) {
System.out.println("Error");
e.printStackTrace();
}
}