英文:
Expose SOAP API using WSDL 1.1 as REST API in WSO2 API Manager 4.1
问题
我尝试将我旧的SOAP后端暴露为WSO2 API Manager中的REST API,但我遇到了这个错误:"错误:响应状态为415"。
如附图所示
在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
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。要解决这个问题,您需要进行以下更改:
- 更改端点格式为SOAP 1.1
此设置位于API配置 -> 端点 -> 单击齿轮图标以打开高级配置界面
- 在转换配置中更改消息类型和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,
- 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
- 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,
<property description="messageProperty" name="messageType" scope="axis2" type="STRING" value="text/xml"/>
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,
<payloadFactory description="transform" media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
...
</payloadFactory>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论