Obtaining Access to HTTP Headers using Process Developer

Version 2

    Process Designer supports reading headers from the request using "Request Context" set of functions. These can be accessed in Formula Editor. Please review https://network.informatica.com/docs/DOC-17882 for more details.

     

    In this document, we have provided a sample built using Process Developer that extracts header information and forwards it (i.e. acts as a proxy) to an IPD-based* process. The IPD process would take the input as "Whole Payload".

     

    *IPD, stands for Informatica Process Definition, what Process Designer generates. Process Developer generates BPEL 2.0 definitions.

     

    Here's a sample for invoking a BPEL proxy service at an anonymous endpoint at https://bs1e1.rt.informaticacloud.com/active-bpel/public/services/REST/000063/authenticate. This proxy then extracts the header and payload and performs an invoke of the IPD with a headers and payload set of properties.

     

    You can initiate it via the endpoint I provided to see the response (no payload, but you'll be able to get the sense of how it is invoked). Here is an example using Postman:

     

     

    To use this proxy (service name is hard coded to authenticate) you can import into Process Developer the project, and import into Process Designer the authenticateProcess and a corresponding process object.

     

    To try this out, from the Process Developer project, deploy via the console the deploy/HeaderAndPayloadExtraction.bpr archive. Please review this: https://network.informatica.com/onlinehelp/icrt/current/en/dd-icrt-monitor/Understanding_Contributions.html  and this: https://network.informatica.com/onlinehelp/icrt/current/en/gg-icrt-process-developer-guide/Creating_and_Deploying_a_Busi…

     

    Once you've deployed the "BPR" BPEL Contribution and published the Process Designer sample authenticateProcess, you should be able to invoke your endpoint at: https://ps1w2.rt.informaticacloud.com/active-bpel/public/services/REST/<yourOrg>/authenticate

    If you want to study the sample, install Process Developer from: http://doc.rt.informaticacloud.com/cpd/Cloud_Process_Developer_windows.zip. Import the project and open up the bpel/headerextractprocess.bpel

     

     

    Look at the input tab and study the payload.

     

    Then look at the deployment descriptor, the PDD. You'll observe that the process is exposed as an anonymous endpoint named "authenticate"

     

     

    ... and you'll see that the "invokeIPD" partner service is named "authenticate".

     

     

    The next step: invoke the service

     

    Find the HeaderExtractionProcess and open it's details:

     

    What you see here is the extracted content that Process Server prepares for you. The next step is to pull into the call to the IPD process the content of the headers and payload with this expression:

     

    <ns:initiate xmlns:ns="http://schemas.informatica.com/spi/types/2013/12/spi-interface/"
                
    xmlns:ns1="http://schemas.active-endpoints.com/appmodules/screenflow/2010/10/avosScreenflow.xsd">
       
    <ns:input xmlns="http://schemas.active-endpoints.com/appmodules/screenflow/2010/10/avosScreenflow.xsd">
         
    <parameter name="request">
            
    <ProcessInputForAuthenticateProcess xmlns:ns4="http://schemas.active-endpoints.com/appmodules/screenflow/2010/10/avosScreenflow.xsd">
               
    <headers>
                  {for $header in $RESTRequest/types:headers/types:header
                  return
                 
    <header>
                   
    <name>{data($header/@name)}</name>
                   
    <value>{data($header/@value)}</value>
                 
    </header>  }
               
    </headers>
                {if (string-length( $RESTRequest/types:payload/text())>0 )
                then (
    <JSONRequest>{ $RESTRequest/types:payload/text() }</JSONRequest>)
                else ()}
           
    </ProcessInputForAuthenticateProcess>
         
    </parameter>
      
    </ns:input>
    </ns:initiate>

     

    Next, have a look at the "Invoke the IPD Initiate Method" step. You'll see this:

     

     

    Then via the Console, look at the IPD authenticateProcess. You'll see this:

     

     

    The formatting of the on-hover does not show it clearly, but what you will find when looking at the process objects are all of the fields you need to extract the Bearer Token for example.