首页 > 代码库 > Webservice调用服务端 Unmarshalling Error: unexpected element (Xxx). Expected elements are Xxx
Webservice调用服务端 Unmarshalling Error: unexpected element (Xxx). Expected elements are Xxx
使用Axis2调用CXF服务端Webservice方法时:
报错:Unmarshalling Error: unexpected element (uri:"http://ejb.fss.keyman.com", local:"xmldata"). Expected elements are <{}arg0>
详细信息如下:
org.apache.axis2.AxisFault: Unmarshalling Error: unexpected element (uri:"http://ejb.fss.keyman.com", local:"xmldata"). Expected elements are <{}arg0> at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531) at com.keyman.fss.test.FindResultByWorkIDTest.ReportResult(FindResultByWorkIDTest.java:69) at com.keyman.fss.test.FindResultByWorkIDTest.main(FindResultByWorkIDTest.java:80)
解决办法:
在Webservice服务端方法参数前面加上,@WebParam(name = "xmldata", targetNamespace = "http://ejb.fss.keyman.com")
命令空间之类的信息。
例子如下:
public String findResultByWorkID(@WebParam(name = "xmldata", targetNamespace = "http://ejb.fss.keyman.com") String xmldata) { 具体代码 }
Webservice调用服务端 Unmarshalling Error: unexpected element (Xxx). Expected elements are Xxx
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。