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) {
	
		具体代码
	}


org.apache.axis2.AxisFault: Unmarshalling Error: unexpected element (uri:"", local:"arg0"). Expected elements are <{}picrecordJson>,<{}extend> 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 org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102) at com.tiandy.util.RPCServerClientUtil.invoke(RPCServerClientUtil.java:76) at com.tiandy.client.UpClientForDZWCHD.reportPassingVehicleInfo(UpClientForDZWCHD.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276) at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:216) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
©️2020 CSDN 皮肤主题: 精致技术 设计师:CSDN官方博客 返回首页