赞
踩
调接口时,遇见这样的错误:
org.codehaus.xfire.fault.XFireFault: Unmarshalling Error: 意外的元素 (uri:"", local:"arg0")。所需元素为<{}arg0>
at org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)
at org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)
at org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)
at org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
at org.codehaus.xfire.client.Client.invoke(Client.java:336)
at org.codehaus.xfire.client.Client.invoke(Client.java:368)
解决办法:
在WebService接口及其实现类的方法名处,加上@WebParam(name = "",targetNamespace="")
例:
public String test( @WebParam(name = "req",targetNamespace="http://test.com/")String req);
public String test(@WebParam(name = "req",targetNamespace="http://test.com/")String req){
System.out.println(req);
return "测试通过";
}
修改后,再次调用,接口可正常调用了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。