Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » WebService/XML/JSON/SOAP/SOA » Web Services  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 java 傳數組與.net webservice
skwujinhua





发贴: 104
积分: 11
于 2009-07-28 11:20 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
//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;
}

哪個高手幫忙解決下?謝謝﹗


skwujinhua edited on 2009-07-28 11:25


话题树型展开
人气 标题 作者 字数 发贴时间
9800 java 傳數組與.net webservice skwujinhua 1487 2009-07-28 11:20
8572 Re:java 傳數組與.net webservice skwujinhua 33 2009-07-28 17:14

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2018 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号
客服电话 0592-8750026    客服信箱 714923@qq.com    客服QQ 714923