How to retrieve JSON object from xml text?

Home Forums Convertigo Products How to retrieve JSON object from xml text?

This topic contains 3 replies, has 2 voices, and was last updated by  jelamrani@warren-walter.com 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #243750

    Hello,

    I define an http connector which represents an url that allows me to get an access token, When I execute this transaction, I get the xml described below.

    What is the good way to retrieve the JSON object from that XML by using a convertigo object?

    I am trying to do that by using transaction and sequence, but without success.

    Any ideas please?

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <document connector=”HTTP_connector_get_access_token” context=”studio_Maprospection:C:HTTP_connector_get_access_token” contextId=”studio_Maprospection:C:HTTP_connector_get_access_token” fromStub=”false” fromcache=”false” generated=”Tue Sep 11 15:43:34 CEST 2018″ project=”Maprospection” sequence=”” signature=”1536673414027″ transaction=”Default_transaction” version=”7.5.1 (build 44623)”>{“access_token”:”ZDI0MWRjYWI0ZjAxYjU3ZTVjY2UwNTE2YmYyODRkYWJlZmNlZTk0YmZiMWMzNjcwYTRiNWM0N2EyMTk3MDcxYQ”,”expires_in”:3600,”token_type”:”bearer”,”scope”:”read”}</document>
    <!–
    Generated by Convertigo Enterprise Mobility Server
    Requester: InternalRequester
    –>

    #243779

    Hello,

    My question here is about how to call sequence result by using convertigo objects?

    The resulting object is the above xml text. I want to retrieve the JSON text from it {“access_token”:”ZDI0MWRjYWI0ZjAxYjU3ZTVjY2UwNTE2YmYyODRkYWJlZmNlZTk0YmZiMWMzNjcwYTRiNWM0N2EyMTk3MDcxYQ”,”expires_in”:3600,”token_type”:”bearer”,”scope”:”read”}.

    I am trying to define an xml element by defining its source picker like that: //document/transaction/document//object/access_token/text() but the result is empty value after executing the corresponding sequence.

    WHat can I do please to get the correct value from JSON located in xml text?

    Regards,

    Jalal.

    #243780

    Nicolas Albert
    Keymaster

    Sorry not answering before.
    Can you try to call your JSON service using a JSON Transaction instead of a standard HTTP Transaction ?

    #243781

    Hello,

    THank you for your quick reply.

    Good luck.

    Jalal.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.