|
@ -3,7 +3,11 @@ package com.yihu.hos.gateway.util;
|
|
|
|
|
|
import com.yihu.hos.config.Config;
|
|
|
import com.yihu.wsgw.api.ServiceBus;
|
|
|
import org.apache.axis2.addressing.EndpointReference;
|
|
|
import org.apache.axis2.client.Options;
|
|
|
import org.apache.axis2.rpc.client.RPCServiceClient;
|
|
|
|
|
|
import javax.xml.namespace.QName;
|
|
|
/**
|
|
|
* Created by Administrator on 2016/4/18.
|
|
|
*/
|
|
@ -26,26 +30,26 @@ public class RPCUtil {
|
|
|
* @param inputValuetype
|
|
|
* @return
|
|
|
*/
|
|
|
// public static String getObjectByAxis2CallClient(String webServiceAddr, String webserviceNamespace, String webServiceMethod,
|
|
|
// Object[] inputValues, Class[] inputValuetype) {
|
|
|
//
|
|
|
// try {
|
|
|
// //新建RPC服务客户端
|
|
|
// RPCServiceClient serviceClient = new RPCServiceClient();
|
|
|
// Options options = serviceClient.getOptions();
|
|
|
// //设置URL
|
|
|
// EndpointReference targetEPR = new EndpointReference(webServiceAddr);
|
|
|
// options.setTo(targetEPR);
|
|
|
// //设置参数的类型
|
|
|
// //设置namespace和方法名
|
|
|
// QName opAddEntry = new QName(webserviceNamespace, webServiceMethod);
|
|
|
// //数组的第一个值为返回值
|
|
|
// return (String) (serviceClient.invokeBlocking(opAddEntry, inputValues, inputValuetype))[0];
|
|
|
// } catch (Exception e) {
|
|
|
// e.printStackTrace();
|
|
|
// }
|
|
|
// return "";
|
|
|
// }
|
|
|
public static String getObjectByAxis2CallClient(String webServiceAddr, String webserviceNamespace, String webServiceMethod,
|
|
|
Object[] inputValues, Class[] inputValuetype) {
|
|
|
|
|
|
try {
|
|
|
//新建RPC服务客户端
|
|
|
RPCServiceClient serviceClient = new RPCServiceClient();
|
|
|
Options options = serviceClient.getOptions();
|
|
|
//设置URL
|
|
|
EndpointReference targetEPR = new EndpointReference(webServiceAddr);
|
|
|
options.setTo(targetEPR);
|
|
|
//设置参数的类型
|
|
|
//设置namespace和方法名
|
|
|
QName opAddEntry = new QName(webserviceNamespace, webServiceMethod);
|
|
|
//数组的第一个值为返回值
|
|
|
return (String) (serviceClient.invokeBlocking(opAddEntry, inputValues, inputValuetype))[0];
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
/*
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
String apiName = "report.ReportWs.GetReportList";
|