[英]Quotation marks in Camel Content-Type header
我正在嘗試使用 camel-http4 調用 SOAP 服務。 此服務要求我發送以下 header:Content-Type: application/soap+xml;charset=UTF-8;action="ListBerichten"。 我必須包含引號,否則服務將返回 400 代碼
當我使用 Postman 或 SoapUI 或 curl 之類的客戶端嘗試此操作時,它可以正常工作,但是當我使用 Camel 嘗試時,它無法識別“操作”。
(curl header 看起來像這樣) --header 'Content-Type: application/soap+xml;charset=UTF-8;action="ListBerichten"'
我懷疑它與 ListBerichten 周圍的引號有關,但我不知道它是什么。
我的駱駝路線(我正在為 SSL 配置使用自定義 http4 實現):
from("direct:d.receive.{{name}}.listberichten").routeId("ReceiveListBerichten")
.to("xslt:file:{{xslt.cdm.to.target.listberichten}}?saxon=true")
.setHeader(Exchange.HTTP_METHOD).simple("POST")
.setHeader("Content-Type").simple("{{soap.contentType.listberichten}}")
.to("mTlsHttpComponent://{{request.url}}/{{request.url.path}}?useSystemProperties=true&throwExceptionOnFailure=true").id("Receive3")
;
和我的財產
xslt.cdm.to.target.listberichten=\/data\/resources\/...
soap.contentType.listberichten=application/soap+xml;charset=UTF-8;action="ListBerichten"
request.url=...
request.url.path=...
logging.show.info=showAll=true
我得到的回應是:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Sender</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="nl">Err: Unknown SOAPAction:</soap:Text>
</soap:Reason>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I've tried escaping the quotes with backslashes, replacing the quotes with UTF-8 encoded characters, setting the header as a String literal and setting the 'action' in a separate header but nothing seems to work. Content-Type header中的引號需要怎么處理?
action 參數是 SOAP 版本 1.2 中設置 SOAP Action 的默認方式。 然而,HTTP 組件解析內容類型值。 您可以使用的替代方案:
兩個組件都不解析 header 值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.