简体   繁体   English

JAX-WS 编组错误。 SomeClassV1R5 无法转换为 SomeClass 的目标类型

[英]JAX-WS marshalling Error. SomeClassV1R5 cannot be converted into the destination type of SomeClass

We have migrated from JAX-RPC to JAX-WS services with Websphere(8.5.5 service pack 13) and default Axis2 implementation.我们已经从 JAX-RPC 迁移到带有 Websphere(8.5.5 服务包 13)和默认 Axis2 实现的 JAX-WS 服务。 All services are running fine but 1 client getting strange error for the same operations which are working fine for others.所有服务都运行良好,但 1 个客户端在相同的操作中遇到奇怪的错误,而这些操作对其他人来说运行良好。 We enabled SOAP logs and tried same request with SOAPUI which worked fine.我们启用了 SOAP 日志并尝试使用 SOAPUI 进行相同的请求,效果很好。 Below is the stack trace.下面是堆栈跟踪。 The GetTransactionsV1R8RequestType is not extending GetTransactionsRequestType . 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)

After much struggle I am able find the root cause.经过一番挣扎,我能够找到根本原因。 In this scenario client calling our API using raw SOAP XML over HTTP .在这种情况下,客户使用原始SOAP XML调用我们的 API,而不是HTTP XML has request name as GetTransactionsV1R8RequestType and request is getting validated against XSD/schema successfully. XML 的请求名称为GetTransactionsV1R8RequestType并且请求已成功针对 XSD/模式进行验证。 In HTTP connection, client setting SOAPAction property with value as 'getTransactions' which is initial version of API.HTTP连接中,客户端将SOAPAction属性设置为“getTransactions”,这是 API 的初始版本。 The request name is XML is getTransactionsV1R8RequestType with which expected SOAP operation is 'getTransactionsV1R8'.请求名称是XMLgetTransactionsV1R8RequestType预期的 SOAP 操作是“getTransactionsV1R8”。

Setting proper SOAPAction value resolved the problem.设置正确的SOAPAction值解决了这个问题。

Another observation with this is GetTransactionsV1R8RequestType is not extending GetTransactionsRequestType but was extending GetTransactionsV1R5RequestType and if we set SOAPAction value as ' getTransactionsV1R5 ' with SOAP XML GetTransactionsV1R8RequestType , it's get getting successfully called with operation ' getTransactionsV1R5 ' as GetTransactionsV1R8RequestType can be cast to GetTransactionsV1R5RequestType . Another observation with this is GetTransactionsV1R8RequestType is not extending GetTransactionsRequestType but was extending GetTransactionsV1R5RequestType and if we set SOAPAction value as ' getTransactionsV1R5 ' with SOAP XML GetTransactionsV1R8RequestType , it's get getting successfully called with operation ' getTransactionsV1R5 ' as GetTransactionsV1R8RequestType can be cast to GetTransactionsV1R5RequestType .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM