|
@ -2,6 +2,7 @@ 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;
|
|
@ -14,13 +15,24 @@ import java.util.Date;
|
|
|
* Created by Administrator on 2016/4/18.
|
|
|
*/
|
|
|
public class RPCUtil {
|
|
|
public static String getRPCData(String methos, Class[] classes, Object[] v) {
|
|
|
public static String getRPCData(String apiName, String apiparam) {
|
|
|
String SERVER_URL = Config.url;
|
|
|
String namespace = Config.namespace;
|
|
|
String xml = getObjectByAxis2CallClient(SERVER_URL, namespace, methos, v, classes);
|
|
|
return xml;
|
|
|
String appId = Config.appId;
|
|
|
return ServiceBus.getInstance(
|
|
|
"172.18.20.123:8085",
|
|
|
"EsbCloud").call(apiName, apiparam);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* webservice调用
|
|
|
*
|
|
|
* @param webServiceAddr
|
|
|
* @param webserviceNamespace
|
|
|
* @param webServiceMethod
|
|
|
* @param inputValues
|
|
|
* @param inputValuetype
|
|
|
* @return
|
|
|
*/
|
|
|
public static String getObjectByAxis2CallClient(String webServiceAddr, String webserviceNamespace, String webServiceMethod,
|
|
|
Object[] inputValues, Class[] inputValuetype) {
|
|
|
|
|
@ -42,13 +54,73 @@ public class RPCUtil {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
String apiName = "ZEUS.HosHOPWs.GetReportList";
|
|
|
|
|
|
String param = "<Req><TransactionCode>1001</TransactionCode>" +
|
|
|
"<Data>" +
|
|
|
"<CardType>1</CardType>" +
|
|
|
"<CardNo>123</CardNo>" +
|
|
|
"<StartDate>2016-04-19</StartDate>" +
|
|
|
"<EndDate>2016-08-19</EndDate>" +
|
|
|
"<Mobile>18559991897</Mobile>" +
|
|
|
"<PatientName>zhengmy" +
|
|
|
"</PatientName>" +
|
|
|
"<ReportType>1</ReportType>" +
|
|
|
"</Data>" +
|
|
|
"</Req>";
|
|
|
String apiparam = "{\"ChannelId\"=\"100123\"," +
|
|
|
"\"ParamType\"=1," +
|
|
|
"\"Params\"=\"" + param + "\"," +
|
|
|
"\"Guid\"=\"" + "00000001111111" + "\"," +
|
|
|
"\"V\"=\"3.0.0\"," +
|
|
|
"\"OutType\"=1," +
|
|
|
"\"HospitalId\"=\"1026333\"}";
|
|
|
String result = null;
|
|
|
result = ServiceBus.getInstance(
|
|
|
"172.18.20.123:8085",
|
|
|
"EsbCloud").call(apiName, apiparam);
|
|
|
}
|
|
|
/*
|
|
|
public static void main(String[] args) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
|
|
String data =
|
|
|
"<Req>" +
|
|
|
"<TransactionCode>yy.yygh.QueryNumbers</TransactionCode>" +
|
|
|
"<Data>" +
|
|
|
"<CardType>123</CardType>" +
|
|
|
"<CardNo>333</CardNo>" +
|
|
|
"<PatientId>333</PatientId>" +
|
|
|
"</Data>" +
|
|
|
"</Req>";
|
|
|
String SERVER_URL = "http://service.yihu.com:8080/WSGW/services/ServiceGateWay";
|
|
|
String namespace = "http://com.yihu.wsgw/ServiceGateWay";
|
|
|
String methos = "yy.yygh.QueryNumbers";
|
|
|
Class[] classes = new Class[]{String.class};
|
|
|
Object[] v = new Object[1];
|
|
|
v[0] = "";
|
|
|
String xml = getObjectByAxis2CallClient(SERVER_URL, namespace, methos, v, classes);
|
|
|
}
|
|
|
String methos = "service";
|
|
|
Class[] classes = new Class[]{String.class, String.class, String.class, String.class, Integer.class, Integer.class, String.class};
|
|
|
Object[] v = new Object[7];
|
|
|
v[0] = "{ClientVersion:1,ClientId:'EsbCloud',Sign:'Sign',SessionKey:''}";//authInfo
|
|
|
v[1] = sdf.format(new Date());//sequenceNo
|
|
|
v[2] = "report.ReportWs.GetReportInfo";//api
|
|
|
v[3] = data;
|
|
|
v[4] = 1;//paramType(0: json 1: Xml)
|
|
|
v[5] = 1;//outType(0: json 1: Xml)
|
|
|
v[6] = "1.0";//API版本号
|
|
|
Object s = RPCUtil.getRPCData( classes, v);
|
|
|
try {
|
|
|
//新建RPC服务客户端
|
|
|
RPCServiceClient serviceClient = new RPCServiceClient();
|
|
|
Options options = serviceClient.getOptions();
|
|
|
//设置URL
|
|
|
EndpointReference targetEPR = new EndpointReference(SERVER_URL);
|
|
|
options.setTo(targetEPR);
|
|
|
//设置参数的类型
|
|
|
//设置namespace和方法名
|
|
|
QName opAddEntry = new QName(namespace, methos);
|
|
|
//数组的第一个值为返回值
|
|
|
String xml = (String) (serviceClient.invokeBlocking(opAddEntry, v, classes))[0];
|
|
|
System.out.println(xml);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}*/
|
|
|
}
|