How do I convert a SOAP service argument to a REST resource

Not applicable

I have a SOAP interface that exposes among other things a service called getItem with an argument ID. This ID is the identifier for the resource so the correct design for a RESTful GET method is to treat the ID as the RESTful resource in the form of <host>:<port>/interface/item/{ID}. The default REST to SOAP to REST converter does not do this for me, which is not particularly surprising since there is nothing in the SOAP wsdl to suggest that ID is the unique identifier for Item. Any suggestions for how to set up my REST interface?

1 3 179
3 REPLIES 3

Former Community Member
Not applicable

Not sure @Martin Sarabura I understand your question. Are you saying that the wizard "is" doing it or "not doing" it for you? In any case you should be able to add a specific resource to represent your preference from within the proxy editor by adding a specific flow (with or without a verb) for fetching the item resource by id.

Sorry, does not do this.

Are you saying that I can change the mapping so that ...interface/item/{ID} will pre-fill the ID value that would have otherwise been included in the body of the original SOAP service? I just don't see how that is possible using the available controls.

I'm thinking that I need to specify the API I want via swagger and then add a js callout to make the back-end service call. Does this make sense?

> I just don't see how that is possible using the available controls.

Yes, using Apigee Edge you can map URL path elements into fields within an XML (SOAP) document. To do this you would need to add an ExtractVariables policy, and then a subsequent AssignMessage policy.

> I'm thinking that I need to specify the API I want via swagger and then add a JS callout to make the back-end service call. Does this make sense?

You can also do something like this. i would not recommend using the JS callout to actually MAKE the call. Rather, you could use the JS to structure the payload, and then allow Apigee Edge to invoke the target as it usually does. This allows you to use 2-way TLS, and the implicit Edge connection management, and so on.

But AssignMessage is often easier than using JS to produce the SOAP body, especially if there is no looping involved.

here's an example of what I mean: