Modify REST request to call SOAP backend

Not applicable

I created an API that talks to a backend service thinking it is a REST service only to find out after errors in testing is that it is actually a SOAP backend.

How can I modify my current proxy and request to make the call from a REST proxy to a SOAP backend?

My request looks like this:

    <Set>
        <Headers>
            <Header name="Authorization">Bearer {vltoken.vlaccesstoken}</Header>
        </Headers>
        <Payload contentType="text/xml" variablePrefix="@" variableSuffix="#">
            <request>
                <SystemID>@requestPath.SystemID#</SystemID>
                <RequestID>@requestPath.RequestID#</RequestID>
                <Communication>@requestPath.CommunicationCode#</Communication>
                <CommunicationFormat>@requestPath.CommunicationFormat#</CommunicationFormat>
                <CommunicationLanguage>@requestPath.CommunicationLanguage#</CommunicationLanguage>
                <ToList>
                    <Email>
                        <EamilAddress>@requestPath.EmailAddress#</EamilAddress>
                    </Email>
                </ToList>
                <DataList>
                    <String name="message_type" encrypt="0">@requestPath.MessageType#</String>
                    <String name="message_text" encrypt="0">@requestPath.MessageDescription#</String>
                    <String name="phone_number" encrypt="0">@requestPath.PhoneNumber#</String>
                </DataList>
            </request>
        </Payload>
    </Set>
Solved Solved
0 1 812
1 ACCEPTED SOLUTION

In general, the way to accomplish what you want is to use an XSL or AssignMessage to construct a SOAP message, with an envelope, header, and body.



If you want more details, then you need to tell us is the shape of the required SOAP request.

I see the request, and I suppose that is what you have NOW. But that doesn't tell us what you need to get to.

You said the backend was SOAP, but you did not tell us the shape of the message the backend is expecting. This is normally described in a WSDL. In fact, Apigee Edge includes a REST-to-SOAP Wizard that accepts a WSDL and will generate code for you.

But it's not *required* that you have a WSDL. If you have a successful sample message, that works too. We can manually construct an XSL or AssignMessage. In fact I recorded a screencast of this technique some time ago. Find it here.

BTW, a SOAP backend accepts a SOAP request, and sends a reply encoded in SOAP too! So if you want to extract information from the reply, you will need to do the converse of what we are discussing here, in the response flow.

View solution in original post

1 REPLY 1

In general, the way to accomplish what you want is to use an XSL or AssignMessage to construct a SOAP message, with an envelope, header, and body.



If you want more details, then you need to tell us is the shape of the required SOAP request.

I see the request, and I suppose that is what you have NOW. But that doesn't tell us what you need to get to.

You said the backend was SOAP, but you did not tell us the shape of the message the backend is expecting. This is normally described in a WSDL. In fact, Apigee Edge includes a REST-to-SOAP Wizard that accepts a WSDL and will generate code for you.

But it's not *required* that you have a WSDL. If you have a successful sample message, that works too. We can manually construct an XSL or AssignMessage. In fact I recorded a screencast of this technique some time ago. Find it here.

BTW, a SOAP backend accepts a SOAP request, and sends a reply encoded in SOAP too! So if you want to extract information from the reply, you will need to do the converse of what we are discussing here, in the response flow.