Search code examples
ibm-mobilefirstworklight-adapters

Convert json to xml in worklight adapter


I have a very strange requirement in which I need to convert JSON to XML in worklight server's adapter procedure and then need to send that xml to some other systems.

I am using HTTP worklight adapter.

Is it possible to overcome this requirement in worklight adapter?


Solution

  • Finally i got the answer after googling a lot.

    Worklight has flexibility to use java code.

    I had already java code ready which serves the purpose(convert json to xml) so i just imported that class in my worklight project(copy in apps/server/ folder).

    In adapter i have used that class like var xml = com.XXXX.json2xml(input);

    Deploy adapter and worklight application war file and you are ready to go.