private final static String EHR_URL = ConfigUtil.getInstance().getString("ehrUrl");
/**
* 通过卫生局电子健康档案WEBSERVICE接口获取数据}
private static void initTimeoutConfig(Client client) {
Conduit conduit = client.getConduit();
HTTPConduit hc = (HTTPConduit) conduit;
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(1000 * 10); // 该时间为响应超时。
policy.setConnectionTimeout(1000 * 10); // 连接超时。
hc.setClient(policy);
}
/**
* 将对象转成XML
*
* @param object
* @return
*/
public static String bean2xml(Object object) {
StringWriter writer = new StringWriter();
JAXBContext context;
try {
context = JAXBContext.newInstance(object.getClass());
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(Marshaller.JAXB_ENCODING, "utf-8");
marshaller.marshal(object, writer);
} catch (JAXBException e) {
logger.error("对象转XML错误,obj={},err={}", object, e);
}
return writer.getBuffer().toString();
}