Friday, July 29, 2011

OSB find which Proxy Service is being invoked

I am a bit unsure how better to identify the Message Flow which is currently being executed;
The $inbound variable is:

<con:endpoint name="ProxyService$pierreTests$identifyFlow$identifyFlowPS" xmlns:con="http://www.bea.com/wli/sb/context">
      <con:service/>
      <con:transport>
        <con:uri>/pierreTests/identifyFlow/identifyFlowPS</con:uri>
        <con:mode>request-response</con:mode>
         <bla/>
</con:transport>
</con:endpoint>


so, if you use the name attribute of inbound you have this Xquery:


xquery version "1.0" encoding "Cp1252";
(:: pragma  parameter="$anyType1" type="xs:anyType" ::)

declare namespace xf = "http://tempuri.org/PVTests/getOriginFromInbound/";
declare namespace con = "http://www.bea.com/wli/sb/context";
declare namespace tran = "http://www.bea.com/wli/sb/transports";

declare function xf:getEndpointFromInbound($inbound1 as element())
    as xs:string {
       let $myendpoint := $inbound1/./@name
       return
       fn:tokenize($myendpoint, '\$')[last()]
};

declare variable $inbound1 as element() external;

xf:getEndpointFromInbound($inbound1)


result=identifyFlowPS

This method is far better than using the transport/uri, since the latter is present only in HTTP Proxies, while the inbound/@name is present in ALL proxies.

No comments: