Consuming REST services with XML
2515
Views
19
Comments
Not right now
Data & Integrations

The new platform version already brings the new functionality which allows us consuming Web services using REST. However the only document format allowed is JSON. We know that there are some webservices whose document format is XML. It would be cool if we could use XML in the RESTful webservices.

2016-04-21 20-09-55
J.
 
MVP
REST+XML is imho the worst combination of the flavours...

Not sure if I agree it should be supported
I would like to add that not consuming, but exposing REST services with XML is a missing feature.

It is possible to change the format of whatever you are sending in the platform, but you are limited when receiving data from external parties.

For instance: We are trying to read the contents of a device (IoT), but the device is limited in functionality and only sends out data using POST+XML.

As stated in the manual of Outsystems, the record and list data types can only be filled by JSON.
https://www.outsystems.com/help/servicestudio/9.0/default.htm#Integrating_with_other_systems/Web_Services/Supported_Media_Types_in_REST_API_Requests.htm

We now have to create an external application where the device is sending it's data and then convert the XML to JSON before we can read it into Outsystems using the REST service.
2016-04-21 20-09-55
J.
 
MVP
@Remco I am not sure what your issue is and why you need to fall back to an external application.

You can still read a raw request in a page (with httpRequesthandler extension)
so you can do stuff there.

It's basically the old way of exposiing/consuming REST-webservices :)

@Remco: Apart from what Joost said, I think you are confusing the meanngs of consuming and exposing. This idea seems to be about exactly your type of scenario.
@Joost, thank you for your suggestion, I'll try to get this working today. I'll let you know if it works.
@Kilian, I gave you an reaction in the other discussion

I needed to support a similar XML Post for a project I was working on, I had asked J. to detail the whole flow, he shared this:

Use the httpRequesthandler extension to handle the incoming request, in the preparation on a new webpage.

When done parsing the xml, your flow will end up not with a end-node, but a download-node. In the download you place the xml (as binary) and you are good to go.

So, in the preparation:

1. parse the incoming xml

2. build response-xml

3. texttobinary(response-xml)

4. download binary as tetx/xml, save to disk: 'no' 


I am adding it here for others to discover if they need this helpful workaround.

Thanks, J.!

Merged this idea with 'Exposing REST services with XML' (created on 26 Aug 2015 12:08:11 by Remco Dekkinga)
We are trying to read the contents of a device (IoT), but the device is limited in functionality and only sends out data using POST+XML.
 
As stated in the manual of Outsystems, the record and list data types can only be filled by JSON.
 
We now have to create an external application where the device is sending it's data and then convert the XML to JSON before we can read it into Outsystems using the REST service.
 
It would be better if the REST services accept both JSON and XML.

This idea is similar to the following idea, except this one is about Exposing instead of Consuming REST services 
 



This comment was:
- originally posted on idea 'Exposing REST services with XML' (idea created on 26 Aug 2015 12:08:11 by Remco Dekkinga)
- merged to idea Consuming REST services with XML on 30 Jul 2018 14:22:54 by Hugo Gonçalves
Hi Remco,

Are you sure you don't have your definitions of exposing and consuming the wrong way around? Exposing XML by rest = OutSystems application allows other systems to retrieve via REST some XML, consuming XML by rest = some other system allows OutSystems applications to access it via REST and retrieve some XML.

If you have an IoT device that expostes a REST service which provides XML, you are (well, your OutSystems app is) consuming the device's REST and XML. So it seems idea 1751 referenced by you above is exactly what you need!


This comment was:
- originally posted on idea 'Exposing REST services with XML' (idea created on 26 Aug 2015 12:08:11 by Remco Dekkinga)
- merged to idea Consuming REST services with XML on 30 Jul 2018 14:22:54 by Hugo Gonçalves
Hi Kilian, The IoT device can only do a POST to an URL with the XML attached.  
In order to receive the POST, I set up an Exposing REST webservice which is then called by the IoT device using the POST message.

I have this working for incoming JSON messages.

What I will do, I will follow up on the suggestion of Joost and try to use the HttpRequestHandler to get it also working for XML.




This comment was:
- originally posted on idea 'Exposing REST services with XML' (idea created on 26 Aug 2015 12:08:11 by Remco Dekkinga)
- merged to idea Consuming REST services with XML on 30 Jul 2018 14:22:54 by Hugo Gonçalves
Right, I see your usecase now. I thought you were trying to call a method on the device, but the device is actually sending you an XML.

This comment was:
- originally posted on idea 'Exposing REST services with XML' (idea created on 26 Aug 2015 12:08:11 by Remco Dekkinga)
- merged to idea Consuming REST services with XML on 30 Jul 2018 14:22:54 by Hugo Gonçalves
Changed the status to
Not right now

Hi,

Sorry for the late reply, but we are not planning on delivering this in the near future.
 
The investment to do this properly is too big for the return and for the upcoming new features that we have in mind, and there's also a workaround described here. Because of this, I’m marking this idea as “not right now”.
 
Nonetheless, thank you very much for your idea and keep it coming.
If you believe we missed some context that would change our perception about it, please give us more details about why you would need this and for what is the use case.

 Thanks!

As for a workaround, there's various ways not described above I think. For one, On Request, that converts the XML to JSON. Secondly, have a single Text parameter that receives all of the contents, then parse it afterwards.

Merged this idea with 'OutSystems REST capability supports JSON only - need to improve this.' (created on 06 Jul 2023 09:37:02 by 亗『ARAVIND』亗)

Currently OutSystems REST capability supports JSON only.

Can we also have the support t send requests as form data, XML etc., like postman?

Okay @Jeroen Bindels , Thanks for your reply.

Changed the category to
Data & Integrations
and the status to
Out of scope

As already stated in the discussion, this is already possible. 

JOSN is the simplest format for data on transit, why would someone like to make it complex.

16
Like