2
votes

We have an existing set of REST APIs (.NET Core). We have a requirement to expose these APIs as SOAP services, hopefully by using the Azure API Management. Is this possible?

I have seen plenty of posts about exposing SOAP services as REST API, but not the other way around.

1

1 Answers

0
votes

When you SOAP API as REST in APIM all it does is creates a bunch of policies for operations to process request/response payload on the fly and convert JSON to XML. Even though there is no wizard to create transformations for reverse - that is surely possible.

You will have to write your own transformation logic using APIM policies. Here are a few things you will need:

public enum SoapVersionLiteral
{
    Soap11,
    Soap12
}

public interface ISoapMessage
{
    SoapVersionLiteral Version { get; set; }

    string Action { get; set; }

    IEnumerable<ISoapHeader> Headers { get; set; }

    ISoapBody Body { get; set; }
}

public interface ISoapHeader
{
    XName Name { get;  }
    string Value { get; }
    Uri Actor { get;  }
    bool MustUnderstand { get; }
}

public interface ISoapBody
{
    XName Name { get; }
    XElement Contents { get; }
}
  • You could try to find some WSDLs in the wild and import them as SOAP to REST in APIM to see what kind of policies are created to transform XML to JSON for responses and JSON to XML for requests.