WSO2 API Manager 3.2.0 POST header 中的额外文本

Extra text in WSO2 API Manager 3.2.0 POST header

我一直在尝试使用 WSO2 API Manager 3.2.0 为 SOAP Web 服务生成 REST APIs 并成功遍历了这些过程。我启用了消息线跟踪以查看日志中的 requests-responses。我可以看到正在创建格式正确的消息并将其发送到后端服务,但是响应与预期不同。 我注意到一些额外的文本(通常是倒数第二行中的“16e”)在 XML 有效负载之前发送,因此被作为有效负载处理。我怀疑这是我的问题的原因,但我无法追踪它的来源。

TID: [-1] [] [2021-05-12 15:23:55,792] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "POST /services/services.php HTTP/1.1[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,792] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "Origin: https://api-manager.ug.com:9443[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,792] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "SOAPAction: https://testservices.ug.com/services/services.php/GetAccountBalance_2[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,792] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "activityID: 119801787388364143641044[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,792] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "Accept: application/json[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,792] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "Referer: https://api-manager.ug.com:9443/[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "testkey: 76d33583-e7f9-42a3-a4ad-d91118f8b043[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "Accept-Encoding: gzip, deflate, br[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "Accept-Language: en-US,en;q=0.5[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "DNT: 1[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "Content-Type: application/soap+xml[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "Transfer-Encoding: chunked[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "Host: testservices.ug.com[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "Connection: Keep-Alive[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,793] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "16e[\r][\n]"
TID: [-1] [] [2021-05-12 15:23:55,794] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-5 << "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://testservices.ug.com/soap/TransactionServices"><soapenv:Body><web:GetAccountBalance_2><AccountNumber>001221131211</AccountNumber><AuthToken>111111</AuthToken></web:GetAccountBalance_2></soapenv:Body></soapenv:Envelope>[\r][\n]"

当我使用 XML 请求并直接调用后端 SOAP 服务时,我得到了成功的响应。 知道是什么导致了这篇文章,我需要做什么来摆脱它?我们将不胜感激。

我从 https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding#directives

得到了 16e 的来源

chunked

Data is sent in a series of chunks. The Content-Length header is omitted in this case and at the beginning of each chunk you need to add the length of the current chunk in hexadecimal format, followed by '\r\n' and then the chunk itself, followed by another '\r\n'. The terminating chunk is a regular chunk, with the exception that its length is zero. It is followed by the trailer, which consists of a (possibly empty) sequence of entity header fields.

原来是内容类型的问题。我正在发送值“application/soap+xml”,并通过在 xml 配置文件中为 api 添加以下行将其更改为“text/xml”在 /repository/deployment/server/synapse-configs/default/api/

中找到
<property name="ContentType" value="text/xml" scope="axis2" type="STRING"/>

这就是让它工作所需的全部内容。