Thanks for the pointers I will have a read.
I did find the env api call you mention, for reference here was my
(buggy/incomplete) code:
static void mediate (mc) {
def env = mc.getEnvironment()
def newMc = env.createMessageContext()
//newMc.setEnvelope(mc.getEnvelope())
//def newScriptMc = new ScriptMessageContext(newMc, new
DefaultXMLHelper())
//newMc.setPayloadXML('''<mymessage/>''')
def createEP = mc.getEndpoint("API_CREATE")
createEP.send(newMc)
}
I ran out of time last night, but seemed to have to jump thru hoops to get
to an XMLHelper, which I never got to work properly.
Thanks again for the links,
All the best
Wayne
On Tue, Apr 15, 2008 at 9:51 AM, Ruwan Linton <[EMAIL PROTECTED]>
wrote:
> Hi Wayne,
>
> You should have a look at the callout mediator [1] and also this [2] case
> study, which covers some ground and do something similar. Also you can use
> the SynapseEnvironment.createMessageContext() to get a new message context
> created. You can use java inside groovy and hence this call will be
> possible
> inside groovy as well.
>
> Hope this will help.
>
> [1] - http://synapse.apache.org/Synapse_Samples.html#Callout
> [2] - https://wso2.org/library/3325
>
> Thanks,
> Ruwan
>
> On Tue, Apr 15, 2008 at 1:57 PM, Wayne Keenan <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
> >
> > I think I might be pushing/abusing mediators, by doing more that message
> > manipulation, I'm trying to call endpoint from within a script, and
> would
> > be
> > grateful for some advice.
> >
> > Here is the setup:
> >
> > 1. Synapse
> >
> > a) publishing a predefined WSDL of 'composite' services. e.g.
> > createTroubleTicket.
> > b) a mediator chops up incoming SOAP Payload XML into parent child
> records
> > c) the mediator calls (external) lower level atomic services (e.g.
> create
> > record) for the parent
> > d) the mediator needs to either calculate child id (e.g. sequential
> index)
> > or use the result of parent ids created at runtime
> > e) the mediator calls (external) lower level create record for the
> > children
> >
> > 2. RESTful server for the (external) Atomic services
> > a). create record in a DB (not JPA, uses propritary API to create 1 row
> in
> > an underlying DB)
> >
> >
> > I am writing a Groovy mediator to take the parent and child records and
> > then
> > call the atomic service endpoitns using somehtin glike:
> >
> > def createEP = mc.getEndpoint("SOME_API_CREATE")
> > createEP.send(newMc)
> >
> > I've basically got 1a,1b & 2a working, but for 1c-e trying to create
> the
> > new MessaceContext ('newMc') is perhaps telling me I should not be doing
> > this?
> >
> > I wanted to avoid 'programming in XML' via the declarative Synapse
> > mediators, but perhaps I will have to?
> >
> > Regards
> > Wayne
> >
>
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>