swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax     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 Syntax
   wsb.request-header
   wsb.wait-for-request
   wsb.set-request-header
 
  Other Library Functions
   wsb.add-service
   wsb.clear-all-services
   wsb.create-server
   wsb.dispatch-request
   wsb.forward-request
   wsb.has-known-request-type
   wsb.reader
   wsb.read-service-arguments
   wsb.remove-service
   wsb.request
   wsb.request-header
   wsb.request-name
   wsb.request-type
   wsb.server
   wsb.service-exists
   wsb.set-request-header
   wsb.start-servicing-requests
   wsb.wait-for-request
   wsb.writer
 
 

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

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:27:39 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.