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.

 View Only
Expand all | Collapse all

How to extract header information from request header

  • 1.  How to extract header information from request header

    Posted Tue December 18, 2018 03:51 AM

    Hi folks, do you know how to extract header request information and print it out in server log?

    I am using REST web service

    Regards,
    Ronnie She


    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: How to extract header information from request header

    Posted Tue December 18, 2018 05:09 AM

    Did you try using getTransportInfo service in WmPublic?


    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: How to extract header information from request header

    Posted Tue December 18, 2018 06:14 AM

    Hi Ronnie,

    If your question is -

    1. To print request headers from REST client itself i.e., you have a REST web service and while you do request call to that web service you want to print what is in request.

    Then it is very easier after you set headers in pub.client:http, just call tracePipeline or debugLog services as in screenshot to get headers printed on server log.

    1. To print request headers from REST server itself i.e., how within REST web service when a client calls it passing some headers, those header values can be used within (or passed to) mapped service.

    Then I’m also not pretty sure how to get them. When I experimented, any attribute passed as part of request URL (for ex: URL?attribute1=value1), is visible (when I used Tracepipeline as a first step in mapped service being called within Resource config of REST resource), but headers are not visible in server log.

    Chandra


    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: How to extract header information from request header

    Posted Tue December 18, 2018 06:24 AM

    Yes pub.flow:getTransportInfo service is giving all the headers like below, when tracePipeline is called just after it.

    [21888]2018-12-18 15:49:49 IST [ISP.0090.0002C] — END tracePipeline —
    [21887]2018-12-18 15:49:49 IST [ISP.0090.0008C] 3 remotePort {java.lang.String} = ‘49306’
    [21886]2018-12-18 15:49:49 IST [ISP.0090.0008C] 3 remoteIp {java.lang.String} = ‘10.60.14.146’
    [21885]2018-12-18 15:49:49 IST [ISP.0090.0008C] 3 localPort {java.lang.String} = ‘5555’
    [21884]2018-12-18 15:49:49 IST [ISP.0090.0008C] 3 localIp {java.lang.String} = ‘10.60.14.146’
    [21883]2018-12-18 15:49:49 IST [ISP.0090.0008C] 2 ipInfo {com.wm.util.Values} =>
    [21882]2018-12-18 15:49:49 IST [ISP.0090.0008C] 3 header1 {java.lang.String} = ‘1’
    [21881]2018-12-18 15:49:49 IST [ISP.0090.0008C] 3 Authorization {java.lang.String} = ‘Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U=’
    [21880]2018-12-18 15:49:49 IST [ISP.0090.0008C] 3 Host {java.lang.String} = ‘MCCHM02.eur.ad.sag:5555’
    [21879]2018-12-18 15:49:49 IST [ISP.0090.0008C] 3 Accept {java.lang.String} = ‘application/json’
    [21878]2018-12-18 15:49:49 IST [ISP.0090.0008C] 3 User-Agent {java.lang.String} = ‘Mozilla/4.0 [en] (WinNT; I)’
    [21877]2018-12-18 15:49:49 IST [ISP.0090.0008C] 2 requestHdrs {com.wm.util.Values} =>

    [21876]2018-12-18 15:49:49 IST [ISP.0090.0008C] 2 method {java.lang.String} = ‘GET’
    [21875]2018-12-18 15:49:49 IST [ISP.0090.0008C] 2 query {java.lang.String} = ‘keyattr=2’
    [21874]2018-12-18 15:49:49 IST [ISP.0090.0008C] 2 requestUrl {java.lang.String} = ‘/restv2/filepolling:new_rest1/processingservice?keyattr=2’
    [21873]2018-12-18 15:49:49 IST [ISP.0090.0008C] 1 http {com.wm.util.Values} =>
    [21872]2018-12-18 15:49:49 IST [ISP.0090.0008C] 1 subprotocol {java.lang.String} = ‘HTTP’
    [21871]2018-12-18 15:49:49 IST [ISP.0090.0008C] 1 protocol {java.lang.String} = ‘http’
    [21870]2018-12-18 15:49:49 IST [ISP.0090.0008C] 0 transport {com.wm.util.Values} =>
    [21869]2018-12-18 15:49:49 IST [ISP.0090.0008C] 0 $httpMethod {java.lang.String} = ‘GET’
    [21868]2018-12-18 15:49:49 IST [ISP.0090.0008C] 0 keyattr {java.lang.String} = ‘2’
    [21867]2018-12-18 15:49:49 IST [ISP.0090.0008C] 0 message {java.lang.String} = ‘ProcessingServiceStarted’
    [21866]2018-12-18 15:49:49 IST [ISP.0090.0001C] — START tracePipeline [12/18/18 3:49 PM] —


    #Integration-Server-and-ESB
    #webMethods