java 调用 .net webservice 示例

 1            String url="http://IP:端口/LisService.asmx";
 2             String methodName="GetLisResultForBlood";
 3             String soapActionURI = "http://tempuri.org/GetLisResultForBlood";
 4              String namespace = "http://tempuri.org/";
 5              
 6             Call call = (Call) new Service().createCall();
 7             
 8             call.setTargetEndpointAddress(url);
 9             call.setUseSOAPAction(true);
10             call.setSOAPActionURI(soapActionURI);
11             call.setOperationName(new QName(namespace,methodName));
12             
13              call.addParameter(new QName(namespace, "patientId"), XMLType.XSD_STRING,ParameterMode.IN);
14              call.addParameter(new QName(namespace, "order_item"), XMLType.XSD_STRING,ParameterMode.IN);
15              call.setReturnType(XMLType.XSD_STRING);
16              
17              String[] str = new String[2];
18              str[0] = patiId;
19              str[1] = "01";
20              
21              Object obj = call.invoke(str);
22              System.out.println("obj + " + obj);

 

posted @ 2016-08-19 09:10  quietwalk  阅读(192)  评论(0编辑  收藏  举报