wsb.set-request-header

function

Library: Web Services Broker (OMWSB)
Import : omwsb.xmd

Declaration
export external function set-request-header
   of                 value request     request
   to                 value  string     header


Argument definitions

request
The wsb.request OMX value containing the request header to be set.
header
The value of the header to be set.


Purpose

The wsb.set-request-header function sets the header value of the wsb.request object to the specified string value. This function is used to make sure that forwarded requests are sent to the right program for processing.

Example

This example shows how to reroute a SOAP request to a service called DoCalc. The program waits for the request, then fetches the request object's header and rewrites the SOAPAction header tupple to point to DoCalc. Then the program sets the request object's header using the wsb.set-request-header function to the new value. Then the program forwards the request using the function wsb.forward-request. Finally the function loops and waits for the next request for it to forward.

  import 'omwsb.xmd' prefixed by wsb.
  
  process
     repeat
        local stream head
        local wsb.request req
        
        set req to wsb.wait-for-request
        open head as buffer
        using output as head 
          submit wsb.request-header of req
        close head
        wsb.set-request-header of req to head  
        wsb.forward-request req      
        catch #external-exception identity catch-id
           rethrow when catch-id = "OMWSB000"
     again
  
  catch #external-exception
  
  
  find "SOAPAction: " any ++ "%13#%10#"
     output "SOAPAction: %"http://DoCalc%"%13#%10#"