Hola Mauro,
    I am trying the same path for similar reasons.

I send attached a message interchange with Marcus (the Soap guru of Cocoon).

Sounds like it has to be with extending some part of the 'action' part
See http://localhost:8080/cocoon/documents/developing/extending.html

Best Regards,
Dario.

PD: Lets join efforts in this try Mauro, we can then make public some
examples of how to accomplish this.

PD2: To all the others, please let us know if you have gone with a similar
approach of having cocoon be an internal module for xml transformations
pipeline, so that one may have the input source and the output target be
both of them memory objects.

PD3: What I am looking for is to be able to do something like this: (is it
your need too?)

/* Pseudocode here inside my servlet or whatever: */
While ( manager.keepOnWorking()==true) {
    /* in this example I get an XML from a soap request
    but it may be any other source, Like a database XML. */
    SoapObj.SyncWaitMessage();
    myInputXmlDomRef = SoapObj.GetXMLRequest();

    cocoonref = Cocoons.getCocoonInstance();

    /* Here I add objects to a hash table So That an Xsp (or whatever) Can
Call Me for logic questions, DB interaction, etc  */
    cocoonref.PutObject("mylogicClass", this);


    /* Here I call cocoon with the xml input (it may be even empty), and ask
it to process the transformation pipeline (using cocoons cache and all its
cool stuff). The entry 6 in the map in this case produces an XML, so I
transform the Sax into Dom and put it in myOuputXML object. */
    cocoonref.ApplyPipeline("MapEntry6",myInputXmlDomRef, myOutputXML);
/* Cocoon may call me back many times during the transformation process
through "mylogicClass" entry or EJB lookup, etc */

    Try {
        /* I am done! thank you cocoon! Lets send the reply:  */
        SoapObj.PutResponse(myOutputXML);
        SoapObj.SendXMLResponse();
    } catch(error e) {
        cocoonref.PutObject("error", e);
        cocoonref.ApplyPipeline("MapEntry99_errorlogguer",myOutputXML,
myLogOutputStream);
        /* The output may also be a stream of bytes in case of an image,
etc. For example here it is a simple text log file */
    }

    cocoonref.free();
}


I hope this is not too crazy an example, and that I managed to explain the
idea.
Thanks to everyone having got to here in the message, stay in contact.
Bye.


----- Original Message -----
From: "Mauro Daniel Ardolino" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 09, 2002 09:47
Subject: Cocoon, sockets and not a web browser.


> Hello!
> I need to know if cocoon can be used to apply transformations to
> xml files that comes from a socket or from a soap communication.
> Also I need to know if I can serialize the results to a java class
> to parse them for example with sax.
>
> So what I mean is that I want to use cocoon to make only the
> transformations.  I need to make transformations (using xpath)
> and I think that cocoon (and XSL) can help me, but the results will
> not go to a web-browser.  They have to go to a class.
>
> My program can be a stand alone program with Swing or SWT gui interface,
> or can be a batch program.
>
> Am I clear?  If not, please let me know.
>
> Thanks in advance, reggards,
>
> -- Mauro
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>
--- Begin Message ---
Hi Dario,

On Mon, Oct 07, 2002 at 03:19:50PM -0300, Dario Liberman wrote:
> Hi Marcus, thank you very much for your super-prompt response.
> 
> I attach the message I sent to the list, perhaps you can tell me what you
> think about it.

        Ok, I've got come comments in your message below.

> I followed the tutorial for the jwsdp from sun, and they have a very nice
> framework for soap, it supports attachments (and even does an automatic
> webtier of SOAP-RPC for you if you provide an interface for your
> methods).Comparing it to apache soap, I dont care much about the automatic
> inteface since I can do it myself, but the attachments stuff is usefull and
> is working.

        Ok. I haven't looked at jwsdp, perhaps its worth examining. The
        SOAP support in Cocoon is based on Apache AXIS (not Apache SOAP
        which is an older project), which has just been released as final 1.0.
        
        Axis has passed all of the acceptance tests from Sun, so I presume
        all of what is in jwsdp is in Axis somewhere.

> Getting to the point:
> 
> I have cocoon-2.0.3 and the directories you mention arent there, I guess I
> have to download something. Where should I download the lastest version of
> the cocoon-Soap implementation you made and where can I find a guide in
> order to make it work?

        First thing, get Cocoon 2.1 from CVS. The SOAP support is in the
        src/scratchpad directory in CVS - Cocoon 2.0.3 is too old. The
        reader can be back ported to work with 2.0.3 but currently only
        works with 2.1 (the source resolver usage needs to be changed to
        work with 2.0.3).
        
        Once you've got 2.1 checked out and built, have a look at the
        src/scratchpad/org/apache/cocoon/webservices, and
        src/scratchpad/webapp/samples/soap-server directories for examples
        of how it is used.

> Subject: Re: Servlet-Ouput as Cocoon-Input
> 
> What is the correct way of doing it?
> I am new to cocoon too, but I see here serialization and deserialization
> done perhaps unnecessary.
> If the servlet used a DOMXML object to represent the outermost data, and
> then serialized it to give it to cocoon, it is a waste.
> Is there anyway to have the servlet give an XMLobject to the cocoon pipeline
> instead of a character-stream?

        Not really, as Cocoon only works with SAX streams. To use Cocoon
        pipelines the data needs to be converted to an XML SAX stream
        somehow, which is what the generator component of a pipeline does.

> In my case, I am used to WebMacro, that is similar to Velocity from apache.
> In this architecture (more or less), the servlet receives a request, and
> then processes an action (like searching something in the database) and then
> puts objects in a hashtable (like a collection of javabeans representing the
> query result) and then invokes a template. The template can use the objects
> passed to the hashtable by specifying $keyname.method() for example. It has
> primitive logic directives as iteration, if-then-else, and a set statement
> in order to modify variables (this way you are forced to code well, since
> most of the logic must be in a java class, not in the template). This output
> then can be sent to the response stream, or to a file or to wherever you
> like (but 99% of the time you set it to the response).
> 
> I like this architecture, and I would like to mix it with cocoon. So I
> suppose that instead of WebMacro, I should be doing similar things with an
> xsp, so that instead of a stream of characters I get as output an XMLobject
> to introduce into the pipeline.

        You could do something similar using xsp pages and Cocoon actions.
        Have a look at the classes in src/java/org/apache/cocoon/acting,
        in particular the Action interface and Abstract & ComposerAction
        classes.
        
        With these classes you can perform some operation and store the
        result as a request attribute. In an xsp file you could retrieve
        these values and do your processing as you describe it above.

> Also, I need to get hold of the final xmlobject from the pipeline (instead
> of serializing it to the response) since I have to put this xml in a SOAP
> message as the final result (not a webbrowser).
> So what I need cocoon to be, is an invisible module that I put objects to it
> in some hashtable as input and a template name (or map ref, as you like),
> and gives me magically as output (after a pipeline of transformations with
> automatic-caching, etc) a nice XMLobject. Then with it I do what I like (for
> example put it in a soap message response/request or even put it back in a
> cocoon-pipeline of transformations get yet another xmlobject).

        Ok, this is a bit more complex. The soap support in Cocoon is done
        currently as a reader, this is due to technical and ease-of-use
        reasons. But, since it's done as a reader you have to write your
        webservices as complete classes (ie. not as a pipeline).

        Cheers,
        
        Marcus
-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:
--- End Message ---
---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to