|  | 
 | ||||
|        | |||||
|  | ||||||
| Related Topics | Other Library Functions | |||||
| function | wsb.forward-request | 
| Library: Web Services Broker (OMWSB) Import: omwsb.xmd | 
export external function forward-request
                      value request     request
Argument definitions
The wsb.forward-request function provides a mechanism to request servicing
from the WSB.  The function is passed a wsb.request object which contains
both the header needed to route and process the request and the body with
the data.  This wsb.request object is most commonly the request object
received from a wsb.wait-for-request function call.  The function
wsb.set-request-header is used to set the header of the wsb.request object.
When the WSB is called with this function it routes the passed request to
the appropriate program, which processes it.  The requesting program should
not do any further processing on the request object.
This example shows how to reroute a SOAP request to a service called DoCalc.
The program waits for the request then fetches the request objects 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#"   
Copyright © Stilo International plc, 1988-2010.