From: Joe Latty
> The javascript function is called from a pipeline match
>
> <map:match pattern="test">
> <map:call function="main" />
> <map:serialize/>
> </map:match>
>
> The function looks something like this
>
> function main() {
> var output = new Packages.java.io.ByteArrayOutputStream();
> cocoon.processPipelineTo('blah/matcher, {}, output);
>
> var doc = output.toString();
>
> // doc is now an xml string - this is all working fine
> // I want to do some error checking and a possible
> soap call at this point
>
> if (success)
> // the output (doc) would become the result, which would be
using the > function call like a generator, to be serialized
> else
> cocoon.sendPage('failure', {});
>
> }
>
> a) I hope I have made sense
I understand what you want to do but this is *not* the way the Cocoon
control flow works. Please have a look at e.g. the calculator example.
The <map:call function="main" /> element is a kind of 'redirect'. The
sitemap passes the control to the flow layer. At the flow layer you
decide where to go next and passes the control back using
cocoon.sendPage(AndWait).
(--> so the <map:serialize/> doesn't make sense!)
> b) Any ideas?
I would write a specialized component that makes the soap calls:
function main() {
var soapComp = cocoon.getComponent( "soapComponent" );
var success = soapComp.call( "blah/matcher" );
if( success ) {
cocoon.sendPage( "successPage", { soapXML :
soapComp.getDom() } );
}
else {
cocoon.sendPage( "failure", {} );
}
}
If you use the JXTemplateGenerator at your view pipeline (successPage)
you can serialize the XML returned by the soapComponent.
HTH
Reinhard
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]