简体   繁体   English

调用soap服务时如何在骆驼交换对象中添加HTTP请求标头?

[英]How to add HTTP request header in camel exchange object while calling soap service?

At soap service side below is the code 在肥皂服务部下面是代码

Map http_headers = (Map) mctx.get(MessageContext.HTTP_REQUEST_HEADERS);
List userList = (List) http_headers.get("Username");
List passList = (List) http_headers.get("Password");

During exchange the code I have added at the client using apache camel 交换期间,我使用apache camel在客户端添加的代码

Exchange exchangeRequest = lProducerTemplate.request(endpoint,
        new Processor() {
            public void process(Exchange exchange) throws Exception {

                exchange.getIn().setBody(payload);
                exchange.getIn().setHeader(Exchange.HTTP_QUERY, headers);
}});

When I tried to see packet using wireshark I see that nothing gets added to the header(both soap or http) 当我尝试使用Wireshark查看数据包时,我发现没有任何内容添加到标头(soap或http)

在此处输入图片说明

It appears you are trying to set a map to a single header. 似乎您正在尝试将地图设置为单个标头。 I think you may be looking for 我想您可能正在寻找

Exchange exchangeRequest = lProducerTemplate.request(endpoint,
    new Processor() {
        public void process(Exchange exchange) throws Exception {

            exchange.getIn().setBody(payload);
            exchange.getIn().setHeaders(headers);
}});

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

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