How to get raw XML response from SOAP service?
Application Type
Reactive, Service
Service Studio Version
11.50.13 (Build 49459)

We would like to process the xml response directly from SOAP service. Of course platform processes the XML response and creates output structures. However the response output structures that are automatically created by platform is not suitable for our use case. (so i cant convert the response output recordlist to xml using XmlRecords forge component)

So, all I want to get access to raw XML response from consumed SOAP service. Once I get the raw XML I will have to perform XML operations on top of raw XML according to our needs.

Is it possible to access the raw XML response from consumed SOAP service? If yes, how? Please help

mvp_badge
MVP

Hi Arunkumar,


I never tried to do this but I have read in several places that SOAP Extensability API forge component is the way to manipulate SOAP services. Have you taken a look to this component?

You also may want to take a look at this document on how to use the API and on the unsupported SOAP use cases and possible workarounds.


Hope it helps.


Kind Regards,
João

Thanks for the response. I have explored the links its quite useful but not for my use case.

mvp_badge
MVP

I do agree with the reply from João, SOAP Extensability API is what you need to inspect and manipulate the response.

Why does it not help you?

There is a forge component that already abstracts the API

https://www.outsystems.com/forge/component-overview/5322/soap-extensibility 

As well as a demo app

https://www.outsystems.com/forge/component-overview/10043/soap-response-update-sample



mvp_badge
MVP

Hi Arunkumar,

Unfortunately, it is not easily possible to manipulate the raw XML like you can manipulate the raw JSON of a REST service, and it is as far as I know completely impossible to consume a SOAP service and change the output structures that are based on the WSDL of the service.

Can you explain why "the response output structures that are automatically created by platform [are] not suitable"? Because they should reflect exactly the underlying XML structure.

The only alternative I can think of is consume the SOAP in an Extension, so you can manipulate it to your liking.

Yes, you are right. it actually aligns with what I also found.

Can you explain why "the response output structures that are automatically created by platform [are] not suitable"? 

I am dealing with very huge XML response which are converted into output structures. I will have to search some specific attributes within output structure. At the moment we are looping thru the output structure and matching the attributes. In next phase the XML is going to be even more huge, we are already forseeing performance issue while we loop thru and match the attribute.

I feel like if I have the XML response I can use native XML functions to locate the attribute node and match. Thats the reason I am looking for raw XML.

I have tried to parse the output structure into XML using RecordListToXML function (XMLRecords forge component), however I am having a problem in parsed XML. The output structure which is a record list contains lot of inner record lists. The inner record lists are not getting parsed correctly. please refer the figure

The inner recordlist (value list) is not parsed correctly.


mvp_badge
MVP

If you have any problems with XMLRecords, you should ask questions in the component's subforum. My experience is that you'll get an answer quickly. That said, if the SOAP service you consume has long lists of name/value pairs, you are probably better off consuming it in an extension, and put it in an in-memory database or the like.

Hi Arunkumar,
Not sure if this can help with your issue, but have you tried to use the JSONSerialize and then manipulate it?
Do you have another example with the structure and one with the values of the request?

mvp_badge
MVP

How can JSONSerialize help to manipulate an XML response?

Hi Daniël,
Then using the component Data Conversion [for XML, JSON etc] could be a solution.
But more examples are helpful to understand the parsing issue.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.