Executing a public SOAP UI operation after importing into API Management Service fails. Disabled CORS. Have tried multiple SOAP api with same result.

Anonymous
2023-01-27T23:04:19.24+00:00

https://<apim-name>.azure-api.net/Calculator
HTTP request
 POST https://<apim-name>.azure-api.net/Calculator HTTP/1.1
Host: <apim-name>.azure-api.net
Content-Type: text/xml
SOAPAction: "http://tempuri.org/Add"

"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\r\n  <Body>\r\n    <Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">\r\n      <intA>1</intA>\r\n      <intB>1</intB>\r\n    </Add>\r\n  </Body>\r\n</Envelope>"
HTTP response
Message
! Trace
Jump to:
Inbound
Backend
Outbound
On error
Response latency: 73.213 ms
Inbound
(0.307 ms)
api-inspector (0.273 ms)
{
    "request": {
        "method": "POST",
        "url": "https://<apim-name>.azure-api.net/Calculator",
        "headers": [
            {
                "name": "sec-ch-ua",
                "value": ""Not?A_Brand";v="8","Chromium";v="108","Google Chrome";v="108""
            },
            {
                "name": "sec-ch-ua-mobile",
                "value": "?0"
            },
            {
                "name": "Ocp-Apim-Subscription-Key",
                "value": "<key>"
            },
            {
                "name": "SOAPAction",
                "value": ""http://tempuri.org/Add""
            },
            {
                "name": "sec-ch-ua-platform",
                "value": ""Windows""
            },
            {
                "name": "Origin",
                "value": "https://apimanagement.hosting.portal.azure.net"
            },
            {
                "name": "Sec-Fetch-Site",
                "value": "cross-site"
            },
            {
                "name": "Sec-Fetch-Mode",
                "value": "cors"
            },
            {
                "name": "Sec-Fetch-Dest",
                "value": "empty"
            },
            {
                "name": "Connection",
                "value": "keep-alive"
            },
            {
                "name": "Content-Length",
                "value": "311"
            },
            {
                "name": "Content-Type",
                "value": "text/xml"
            },
            {
                "name": "Accept",
                "value": "
            },
            {
                "name": "Accept-Encoding",
                "value": "gzip,deflate,br"
            },
            {
                "name": "Accept-Language",
                "value": "en-US,en;q=0.9"
            },
            {
                "name": "Host",
                "value": "apimanagementpocapim.azure-api.net"
            },
            {
                "name": "Referer",
                "value": "https://apimanagement.hosting.portal.azure.net/"
            },
            {
                "name": "User-Agent",
                "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            }
        ]
    }
}
api-inspector (0.004 ms)
{
    "configuration": {
        "api": {
            "from": "/Calculator",
            "to": {
                "scheme": "http",
                "host": "www.dneonline.com",
                "port": 80,
                "path": "/calculator.asmx",
                "queryString": "",
                "query": {},
                "isDefaultPort": true
            },
            "version": null,
            "revision": "1"
        },
        "operation": {
            "method": "POST",
            "uriTemplate": "/?soapAction=http://tempuri.org/Add"
        },
        "user": "-",
        "product": "-"
    }
}
cors (0.030 ms)
"Cross domain request was well formed and was allowed to proceed. CORS related headers were added to the response."
Backend
(72.537 ms)↑ Back to top
forward-request (0.106 ms)
{
    "message": "Request is being forwarded to the backend service. Timeout set to 300 seconds",
    "request": {
        "method": "POST",
        "url": "http://www.dneonline.com/calculator.asmx",
        "headers": [
            {
                "name": "Host",
                "value": "www.dneonline.com"
            },
            {
                "name": "Content-Length",
                "value": 311
            },
            {
                "name": "sec-ch-ua",
                "value": ""Not?A_Brand";v="8","Chromium";v="108","Google Chrome";v="108""
            },
            {
                "name": "sec-ch-ua-mobile",
                "value": "?0"
            },
            {
                "name": "X-Forwarded-For",
                "value": "52.73.40.219"
            },
            {
                "name": "Ocp-Apim-Subscription-Key",
                "value": "<key>"
            },
            {
                "name": "SOAPAction",
                "value": ""http://tempuri.org/Add""
            },
            {
                "name": "sec-ch-ua-platform",
                "value": ""Windows""
            },
            {
                "name": "Origin",
                "value": "https://apimanagement.hosting.portal.azure.net"
            },
            {
                "name": "Sec-Fetch-Site",
                "value": "cross-site"
            },
            {
                "name": "Sec-Fetch-Mode",
                "value": "cors"
            },
            {
                "name": "Sec-Fetch-Dest",
                "value": "empty"
            },
            {
                "name": "Content-Type",
                "value": "text/xml"
            },
            {
                "name": "Accept",
                "value": "
            },
            {
                "name": "Accept-Encoding",
                "value": "gzip,deflate,br"
            },
            {
                "name": "Accept-Language",
                "value": "en-US,en;q=0.9"
            },
            {
                "name": "Referer",
                "value": "https://apimanagement.hosting.portal.azure.net/"
            },
            {
                "name": "User-Agent",
                "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            }
        ]
    }
}
forward-request (72.431 ms)
{
    "response": {
        "status": {
            "code": 400,
            "reason": "Bad Request"
        },
        "headers": [
            {
                "name": "X-Powered-By-Plesk",
                "value": "PleskWin"
            },
            {
                "name": "Content-Length",
                "value": "0"
            },
            {
                "name": "Cache-Control",
                "value": "private"
            },
            {
                "name": "Date",
                "value": "Fri, 27 Jan 2023 22:41:25 GMT"
            },
            {
                "name": "Server",
                "value": "Microsoft-IIS/10.0"
            },
            {
                "name": "X-AspNet-Version",
                "value": "2.0.50727"
            },
            {
                "name": "X-Powered-By",
                "value": "ASP.NET"
            }
        ]
    }
}
Outbound
(0.369 ms)↑ Back to top
cors (0.132 ms)
{
    "message": "Headers starting with 'Access-Control-' were removed from the response. ",
    "headers": [
        {
            "name": "Access-Control-Allow-Credentials",
            "value": "true"
        },
        {
            "name": "Vary",
            "value": "Origin"
        },
        {
            "name": "Access-Control-Expose-Headers",
            "value": "X-Powered-By-Plesk,Content-Length,Date,Server,X-AspNet-Version,X-Powered-By,Vary,Ocp-Apim-Trace-Location"
        }
    ]
}
transfer-response (0.238 ms)
{
    "message": "Response has been sent to the caller in full"
}
Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,447 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2023-01-30T16:56:50.3933333+00:00

    @Joey Cruz Thanks for posting it in Microsoft Q&A. Based on my understanding, you have imported SOAP API ([http://www.dneonline.com/calculator.asmx]) in API Management and faced 400 Bad Request when testing a SOAP Operation Add.

    Sharing trace info does really help but please remove APIM name, Subscription key etc. before posting it in future :) (updated the post)

    I found 400 Bad Request was returned by backend API operation and testing backend API via POSTMAN also resulted the same. Then reviewing backend operation [http://www.dneonline.com/calculator.asmx?op=Add] I got sample request as below and it didn't match default request body (xml) populated:

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <Add xmlns="http://tempuri.org/">
          <intA>int</intA>
          <intB>int</intB>
        </Add>
      </soap:Body>
    </soap:Envelope>
    
    

    So, I changed request body as per specification and it worked both in APIM as well as Postman.

    APIM:

    User's image

    Postman:User's image

    You need to change the request body as per specification (instead of default populated value format) and it should work. Feel free to add a comment if you face any issues or have questions. Would be happy to answer any.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.