Web 服务问题 - 方法不能采用超过 1 个参数
我正在使用 IntelliJ IDEA 8 和 Axis 来设置部署在 Tomcat5.5 上的 Web 服务。生成的 wsdl 如下所示: http://track.priskick.se/Tracker.wsdl
方法被声明为
public void storeImpressionReport(int siteId, int adId, int zoneId, int count,
int excludeCount) { ... }
并在 Web 服务中公开。接下来,我使用 Axis 构建客户端(也是 Java),但是当使用参数 0,0,0,0,0
对该方法进行运行时调用时,我得到以下结果:
Tried to invoke method public void com.xxxxx.xxxx.xxxx.xxxxx.storeImpressionReport(int,int,int,int,int) with arguments java.lang.Integer,null,null,null,null. The arguments do not match the signature.; nested exception is: java.lang.IllegalArgumentException
减少数量将方法的参数设置为 1 使其可以工作,但这感觉像是一个非常愚蠢的限制和奇怪的行为。如果您知道这里可能出了什么问题,请帮助我 - 为什么我不能公开方法并让它们采用多个参数?
=== 更新
我现在尝试使用从 IntelliJ 生成的 wsdl 生成客户端 java,而不是使用 ?wsdl 选项调用服务。此 wsdl 保留了正确的参数名称,可能是因为生成器可以访问源。现在我得到
No such operation 'siteId' AxisFault
这些是相关文件: http://track.priskick.se/Tracker/TrackerSoapBindingStub.java http://track.priskick.se/Tracker/TrackerServiceTestCase.java http://track.priskick.se/Tracker/Tracker_PortType.java http://track.priskick.se/Tracker/TrackerService.java http://track.priskick.se/Tracker/TrackerServiceLocator.java
使用的 wsdl客户的位置是 http://track.priskick.se/Tracker.wsdl
该服务位于 http://stage.klikki.com/services/Tracker
干杯 马库斯·约翰逊
I'm using IntelliJ IDEA 8 and Axis to set up a webservice that's deployed on Tomcat5.5. The generated wsdl looks like this: http://track.priskick.se/Tracker.wsdl
A method is declared as
public void storeImpressionReport(int siteId, int adId, int zoneId, int count,
int excludeCount) { ... }
and exposed in the webservice. Next, I build the client (also Java) using Axis, but as a runtime call to the method is made with the parameters 0,0,0,0,0
, I get this:
Tried to invoke method public void com.xxxxx.xxxx.xxxx.xxxxx.storeImpressionReport(int,int,int,int,int) with arguments java.lang.Integer,null,null,null,null. The arguments do not match the signature.; nested exception is: java.lang.IllegalArgumentException
Reducing the number of parameters of the method to 1 makes it work, however this feels like a pretty silly limitation and strange behaviour. Please help me if you know what might be wrong here - why can't I expose methods and have them take more than one parameter?
=== UPDATE
I now tried generating the client java using wsdl generated from IntelliJ instead of calling the service with the ?wsdl option. This wsdl keeps the correct parameter names, maybe because the generator has access to the source. Now I get
No such operation 'siteId'
AxisFault
These are the relevant files:
http://track.priskick.se/Tracker/TrackerSoapBindingStub.java
http://track.priskick.se/Tracker/TrackerServiceTestCase.java
http://track.priskick.se/Tracker/Tracker_PortType.java
http://track.priskick.se/Tracker/TrackerService.java
http://track.priskick.se/Tracker/TrackerServiceLocator.java
the wsdl used for the client is found at
http://track.priskick.se/Tracker.wsdl
the service is found at
http://stage.klikki.com/services/Tracker
Cheers
Marcus Johansson
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哦,喜悦。我将服务风格改为WRAPPED,这似乎已经解决了问题。
Oh the joy. I changed the service style to WRAPPED, and this seems to have solved the problem.