|
@@ -0,0 +1,50 @@
|
|
|
+package com.diagbot.client;
|
|
|
+
|
|
|
+import org.apache.cxf.endpoint.Client;
|
|
|
+import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @author: gaodm
|
|
|
+ * @time: 2019/7/2 10:43
|
|
|
+ */
|
|
|
+public class CxfClient {
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ cl2();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 动态调用方式
|
|
|
+ */
|
|
|
+ public static void cl2() {
|
|
|
+ // 创建动态客户端
|
|
|
+ JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
|
|
|
+ Client client = dcf.createClient("http://116.62.126.198:8089/APP_Webservicesfuzl/service/WebServices?wsdl");
|
|
|
+ // 需要密码的情况需要加上用户名和密码
|
|
|
+ // client.getOutInterceptors().add(new ClientLoginInterceptor(USER_NAME,
|
|
|
+ // PASS_WORD));
|
|
|
+ Object[] objects = new Object[0];
|
|
|
+ try {
|
|
|
+ // invoke("方法名",参数1,参数2,参数3....);
|
|
|
+ String in0 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
|
|
|
+ "<ROOT>\n" +
|
|
|
+ " <HEAD>\n" +
|
|
|
+ " <tranKey>ICSS_GET_PATIENT</tranKey>\n" +
|
|
|
+ " <tranType>ICSS_GET_PATIENT</tranType>\n" +
|
|
|
+ " <stffNo></stffNo>\n" +
|
|
|
+ " <hospitalId></hospitalId>\n" +
|
|
|
+ " <departId></departId>\n" +
|
|
|
+ " <tranData></tranData>\n" +
|
|
|
+ " </HEAD>\n" +
|
|
|
+ " <BODY xsi:type=\"patientInfoRequest\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
|
|
|
+ " <PATIENTID>1</PATIENTID>\n" +
|
|
|
+ " </BODY>\n" +
|
|
|
+ "</ROOT>\n";
|
|
|
+ objects = client.invoke("ICSS_GET_PATIENT", in0);
|
|
|
+ System.out.println("返回数据:" + objects[0]);
|
|
|
+ } catch (java.lang.Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|