使用 WSO2 API Manager 4.1 将 WSDL 1.1 作为 REST API 暴露为 SOAP API。

huangapple go评论81阅读模式
英文:

Expose SOAP API using WSDL 1.1 as REST API in WSO2 API Manager 4.1

问题

我尝试将我旧的SOAP后端暴露为WSO2 API Manager中的REST API,但我遇到了这个错误:"错误:响应状态为415"。

如附图所示

使用 WSO2 API Manager 4.1 将 WSDL 1.1 作为 REST API 暴露为 SOAP API。

在carbon日志中找到的日志。

英文:

I Try to expose my old SOAP Backend which use WSDL version 1.1 as a REST API in WSO2 API Manager but i got this error "Error: response status is 415".

As shown in the attached photo below

使用 WSO2 API Manager 4.1 将 WSDL 1.1 作为 REST API 暴露为 SOAP API。

Logs found in carbon logs .

TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "POST /Amplitude-WS/public?wsdl HTTP/1.1[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Origin: https://uib-as522.uib.socgen:9443[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "SOAPAction: [\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Referer: https://uib-as522.uib.socgen:9443/[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Sec-Fetch-Dest: empty[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Sec-Fetch-Site: same-site[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Accept-Encoding: gzip, deflate, br[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "accept: application/json[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Sec-Fetch-Mode: cors[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "activityid: 083f1db3-599f-4c90-942c-31d1ed180b58[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "sec-ch-ua: "Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "sec-ch-ua-mobile: ?0[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "sec-ch-ua-platform: "Windows"[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Content-Type: application/soap+xml[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Transfer-Encoding: chunked[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Host: uib-as150.uib.socgen:9443[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "Connection: Keep-Alive[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "1ce[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://services.omnichannel.ws.uib.tn.com/"><soapenv:Body><web:BranchList><BranchListRequest><MessageHeader><RequestChannel>string</RequestChannel><InitialRequestId>string</InitialRequestId><RequestTime>string</RequestTime><RequestId>string</RequestId></MessageHeader></BranchListRequest></web:BranchList></soapenv:Body></soapenv:Envelope>[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "0[\r][\n]"
TID: [-1234] [] [2023-04-05 13:00:35,962] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Sender I/O dispatcher-1 << "[\r][\n]"

答案1

得分: 0

根据您的问题,看起来您的后端是SOAP 1.1。但是APIM生成的SOAP请求是SOAP 1.2。要解决这个问题,您需要进行以下更改:

  1. 更改端点格式为SOAP 1.1

此设置位于API配置 -> 端点 -> 单击齿轮图标以打开高级配置界面

  1. 在转换配置中更改消息类型和SOAP信封

此设置位于API配置 -> 资源 -> 展开一个资源并可以看到它的末尾。

将消息类型属性从 application/soap+xml 更改为 text/xml,如下所示:

<property description="messageProperty" name="messageType" scope="axis2" type="STRING" value="text/xml"/>

在PayloadFactory中将SOAP命名空间从 https://www.w3.org/2003/05/soap-envelope 更改为 https://schemas.xmlsoap.org/soap/envelope/,如下所示:

<payloadFactory description="transform" media-type="xml">
  <format>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
      ...
</payloadFactory>
英文:

According to your question, it looks like your backend is SOAP 1.1. But the SOAP request generated by APIM is SOAP 1.2. To fix this you will need to make the following changes,

  1. Change the endpoint format to SOAP 1.1

This setting can be found at API Configurations -> Endpoints -> Click on the gear icon to open the Advanced Configurations UI

使用 WSO2 API Manager 4.1 将 WSDL 1.1 作为 REST API 暴露为 SOAP API。

  1. Change the messageType and SOAP envelope in Transformation Configurations

This setting can be found at API Configurations -> Resources -> Expand a resource and can see this to the end of it.

Change the messageType property from application/soap+xml to text/xml as follows,

&lt;property description=&quot;messageProperty&quot; name=&quot;messageType&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot; value=&quot;text/xml&quot;/&gt;

Change the SOAP Namespace from https://www.w3.org/2003/05/soap-envelope to https://schemas.xmlsoap.org/soap/envelope/ in the PayloadFactory as follows,

&lt;payloadFactory description=&quot;transform&quot; media-type=&quot;xml&quot;&gt;
  &lt;format&gt;
    &lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
    &lt;soapenv:Header/&gt;
    &lt;soapenv:Body&gt;
      ...
&lt;/payloadFactory&gt;

huangapple
  • 本文由 发表于 2023年4月6日 20:36:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75949599.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定