swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Topics   Other Library Functions  
function  

wsb.forward-request

 
 

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

Declaration

export external function forward-request
                      value request     request

Argument definitions

request
The wsb.request OMX value containing the request to serviced by another program handled by the WSB


Purpose

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.

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 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#"   

    Related Topics
 
Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.