编写一个 python 客户端以将 xs:anyType 参数传递给 Java 中的 webservice 方法
我编写了一个小型网络服务[Axis2/Java],它公开了一个方法“
public String Fill(String cacheName Object... varArgs) {
return "Sample return "+varArgs[0].toString()+" "+(new Integer(varArgs[1]));
}
我的客户端是一个 python suds 客户端”。
import suds;
import suds.client;
url="http://localhost:8989/pakg1/services/JavaCache?wsdl"
client=suds.client.Client(url)
print client.service.Fill("level1,"Immediate",123123);
WSDL 显示元素 varArgs 如下。
xs:element maxOccurs="unbounded" minOccurs="0" name="varArgs" nillable="true" type="xs:anyType"
然而,运行时对象数组中没有任何内容。当我尝试在调试模式下查看数组时,它显示它为空。
请告知如何将参数传递给 Fill 方法,以便我可以在 varArgs 参数中发送数组或单个基本类型。
谢谢, 达瓦尔。
I have written a small webservice[Axis2/Java] which exposes a method
public String Fill(String cacheName Object... varArgs) {
return "Sample return "+varArgs[0].toString()+" "+(new Integer(varArgs[1]));
}
My client is a python suds client.
import suds;
import suds.client;
url="http://localhost:8989/pakg1/services/JavaCache?wsdl"
client=suds.client.Client(url)
print client.service.Fill("level1,"Immediate",123123);
The WSDL shows that the element varArgs as follows.
xs:element maxOccurs="unbounded" minOccurs="0" name="varArgs" nillable="true" type="xs:anyType"
However Nothing comes in the Object array at run time. When I try to look at the array in debug mode it show that it is null.
Please advice how do I pass arguments to Fill method so that I can send an array, or a single basic type in varArgs parameter.
Thanks,
Dhawal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过将 varArgs 作为 python 列表传递?看看这样的东西是否有效:
Have you tried passing your varArgs as a python list? See if something like this works:
问题出在 axis2 侧。 Axis2 无法反序列化对象并将其误认为是数据处理程序。我决定将我的对象作为 OMElement 传递,然后自己反序列化。
也报告了 Axis2 的问题。
谢谢
The problem is at the axis2 side. The Axis2 is unable to deserialize Object and mistakes it as a DataHandler. I have decided to pass in my Object as OMElement and then deserialize myself.
Have reported the issue with Axis2 also.
Thanks