Topic: java 傳數組與.net webservice |
Print this page |
1.java 傳數組與.net webservice | Copy to clipboard |
Posted by: skwujinhua Posted on: 2009-07-28 11:20 //c# webservice [SoapRpcMethod(Action = "http://amsweb.dev.org/Sum", RequestNamespace = "http://amsweb.dev.org/S", ResponseNamespace = "http://amsweb.dev.org/S")] [WebMethod] public int sum(int [] str) { int sum = 0; for(int i = 0,sum=0;i < str.Length; i++) { sum+=str[i]; } return sum; } //java mothed int []s = new int[]{1,1,1,1,1}; try{ System.out.println(s[0]); String serviceURL = "http://localhost:3719/AMSWEB/WSE/WebService.asmx"; Service service = new Service(); Call call = (Call)service.createCall(); call.setTargetEndpointAddress(new java.net.URL(serviceURL)); call.setOperationName(new QName("http://amsweb.dev.org/S","sum")); call.addParameter("str", org.apache.axis.encoding.XMLType.SOAP_ARRAY, ParameterMode.IN); call.setReturnType(org.apache.axis.encoding.XMLType.XSD_INT); call.setUseSOAPAction(true); call.setSOAPActionURI("http://amsweb.dev.org/Sum"); Integer res = (Integer)call.invoke(new Object[]{s}); }catch(Exception e) { } 為什么我在eclipse 里傳數組給webservice返回0? 我看沒有傳過去值。調用以下二個參數的方法可以成功。 [SoapRpcMethod(Action = "http://amsweb.dev.org/Add", RequestNamespace = "http://amsweb.dev.org/T", ResponseNamespace = "http://amsweb.dev.org/T")] [WebMethod] public int Add(int a, int b) { int c = a + b; return c; } 哪個高手幫忙解決下?謝謝﹗ |
2.Re:java 傳數組與.net webservice [Re: skwujinhua] | Copy to clipboard |
Posted by: skwujinhua Posted on: 2009-07-28 17:14 哈哈。。。。。。自己搞定。哈哈哈。。。。。。真爽啊。搞了我一天啊。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |