Expose REST WS as a SOAP.

Not applicable

Good day !!!

I know this may be redundant question but i found it difficult to find a solution on our case study.
We are looking to expose our REST Service via APIGEE to a SOAP Front end.

All the post we have seen talk more on exposing SOAP service as a REST.

Any help or solutions on this ?

Thank you,

Piyush.

0 9 2,450
9 REPLIES 9

@Piyush Singh , Welcome to Apigee Community ,

Though it's an Anti Pattern, You can absolutely do that using Assign Message Policy to convert REST to SOAP.

See an example of SOAP to REST conversion. It's exactly same by flipping conversion in request , response. Use similar policies to change the payload from SOAP to REST in request & REST to SOAP in response.

It's absolutely possible & all it take is few minutes to implement same. Post a sample REST API & SOAP format you are expecting if you need a working example.

-------------------------------

Anil Sagar

5997-screen-shot-2017-11-23-at-75916-pm.png Learn Apigee Concepts in 4 Minutes HandsOn

Hello @Anil Sagar @ Google,

Thank you for warm welcome.

For now we are using Reverse Proxy and invoking a public REST API at below URL :-

https://jsonplaceholder.typicode.com/todos/1

And doing HTTP GET to retrieve the result.

REST Result :-

{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
}

SOAP Conversion needed :-

<?xml version="1.0" encoding="UTF-8"?>
<root>
<completed>false</completed>
<id>1</id>
<title>delectus aut autem</title>
<userId>1</userId>
</root>

Please correct me if we need to take any other approach for this in APIGEE.

Any thoughts ?

Piyush, are you sure you need SOAP?

You showed "SOAP conversion needed" but I don't see SOAP there.

That looks like plain-old-xML to me.

That is even simpler to do with Apigee Edge of course. With the XMLToJSON and JSONToXML policies.

If you can be clearer about the requirements, we may be able to help you further.

@Dino-at-Google

Sorry my bad i just converted REST to SOAP and pasted, so we wanted to try something as below to be sent via APIGEE :-

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <Root xmlns="http://test.co.Soap_To_Rest">
      <completed>false</completed>
      <id>1</id>
      <title>delectus aut autem</title>
      <userId>1</userId>
    </Root>
  </soap:Body>
</soap:Envelope>

OK. To accomplish your goal, you need to:

  • In the request flow:
    • Use ExtractVariables with XPath to validate the inbound request, and extract the relevant parameters
    • Use AssignMessage and/or JavaScript to construct a correct GET request to the REST/JSON backend
  • in the response flow:
    • use ExtractVariables with JSONPath to extract data out of the successful response
    • use AssignMessage to build a SOAP message with the extracted data.

Here's an example of a working proxy to illustrate the point.

soaptodo.zip

@Dino-at-Google

Sorry but we are unable to import the bundle with empty bundle error.

Will try with the steps mentioned and try to replicate what you have tried for a small POC.

FYI: The bundle is the apiproxy-bundle.zip within the zip. You need to import THAT.

After importing, I am unable to see the steps, I am seeing below error.

Any thoughts? @Dino-at-Google

9058-capture1.jpg

Though it's an Anti Pattern,

Anil, I think it's the reverse of the common pattern, but not an anti-pattern. The reason is: people want to modernize the backend systems, and sometimes the clients** aren't ready to move forward. With Apigee Edge the API Proxy can act as the facade to present a SOAP interface to a legacy client.

** It may not be the app itself that is hard to change; it may be the app developers who know the soap-oriented tools and are not familiar or not willing or able to move to REST oriented APIs.

I think of it not as a "bad idea" but an uncommon idea, or a less common idea.