How can I serialize a JSON or XML web response?

Topics related to the integration of LSPS with external systems.
Forum rules
Make sure every topic contains information about your LSPS version and if relevant also your server OS, client OS, database name and version, and application server name and version.
cbmeeks
 
Posts: 59
Joined: Wed Aug 07, 2013 11:28 pm

How can I serialize a JSON or XML web response?

Sat Sep 19, 2015 3:36 am

I have an Http task that calls a RESTful web service.

I can return either XML or JSON data (prefer JSON).

But, the response object in LSPS is just a string.

How can I parse it into a Record type?

Thanks

Radovan Cervenka
 
Posts: 48
Joined: Mon Feb 27, 2012 2:47 pm

Re: How can I serialize a JSON or XML web response?

Fri Sep 25, 2015 8:29 am

LSPS has built-in support for XML-based web services. If you have XSD of your response object, just import it to your model (see here how to do it) and the result of a HttpCall task (a string containing XML) parse with parseXml() function to GO_BPMN data types that you can use in your process.

Unfortunately, LSPS does not support JSON out-of-the-box yet. Therefore, to parse JSON objects should implement a custom java function or task type. As you know, there are many 3rd-party JSON parsers in Java and also Java7 EE has javax.json, so this would be no problem if you use LSPS SDK. FYI, we think about adding built-in JSON support to LSPS; hopefully, in near future.

cbmeeks
 
Posts: 59
Joined: Wed Aug 07, 2013 11:28 pm

Re: How can I serialize a JSON or XML web response?

Fri Sep 25, 2015 4:41 pm

I saw the XML support but the docs mentioned they are deprecated. So I didn't want to implement a solution using them.

JSON support is, in my opinion, crucial for any modern web application. Do you have a time frame on that update?

I'd prefer to not use the SDK because I'm trying to keep as much of our application in Expression Language as possible.

Thanks

Radovan Cervenka
 
Posts: 48
Joined: Mon Feb 27, 2012 2:47 pm

Re: How can I serialize a JSON or XML web response?

Mon Sep 28, 2015 10:00 am

XML support is not deprecated (!); maybe only ParseXml and ConvertToXml task types, because LSPS provides corresponding functions that can be used in a more flexible way. In past, we wanted to rework the whole XML and WS support but this never came to the product.

We plan to have feasibility study + analysis of JSON support ready by the end of this year and implement first bunch of features in a version coming in 1st quarter of 2016.

For now, I suggest to use out-of-the-box XML. But also implementation of own custom function(s) for parsing JSON objects is not a big deal. The both options have already been used in customer projects.

Return to Integration

Who is online

Users browsing this forum: No registered users and 1 guest