Hi,
I have signed up to esbsite.com and have submitted an article, I hope that
is what you meant in this instance by blog it?
Regards
Wayne
On Mon, Apr 14, 2008 at 12:36 PM, Ruwan Linton <[EMAIL PROTECTED]>
wrote:
> Hi Wayne,
>
> Thanks for sharing this and it would be nice to see this interesting
> snippet
> goes as a blog entry as well.
>
> Thanks,
> Ruwan
>
> On Mon, Apr 14, 2008 at 4:54 PM, Wayne Keenan <[EMAIL PROTECTED]>
> wrote:
>
> > Inlining Groovy scripts is thankfully easy. For reasons such as
> tidyness,
> > reuse, in-flight updates and sanity sake it is arguably be better to
> store
> > the
> > scripts as external entities in a repository. For the benefit of others
> I
> > have collected the info I found elsewhere and some experimentation
> >
> > in one place to show how it's done:
> >
> > Below is a simple inliine script that builds a static XML document :
> >
> > <sequence name="service_dispatch_out" trace="enable">
> > <script language="groovy">
> >
> > mc.setPayloadXML('''<hello
> > xmlns="http://grails-exchange.com
> > "><to>Everyone</to><from>Paul</from></hello>''')
> > </script>
> > <send/>
> > </sequence>
> >
> > For an script in a repository follow this 'pattern':
> >
> >
> > Synapse XML:
> >
> > <sequence name="service_dispatch_out" trace="enable">
> > <script language="groovy"
> > key="samples/scripts/staticXMLresponse.groovy"/>
> > <send/>
> > </sequence>
> >
> >
> > Repository XML:
> >
> >
> >
> > <x><![CDATA[
> > static void mediate (mc) {
> >
> > mc.setPayloadXML('''<hello xmlns="http://grails-exchange.com
> > "><to>Everyone</to><from>Paul</from></hello>''')
> > }
> > ]]></x>
> >
> > Notice there needs to be a root tag, to support the (implied) XInclude I
> > guess, and that the script needs to adhere to an interface to be able to
> > be
> > passed the MessageContext (mc) which gives programmatic access to the
> > current synapase message and sequence.
> >
> > For interesting things you can do with the MessgeContext please have a
> > look
> > at:
> >
> >
> http://synapse.apache.org/apidocs/org/apache/synapse/mediators/bsf/ScriptMessageContext.html
> >
> >
> > All the best
> >
> > Wayne
> >
>
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>