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.  Access raw request body

    Posted 01/15/19 03:44 AM

    Hello,

    how is it possible to access the raw request body of a flowservice or a javaservice as byte or as stream regardless of the contenttype of the request?

    I am working with webMethods 9.x, my use case is a flow service which acts as a simple, generic reverse proxy.

    For example on a post to a flowservice like the following the pipeline gets populated with the help of the default content-handler with following values:

    POST https://esbentw.ooev.at:8443/invoke/usrFahma.srvreg.v1/proxy?g1=ccc
    content-type: application/json

    {
    “p1”: “aaa”,
    “p2”: "bbb
    }

    → pipeline:

    p1: aaa
    p2: bbb
    g1: ccc

    But as stated i am trying to get the raw data.

    Thank you.

    regards,
    Markus


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


  • 2.  RE: Access raw request body

    Posted 01/15/19 08:06 PM

    We have below approaches to capture the request payload from the flow service or rest flow service.

    1> Use savePipelineToFile or pub.flow:tracePipeline service as the first step in your flow service to capture the pipeline IData (not a good option as per me)

    2> Write a java service to capture the pipeline IData (best solution)


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


  • 3.  RE: Access raw request body

    Posted 01/16/19 03:00 AM

    Thank you Mahesh for your reply.

    That works and gives the payload sent to the service, but not the raw requestdata (for example the body of a HTTP request as bytestream or array).
    To my knowledge the data in the pipeline is already “parsed” with the help of a contenthandler.


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


  • 4.  RE: Access raw request body

    Posted 01/16/19 03:55 AM

    watt.server.http.jsonFormat

    Specifies how Integration Server handles JSON content in HTTP client requests. When
    this property is set to parsed (the default), Integration Server parses JSON content into
    pipeline variables automatically. Clients can then use JSON to compose pipelines and
    execute existing services without having to call pub.json:jsonStreamToDocument.
    If wa?.server.h?p.jsonFormat is set to stream, Integration Server places a jsonStream
    variable containing the JSON content in the pipeline as an InputStream. You can then
    use pub.json:jsonStreamToDocument to parse jsonStream into pipeline variables.
    If watt.server.http.jsonFormat is set to bytes, Integration Server places the incoming
    stream of JSON into a byte array.
    You can override the behavior specified by wa?.server.h?p.jsonFormat in individual
    requests by adding the jsonFormat query parameter to the request URI. For example, if
    watt.server.http.jsonFormat is set to parsed, a client can override this se?ing and instead
    specify a value of stream for the request by entering a URI as follows:
    /invoke/myfolder/myservice?jsonFormat=stream
    This will result in the request being placed in a jsonStream variable in the pipeline as an
    InputStream containing the JSON content.

    Check if this helps, IS extended setting taken from 10-3_Integration_Server_Administrators_Guide.pdf


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


  • 5.  RE: Access raw request body

    Posted 01/16/19 04:58 AM

    Hi,

    already discovered this possibility. It works, but only for content-type JSON and with the concern that clients have to be modified to include the parameter ‘jsonFormat=…’ or the need to change the parameter globally via ‘watt.server.http.jsonFormat’ - and that is a NOGO for us.

    So no real solution for me :frowning:

    In the meanwhile i discovered the possibility of intercepting HTTP Requests globally via watt.server.http.interceptor. There i can access the raw bytes and i think it will be possible to transfer the data into flowservices.

    Thank you.


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


  • 6.  RE: Access raw request body

    Posted 01/16/19 05:06 AM

    That’s good to know.

    Please update the thread if it turns out to be a foolproof solution to the problem.

    Cheers!


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


  • 7.  RE: Access raw request body

    Posted 01/22/19 05:17 AM

    Hello,

    the idea and a naive approach would be to keep the whole request data in Java heap accessible via a static java method. I think it could be possible to access the static content from within a java service - so you could transfer the raw data.

    Problems / Concerns: Memory consumption (you have to ‘cache’ the whole request data), added latency to service calls, …

    I have not implemented this approach but added my ideas just for reference.

    regards,
    Markus


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