博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

java 调用 .net webservice 示例

Posted on 2017-02-28 10:18  张兴旺11  阅读(94)  评论(0编辑  收藏  举报

String url="http://IP:端口/LisService.asmx";
String methodName="GetLisResultForBlood";
String soapActionURI = "http://tempuri.org/GetLisResultForBlood";
String namespace = "http://tempuri.org/";

Call call = (Call) new Service().createCall();

call.setTargetEndpointAddress(url);
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapActionURI);
call.setOperationName(new QName(namespace,methodName));

call.addParameter(new QName(namespace, "patientId"), XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter(new QName(namespace, "order_item"), XMLType.XSD_STRING,ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);

String[] str = new String[2];
str[0] = patiId;
str[1] = "01";

Object obj = call.invoke(str);
System.out.println("obj + " + obj);