Routing spring集成PayloadTypeRouter与javax.xml.bind.JAXBElement

Routing spring集成PayloadTypeRouter与javax.xml.bind.JAXBElement,routing,spring-integration,jaxb2,payload,Routing,Spring Integration,Jaxb2,Payload,基于javax.xml.bind.JAXBElement的负载类型路由的最佳路由解决方案是什么?这是我目前的配置 <oxm:jaxb2-marshaller id="wsMarshaller" contextPath="com.test.conn.ws.domain"/> <int:channel id="jaxbInputChannel" /> <int-ws:inbound-gateway id="wsInboundMarsellingGateway"

基于javax.xml.bind.JAXBElement的负载类型路由的最佳路由解决方案是什么?这是我目前的配置

<oxm:jaxb2-marshaller id="wsMarshaller" contextPath="com.test.conn.ws.domain"/>

<int:channel id="jaxbInputChannel" />

<int-ws:inbound-gateway id="wsInboundMarsellingGateway"
    request-channel="jaxbInputChannel" marshaller="wsMarshaller" unmarshaller="wsMarshaller" />

<int:service-activator input-channel="jaxbInputChannel">
<bean class="com.test.conn.application.AImpl" />


AImpl和BImpl中接收的有效负载类型是javax.xml.bind.JAXBElement和javax.xml.bind.JAXBElement。但当我使用soapUI调用B请求时,它调用AImpl。服务激活器越多(对于不同的负载类型),调用哪个服务激活器就越混乱

因此决定通过添加一个PayloadTypeRouter来解决这个问题,但接下来的问题是如何为类型javax.xml.bind.JAXBElement、javax.xml.bind.JAXBElement等定义它

我希望有一个简单的解决方案,使用SpEL(或另一种直接的方法),而不是在前面添加一个转换器来获取请求getValue。。任何建议都会大有帮助

谢谢


如前一篇文章所述,我继续使用PayloadTypeRouter,transformer实现。我遇到了另一个路障

<int:transformer input-channel="jaxbInputChannel" output-channel="jaxbRoutingChannel"  >
    <bean class="com.test.conn.transformer.ConnTransformer" />
</int:transformer>

<int:payload-type-router input-channel="jaxbRoutingChannel"  >
    <int:mapping type="com.test.conn.ws.domain.A" channel="aInputChannel" />
    <int:mapping type="com.test.conn.ws.domain.B" channel="bInputChannel" />
</int:payload-type-router>

这是我收到的错误消息

原因:org.springframework.expression.spel.SpelEvaluationException:EL1004E:(位置8):在com.sun.proxy上找不到方法调用:方法测试(com.test.conn.ws.domain.A)。$Proxy40 type


我很困惑。为什么spring会查看com.test.conn.ws.domain.A实例中的service activator方法?

为什么适配器中的负载类型是JAXBElement?我猜这是一个JAXB配置问题;解组器应该解组到
A
B
而不是JAXBElement。你的变压器现在正在这样做吗?我建议您打开调试日志记录;如果您无法从中找出原因,请发布包含完整堆栈跟踪的日志。我们使用设计工具(EA)从类图生成xsd。基于此xsd生成的JAXB2代码为JAXBElement。我对这个项目比较陌生,团队一直在做这件事,没有任何问题。只是想弄清楚启用了进近调试选项是否有任何问题,但没有遇到任何对此的投诉。对于“SpelEvaluationException:EL1004E:(位置8)”问题。。我意识到这是一个AOP问题,并在ServiceActivators上添加了一个接口来解决它。还带了一个
<int:transformer input-channel="jaxbInputChannel" output-channel="jaxbRoutingChannel"  >
    <bean class="com.test.conn.transformer.ConnTransformer" />
</int:transformer>

<int:payload-type-router input-channel="jaxbRoutingChannel"  >
    <int:mapping type="com.test.conn.ws.domain.A" channel="aInputChannel" />
    <int:mapping type="com.test.conn.ws.domain.B" channel="bInputChannel" />
</int:payload-type-router>