Tuesday, July 5, 2011

Putting OSB to REST

this is my URI that I "GET" in my browser:


being GUTools/Caches/LoadCache the URI of my "REST" AnyXML Proxy Service

assign $inbound/ctx:transport/ctx:request/http:relative-URI/text() to relativeURI

(relativeURI = validityDate=2001-07-05/id=90)

let $mySequence := fn:tokenize($relativeURI, "/")
{for $item in $mySequence
return <parameter><name>{fn:substring-before($item, '=')}</name><value>{fn:substring-after($item, '=')}</value></parameter>

to parameters

this is $parameters :


For Each [ parameter ] in [ ./parameter ] of [ parameters ]
Indexed by [ parameterIndex ] with total count in [ parameterCount ]

log $parameter/name/text()
log $parameter/value/text()

Great! I was able to get all the parameters from the URI. At this point I can process them using simple XPath to thet their value:


this returns 2001-07-05

I can invoke from a CRON job this command:

lwp-request -m GET http://acme.com:7009//GUTools/Caches/LoadCache/validityDate=2001-07-02

to trigger the Proxy Service with a simple GET (no more bloody SOAP)

No comments: