以文本方式查看主题

-  W3CHINA.ORG讨论区 - 语义网·描述逻辑·本体·RDF·OWL  (http://bbs.xml.org.cn/index.asp)
--  『 Web Services & Semantic Web Services 』  (http://bbs.xml.org.cn/list.asp?boardid=10)
----  JAVA 调用 .NET的WebServices,为什么传递参数为null  (http://bbs.xml.org.cn/dispbbs.asp?boardid=10&rootid=&id=44963)


--  作者:lq34999632
--  发布时间:4/6/2007 2:34:00 PM

--  JAVA 调用 .NET的WebServices,为什么传递参数为null
那位大哥,能帮帮忙,我做了一JAVA调用 .NET的WebServices的接口,程序能运行,就是不能传递参数,传递的参数都为NULL。

下面的是 JAVA调用
Integer i = new Integer(1);
Integer j = new Integer(2);
String endpoint="http://localhost/WebService/ApplicationService.asmx";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName("IntAdd");
call.addParameter("a",XMLType.XSD_INT,ParameterMode.IN);
call.addParameter("b",XMLType.XSD_INT,ParameterMode.IN);
call.setReturnType(XMLType.XSD_INT);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://localhost/IntAdd");
Integer k = (Integer)call.invoke(new Object[]{i,j});
System.out.println( "result is " + k.toString() + ".");


.net的WEBSERVICE

[WebMethod]   
    public int IntAdd(int a, int b)
    {
        return a + b;
    }


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms