webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  REST Api Json Message format

    Posted Fri February 17, 2012 04:19 PM

    Friends,

    I have a requirement to convert a Json String to an Xml. Has anyone done this, or is there any built-in svc that could help.

    The interface flow is to call an external rest API, get the reponse and update the DB tables. They only support Json responses but not xml, so i have to find a way to convert the response to xml and then map the fields.

    Thanks everyone for your time.

    S.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: REST Api Json Message format

    Posted Mon February 20, 2012 07:54 AM

    webMethods 8.2 release notes - from the mediator section!!!
    "Support for JSON Content

    Mediator can send and receive JSON content over REST or XML virtual services. Mediator can handle content mediation between JSON and XML. For example, a service consumer can send JSON content to a REST virtual service in Mediator. The virtual service can automatically convert the JSON content to XML and then forward the XML content to the native service and vice-versa."


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: REST Api Json Message format

    Posted Tue February 21, 2012 03:56 PM

    Thank you. Never really worked with Mediator, I will check on this.

    Thanks,
    S


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 4.  RE: REST Api Json Message format

    Posted Tue February 21, 2012 05:32 PM

    It means there is an additional license fee you will have to shell out for Mediator. If that is a limitation you might want to check out the JSON in Java resources and convert the JSON object to XML using a Java service. Use this service as a Framework on IS for converting JSON to XML.

    [URL]http://www.json.org/java/[/URL]
    [URL]http://www.json.org/javadoc/org/json/XML.html[/URL]

    Cheers,
    Akshith


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 5.  RE: REST Api Json Message format

    Posted Tue February 21, 2012 06:03 PM

    I kinda figured that. I think the best is to build a java svc. Thanks for the links, appreciate it.

    S.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 6.  RE: REST Api Json Message format

    Posted Fri April 17, 2015 07:35 PM

    Hi Smathangi,

    Can you please shed some light on how you invoked the REST API from webMethods designer. I have a similar requirement but hasn’t worked on how to invoke a REST API.

    What services we need to use to call a REST service and we want to get it in the form of application/json.

    Thanks,
    Kumar.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 7.  RE: REST Api Json Message format

    Posted Fri April 17, 2015 08:13 PM

    Hi Smathangi,

    Can you please shed some light on how you invoked the REST API from webMethods designer. I have a similar requirement but hasn’t worked on how to invoke a REST API.

    What services we need to use to call a REST service and we want to get it in the form of application/json.

    Thanks,
    Kumar.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 8.  RE: REST Api Json Message format

    Posted Tue June 09, 2015 01:05 PM

    Hello Smathangi,

    I have given a try with sample JSON message to convert to XML format by making use of built in services. Hope it helps

    pub.json:jsonStringToDocument
    pub.xml:documentToXMLString

    JSON String:

    {“employees”:[
    {“firstName”:“John”, “lastName”:“Doe”},
    {“firstName”:“Anna”, “lastName”:“Smith”},
    {“firstName”:“Peter”,“lastName”:“Jones”}
    ]}

    XML Output:

    <?xml version="1.0"?> John Doe Anna Smith Peter Jones

    JSONstringtoXMLConversion.png


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB