首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在中设置SOAP信封头与int:入站网关中的数据?

如何在中设置SOAP信封头与int:入站网关中的数据?
EN

Stack Overflow用户
提问于 2018-10-29 09:16:29
回答 1查看 578关注 0票数 0

我尝试构建一个简单的spring集成项目,在这里我获得一个REST请求并将其转换为SOAP请求。类似于:

代码语言:javascript
复制
<int-http:inbound-gateway id="rest-inbound-gateway" request-channel="restRequestChannel"
    reply-channel="restOutputChannel" supported-methods="POST"
    path="/somepath" request-payload-type="com.something.RequestObject">
        <int-http:request-mapping consumes="application/json" produces="application/json" />
</int-http:inbound-gateway>

<int:transformer ref="RestToSoapTransformer" method="transform"
                 input-channel="restRequestChannel" output-channel="transformedChannel"/>

<int-ws:outbound-gateway id="marshallingGateway"
    request-channel="transformedChannel" reply-channel="restOutputChannel"
    uri="http://localhost:8088/mockSoapBinding" marshaller="marshaller"
    message-sender="messageSender"
    unmarshaller="marshaller" >
</int-ws:outbound-gateway>

但是在REST请求中的一些信息需要放入SAOP信封头,而不是信封主体。例如:

休息请求:

代码语言:javascript
复制
{
    "foo": "foo",
    "bar": "bar"
}

而SOAP请求应该是:

代码语言:javascript
复制
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header>
        <foo>foo</foo>
    </soapenv:Header>
    <soapenv:Body>
         <bar>bar</bar>
    </soapenv:Body>
</soapenv:Envelope>

我怎么能这么做?转换器只创建soap主体,而在拦截器或标头映射程序中,我不再有原始请求。有什么办法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-29 13:41:54

文献资料

WS消息头 Spring网关将自动映射SOAP头。默认情况下,将使用MessageHeaders将其复制到Spring和从Spring复制。 当然,您可以传递自己的SOAP特定头映射器的实现,因为网关有各自的属性来支持该实现。 除非由requestHeaderNames和/或replyHeaderNames属性显式指定,否则任何用户定义的SOAP标头都不会复制到SOAP消息或从SOAP消息中复制。 ..。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53042199

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档