码迷,mamicode.com
首页 > 编程语言 > 详细

java 调用.net webservice

时间:2015-05-04 22:09:30      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

JAVA代码如下:

static void testTextString() {
try {
String methodSayTo = "test";
// 定义服务
Service service = new Service();


Call call2 = (Call) service.createCall();
call2.setTargetEndpointAddress(new java.net.URL("http://localhost:21972/Service1.asmx"));  //.net websevice地址
call2.setUseSOAPAction(true);
call2.setReturnType(new QName("http://www.w3.org/2001/XMLSchema","string"));
// 第二种设置返回值类型为String的方法
call2.setOperationName(new QName("http://192.168.40.133.org/",methodSayTo));   //命名空间
call2.setSOAPActionURI("http://192.168.40.133.org/test");  //命名空间+函数名
call2.addParameter(new QName("http://192.168.40.133.org/", "name"),// 这里是.net webservice的形参名
XMLType.XSD_STRING, ParameterMode.IN);
String retVal2 = (String) call2
.invoke(new Object[] { "asp webservice" });  //asp webservice为要传递的字符串
System.out.println(retVal2);


} catch (Exception e) {
// TODO: handle exception
}
}



参考文章如下:http://blog.csdn.net/xw13106209/article/details/7067495

java 调用.net webservice

标签:

原文地址:http://blog.csdn.net/shileimohan/article/details/45486111

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!