java - JAX-WS 编组错误。SomeClassV1R5 无法转换为 SomeClass 的目标类型
问题描述
我们已经从 JAX-RPC 迁移到带有 Websphere(8.5.5 服务包 13)和默认 Axis2 实现的 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
在这种情况下,客户端使用 raw over调用我们的 API HTTP
。XML 具有请求名称,GetTransactionsV1R8RequestType
并且请求已成功针对 XSD/模式进行验证。在HTTP
连接中,客户端设置SOAPAction
属性值为“getTransactions”,这是 API 的初始版本。请求名称是XML
预期getTransactionsV1R8RequestType
的 SOAP 操作是“getTransactionsV1R8”。
设置适当的SOAPAction
值解决了这个问题。
与此相关的另一个观察结果GetTransactionsV1R8RequestType
不是扩展GetTransactionsRequestType
而是扩展GetTransactionsV1R5RequestType
,如果我们将SOAPAction
值设置为 ' getTransactionsV1R5
' SOAP XML
GetTransactionsV1R8RequestType
,它会通过操作 ' ' 成功调用,getTransactionsV1R5
因为GetTransactionsV1R8RequestType
可以转换为GetTransactionsV1R5RequestType
。
推荐阅读
- python - 如何获取 Robotframework 测试套件中所有测试用例的名称
- python - 如何从文件中读取 Python 数组?
- php - 如何使用 f 写入函数将变量一个文件传递给另一个文件
- purescript - aff-ify 在错误和成功回调中具有不同结果类型的函数
- php - SoapClient XML 返回字符串与simpleXML?
- windows - 弹性搜索-Java.lang.OutOfMemoryError
- python - 打印 XPATH 结果时出现编码错误
- java - 需要为Query编写Spring Data JPA接口方法
- robotframework - 在其他 TC 中调用 TestCase 作为关键字
- gradle - 重用自定义 gradle 任务的属性