如何在调用 soap 服务时在 camel exchange object 中添加 HTTP 请求 header?
How to add HTTP request header in camel exchange object while calling soap service?
下面是肥皂服务端的代码
Map http_headers = (Map) mctx.get(MessageContext.HTTP_REQUEST_HEADERS);
List userList = (List) http_headers.get("Username");
List passList = (List) http_headers.get("Password");
在交换期间,我使用 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);
}});
当我尝试使用 wireshark 查看数据包时,我发现没有任何内容添加到 header(soap 或 http)
您似乎正在尝试将地图设置为单个 header。我想你可能正在寻找
Exchange exchangeRequest = lProducerTemplate.request(endpoint,
new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody(payload);
exchange.getIn().setHeaders(headers);
}});
下面是肥皂服务端的代码
Map http_headers = (Map) mctx.get(MessageContext.HTTP_REQUEST_HEADERS);
List userList = (List) http_headers.get("Username");
List passList = (List) http_headers.get("Password");
在交换期间,我使用 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);
}});
当我尝试使用 wireshark 查看数据包时,我发现没有任何内容添加到 header(soap 或 http)
您似乎正在尝试将地图设置为单个 header。我想你可能正在寻找
Exchange exchangeRequest = lProducerTemplate.request(endpoint,
new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody(payload);
exchange.getIn().setHeaders(headers);
}});