IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  Virtual REST Service with multiple response type

    Posted 11/26/13 07:32 AM

    We have a REST service based on Apache CXF that returns either XML or JSON based on what the consumer wants (indicated in the URL). How can we provide the same behaviour in centrasite ? Here is what i think:

    1. Create a REST service, and define a Resource in it with Content-Type as both JSON and XML
    2. Write two flow services for setting the BUILDER_TYPE context variable to xml and json respectively.
    3. Create two virtual services , one for JSON and one for XML. Specify the respective flow services in the Request Processing Step of these two virtual services.
    4. Consumers should then invoke the correct virtual service based on what response it wants.

    Is this correct ? is there another/better way of doing this, specifically by using a single virtual service ?

    CentraSite v8.2 Fix24.

    Thanks,
    Janardan.


    #CentraSite
    #webMethods
    #API-Management


  • 2.  RE: Virtual REST Service with multiple response type

    Posted 04/10/14 11:30 AM

    If you want to get json or xml response use pub.flow:setResponse at the end of the invoked REST service and set the Content-Type as application/json or application/xml

    Make sure the message string is also of same type


    #webMethods
    #API-Management
    #CentraSite


  • 3.  RE: Virtual REST Service with multiple response type

    Posted 08/14/15 12:02 PM

    If anyone is still reading this, you can handle this on the request end without any changes to the flow. Just pass in an Accept header with values “application/json” or “text/xml” and the same REST service will respond appropriately to either request!


    #CentraSite
    #API-Management
    #webMethods