预加载webService连接
parent
f4818e9357
commit
eb86ab3d3d
@ -0,0 +1,45 @@
|
|||||||
|
package com.emr.controller;
|
||||||
|
|
||||||
|
import com.emr.util.PropertiesUtils;
|
||||||
|
import org.apache.cxf.endpoint.Client;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.PropertySources;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContextEvent;
|
||||||
|
import javax.servlet.ServletContextListener;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName:预加载一次webService
|
||||||
|
* @Description:
|
||||||
|
* @Param 传输参数
|
||||||
|
* @Return
|
||||||
|
* @Author: 曾文和
|
||||||
|
* @CreateDate: 2020/7/7 16:34
|
||||||
|
* @UpdateUser: 曾文和
|
||||||
|
* @UpdateDate: 2020/7/7 16:34
|
||||||
|
* @UpdateRemark: 更新说明
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class WebServiceLoad implements ServletContextListener {
|
||||||
|
@Override
|
||||||
|
public void contextInitialized(ServletContextEvent sce){
|
||||||
|
try {
|
||||||
|
String token = "11";
|
||||||
|
String POWER_URLHEAD = PropertiesUtils.getProperty("POWER_JSP");
|
||||||
|
//创建连接工厂
|
||||||
|
JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance();
|
||||||
|
//创建客户端
|
||||||
|
Client client = dcf.createClient(POWER_URLHEAD + "/WebService/PowerWebService?wsdl");
|
||||||
|
//动态调用getInfosByUserId方法
|
||||||
|
Object[] objects = client.invoke("getInfosByUserId", token, "emr_record");
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue