0

I have created a REST api service broker in K2 five. One of the api returns an xml string. Is there any way to deserialize it in K2 five and get the tags and the values which I am interested in?

I tried looking for ways in K2 five but could not understand if we need to create a customized smartobject and somehow use it for deserialization. But even then how will it be dynamically generated?

Also, if I have a view containing - let say, name and number. Given an xml schema, can it be serialized into xml string and use in the body of PUT api.

STforever
  • 15
  • 4

1 Answers1

0

If it would be possible to instruct your API to send you JSON from your APIs instead of XML, you might use Deserialize that should be available in definition of your SmartObjects which you created from swagger file for your REST service. If you cannot change response, then you can create a C# utility DLL that performs deserialization from XML and expose that DLL as a Endpoint Assembly using Endpoint service broker.

Dragan Panjkov
  • 4,302
  • 4
  • 28
  • 26
  • Thanks for your response. Why it should be a C# utility DLL? can't we have some custom REST API which can do the serialization or deserialization of XML string, return back a JSON. Then we can create REST service instance and get the corresponding smartobjects in K2 five. – STforever Sep 03 '19 at 00:20
  • Hi, sorry for the delay, I somehow missed your comment. Yes, you can also do that. – Dragan Panjkov Dec 20 '19 at 13:38
  • Hi @Dragan , Thanks for the reply, Created the C# broker DLL to get smartobjects and the serialization/deserialization methods. – STforever Dec 22 '19 at 23:03