我们已通过Websphere(8.5.5 Service Pack 13)和默认的Axis2实现从JAX-RPC迁移到JAX-WS服务。所有服务运行正常,但1个客户端的相同操作却出现奇怪的错误,而其他操作却正常。我们启用了SOAP日志,并使用SOAPUI尝试了相同的请求,效果很好。下面是堆栈跟踪。 GetTransactionsV1R8RequestType
未扩展GetTransactionsRequestType
。
Caused by: javax.xml.ws.WebServiceException: An internal error occurred during JAX-WS marshalling. An object of type com.kk.v1.GetTransactionsV1R8RequestType cannot be converted into the destination type of com.kk.v1.GetTransactionsRequestType
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:173)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:118)
at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.createRequestSignatureArgs(MethodMarshallerUtils.java:482)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitBareMethodMarshaller.demarshalRequest(DocLitBareMethodMarshaller.java:192)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.createRequestParameters(JavaBeanDispatcher.java:322)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:102)
at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:111)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
经过艰苦的努力,我能够找到烂根源。在这种情况下,客户端使用原始SOAP XML
而不是HTTP
调用我们的API。 XML的请求名称为GetTransactionsV1R8RequestType
,并且已针对XSD /模式成功验证了请求。在HTTP
连接中,客户端将SOAPAction
属性设置为值“ getTransactions”,这是API的初始版本。请求名称为XML
为getTransactionsV1R8RequestType
,预期的SOAP操作为“ getTransactionsV1R8”。
设置适当的SOAPAction
值可解决问题。
[与此相关的另一观察结果是GetTransactionsV1R8RequestType
不在扩展GetTransactionsRequestType
,而是在扩展GetTransactionsV1R5RequestType
,如果我们将SOAPAction
的值设置为getTransactionsV1R5
SOAP XML
为“ GetTransactionsV1R8RequestType
”,则可以成功调用操作[getTransactionsV1R5
”作为GetTransactionsV1R8RequestType
可以转换为GetTransactionsV1R5RequestType
。