You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Brent Johnson <bl...@gmail.com> on 2004/07/14 22:13:48 UTC

Analyzing Stream Data (was: SOAP Server?)

I'm trying to find a way to process a SOAP request in a pipeline.  I
could simply use a stream generator then run transforms on the stream
to output the SOAP response.

However... I need to do different things (in Java) depending on what's
in the actual SOAP request so that throws XSP out the window (since I
used up my generator on the stream generator).  Here's a quick
example.. this gets posted to a pipeline:

<soapenv:Envelope>
    <soapenv:Body>
        <wedgerequest>
            <authentication>
                <user>brent</user>
                <password>password</password>
            </authentication>
            <action type="move">
                <location id="3"/>
            </action>
        </wedgerequest>
    </soapenv:Body>
</soapenv:Envelope>

Everything that gets posted to this pipeline will require an
<authentication> tag.  So here would be the events that would need to
transpire:

1.  Run a SQL query to test the authentication
2.  If it fails I need to output a failure SOAP response and stop
3.  If it doesnt fail I need to check the action/@type and call some
Java method or run some Java code.

This Java code and SOAP response will be different for each type
(login/logout/move/whatever).

So any suggestions on how I could accomplish this?  Ive been
brainstorming all morning on this and I just know there's some really
simple solution thats staring me right in the face.  The end result of
my tests so far all end with the same problem:
"How am I going to conditionally call different Java code based on
data in the stream?"

My latest brainstorm idea was to just create my own custom
heavy-weight transformer that basically does all the work.. tests
authentication then calls whatever based on the stream.  But that just
doesnt seem like the best way to do things.  There has to be a better
way.

Someone suggested using the JXTemplateTransformer to make Java calls. 
But after perusing the documentation I ran across the
JXTemplateGenerator and it looks like it's really more intended to
work with Java Beans and not really arbitrary Java object calls.  But
I could (and most likely am) be wrong.

Thanks,

- Brent

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org