Search code examples
soapwso2wso2-api-manager

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


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

Screenshot of error

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]"

Solution

  • 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

    enter image description here

    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,

    <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>