欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

使用WebService调用带后缀的HTTP地址:http://ip:port/XXX/JXXX.cls?CfgItem=XXX

最编程 2024-02-13 13:48:35
...
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import java.io.*;
import java.rmi.RemoteException;
public static void sendVitalsignExeMessage(String message) {
   String result = "";
   String endpoint = SystemContainer.writeBackVitalToHis;
   String[] subStrs = endpoint.split("=");
   String url = "";
   String subStr = "";
   url = subStrs[0];
   try {
      subStr = java.net.URLEncoder.encode(subStrs[1], "UTF-8");
   } catch (UnsupportedEncodingException e) {
      log.info("回写地址转换报错:" + e);
   }
   // 回写地址
   endpoint = url + "=" + subStr;
   log.info("回写入参:" + message);
   Service service = new Service();
   Call call = null;
   try {
      call = (Call) service.createCall();
   } catch (ServiceException e) {
      log.info("回写报错:" + e.getMessage());
   }
   call.setTargetEndpointAddress(endpoint);
   call.setOperationName(new QName("http://bjgoodwillcis.com", "XMLMessageServer"));
   call.addParameter("Message", XMLType.XSD_STRING, ParameterMode.IN);// 接口的参数
   call.setReturnType(XMLType.XSD_STRING);// 设置返回类型
   try {
      result = (String) call.invoke(new Object[] { message });
      //log.info("回写返回结果:" + result);
   } catch (RemoteException e) {
      log.info("信息回写报错:" + e.getMessage());
   }
}