Jaxb 如何通过Spring integration outbound gateway使具有4个字符串参数的web服务方法参与进来?

Jaxb 如何通过Spring integration outbound gateway使具有4个字符串参数的web服务方法参与进来?,jaxb,spring-integration,spring-ws,Jaxb,Spring Integration,Spring Ws,我已经设置了网关和服务,但是web方法不是一个包装对象,而是4个字符串 JAXB引发了错误 “javax.xml.bind.MarshalException -除此之外: [com.sun.istack.internal.SAXException2:无法将类型“java.lang.String”封送为元素,因为它缺少@XmlRootElement注释]” integration.xml <int-ws:outbound-gateway id="outboundGateway" re

我已经设置了网关和服务,但是web方法不是一个包装对象,而是4个字符串

JAXB引发了错误

“javax.xml.bind.MarshalException -除此之外: [com.sun.istack.internal.SAXException2:无法将类型“java.lang.String”封送为元素,因为它缺少@XmlRootElement注释]”

integration.xml

<int-ws:outbound-gateway id="outboundGateway"
    request-channel="requestChannel" 
    reply-channel="responseChannel"
    uri="http://localhost:8080/Service?wsdl"
    message-sender="messageSender" 
    marshaller="marshaller"
    unmarshaller="marshaller"/>

<bean id="messageSender" class="org.springframework.ws.transport.http.HttpComponentsMessageSender">
    <property name="connectionTimeout" value="5000"/>
    <property name="readTimeout" value="10000"/>
</bean>


<int:channel id="requestChannel"/>
<int:channel id="responseChannel"/>

<oxm:jaxb2-marshaller id="marshaller" context-path="myProject.ws.bean" />

<int:gateway id="webMethodGateway" 
    default-request-channel="requestChannel"
    default-reply-channel="responseChannel"
    service-interface="myProject.ws.gateway.WebMethodGateway" />

首先,它不是
4个字符串
,而是单个串联字符串:

@Payload("#args[0] + #args[1] + #args[2] + #args[3]")
另一个问题

用于Web服务,即SOAP。因此,XML。 正确的JaxB为您生成XML,但它确实为域实体而不是简单的字符串生成XML


您可以使用字符串
有效负载绕过JaxB,但这必须是表示
内容的XML。

首先,它不是
4个字符串,而是单个串联字符串:

@Payload("#args[0] + #args[1] + #args[2] + #args[3]")
另一个问题

用于Web服务,即SOAP。因此,XML。 正确的JaxB为您生成XML,但它确实为域实体而不是简单的字符串生成XML

您可以使用字符串
有效负载
绕过JaxB,但这实际上必须是表示
内容的XML