当前位置: 代码迷 >> Java Web开发 >> 一个关于java调用c#写的webservice的有关问题(传出web method中的ref 参数)
  详细解决方案

一个关于java调用c#写的webservice的有关问题(传出web method中的ref 参数)

热度:5442   发布时间:2013-02-25 21:17:54.0
一个关于java调用c#写的webservice的问题(传出web method中的ref 参数)
请教一下,c#写的web service,其中的web method 中函数参数中有ref 参数,现在用JAVA调用这个服务。在eclipse中用call的方式调用如何传出值来。比如用:
 call.addParameter(new QName("http://tempuri.org/","output"),org.apache.axis.encoding.XMLType.XSD_STRING,ParameterMode.IN);
可以给web method 传入参数,但是用ParameterMode.OUT无法设定ref 参数。大家遇到过吗?
web service 中web method方法声明如下 :
[web method]
int A(string str1,ref string str2)
{
 string2=str1;
}
JAVA调用如下:
call.addParameter(new QName("http://tempuri.org/","str1"),org.apache.axis.encoding.XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter(new QName("http://tempuri.org/","str2"),org.apache.axis.encoding.XMLType.XSD_STRING,ParameterMode.OUT);
String str;
Integer k = (Integer)call.invoke(new Object[]{"123",str);
出现的错误如下:
Exception:
java.lang.NumberFormatException: For input string: "..."
为何不能用out传出参数str2来。

------解决方案--------------------------------------------------------
用C#调用java的服务还没试过,期待高手啊!
------解决方案--------------------------------------------------------
能把你的wsdl贴出来吗。
  相关解决方案