You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ulf Sahlin <ul...@s2communications.se> on 2004/02/17 19:05:03 UTC

Concerning a) Woody bindings, b) Web Service publishing using existing Generator?

Hi everyone!

First let me thank the Cocoon development team for an outstanding publishing
framework. Next, I have two questions; one concerning Woody and the other
SOAP/Axis. I'm using Cocoon 2.1.3 as for now.

1. I've been playing around a little with Woody. From my short usage
experience, it looks very promising for form management. My business logic
is implemented in EJB. Is there some load/save binding framework for EJB
available? Also, I have implemented an XML representation of my Entity Bean
data using a Cocoon Generator. Is there some way I could use the XML
representation work already put in place there, by feeding Woody with data
from a Generator? I don't know if I'm right on the mechanics of Cocoon here,
please let me know if I'm way off. I know I have to handle saving validated
form data anyway so maybe using a Generator isn't the right way to go (e.g.
I cannot avoid using Woody's binding stuff?).

2. I would like to publish my own Web Services, based on my existing work in
Generators (basically, have the SOAP/Axis Reader getting calls using
existing pipeline structure). Is there some way I can read the data from the
SOAP XML structure (i.e. retrieve the parameters, encapsulated in SOAP XML,
to my Generator EJB Finder call)? I'm thinking maybe I could set the
Generator parameters directly in the pipeline rather than using
request.getParameter within the Generator (thereby de-coupling it from
web-based calls only). Based on the call type maybe I could use a common
Generator to create the XML (*.html = set parameters using
request.getParameter, *.service = set parameters using ????).

Pseudo-sitemap below (my guess is it's not very correct syntax):

<map:match pattern="*.html">
  <map:generate src="generator.xsp">
    <map:parameter name="myparam"
value="{request.getParameter('myparam')}"/>
  </map:generate>
  <map:transform src="transformer-html.xsl"/>
  <map:serialize type="html"/>
</map:match>

<map:match pattern="*.service">
  <map:read type="soap-rpc" mime-type="text/xml"/>
  <map:generate src="generator.xsp">
    <map:parameter name="myparam"
value="{axis.getParameter('/soap:Envelope/soap:Body/myparam')}"/>
  </map:generate>
  <map:transform src="transformer-webservice.xsl"/>
  <map:serialize type="xml"/>
</map:match>


Thanks for your help!

Kind regards,

   Ulf Sahlin


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


Re: Concerning a) Woody bindings, b) Web Service publishing using existing Generator?

Posted by Ulf Sahlin <ul...@s2communications.se>.
> >>><map:match pattern="*.service">
> >>>  <map:read type="soap-rpc" mime-type="text/xml"/>
> >>>  <map:generate src="generator.xsp">
> >>>    <map:parameter name="myparam"
> >>>value="{axis.getParameter('/soap:Envelope/soap:Body/myparam')}"/>
> >>
> >>If you store this XML structure somewhere the XModuleSource should work:
> >>http://wiki.cocoondev.org/Wiki.jsp?page=XModuleSource.
> >
> >
> > Bear in mind that I need to make use of the XSP Generators
> since I generate
> > the XML data from it. Afaik there can be only one Generator in a Cocoon
> > pipeline. The methods used for reading XMLized input I've looked into
> > unfortunately replace the ServerPages generator. If the XModule
> is used in
> > the same manner as request.getParameter I see the possibilities!
>
> XModuleSource is a source, not a sitemap component, so it is not a
> replacement for XSPGenerator (in good or bad sense). Furthermore there
> is still the possibility of aggregation.
>
> But you are right, using it in map:parameter directly would not be
> possible, but for example in combination with XMLFileModule (which can
> not only read files but probably from all resolvable sources).

As a SOAP call is an XML structure packaged within the request object maybe
I could serialize that. I guess what I'm looking for is the way to get that
data into an xpath-readable object. As this XML data is bundled within the
actual request call I'm a little confused in how to use it as a
XModuleSource.

Example SOAP call over HTTP:

---------

POST /InStock HTTP/1.1
Host: www.stock.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
  xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
  soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
  <soap:Body xmlns:m="http://www.stock.org/stock">
    <m:GetStockPrice>
      <m:StockName>IBM</m:StockName>
    </m:GetStockPrice>
  </soap:Body>
</soap:Envelope>

--------

Naturally in this case I would like to read the
/soap:Envelope/soap:Body/m:getStockPrice/m:StockName parameter to use it in
my ejb finder within the XSP Generator.


> > I didn't find any examples in cocoon/samples/ (I'm using 2.1.3). XModule
> > being in Scratchpad could be a reason.
>
> Yes, it's new.
>
> > Could you please expand on your XModule thoughts, in particular
> how to use
> > it to read the contents of a SOAP call to extract parameters to
> be used in
> > the generator (as I pseudo-sketched above). I truly appreciate
> your help!
>
> It depends on which you get the result of the SOAP call in or where you
> store it. The above pseudo code using a reader first and a generator
> afterwards is not possible.
>
> But wait, there is also a SOAP call from inside XSP possible ...
> searching for the samples ... http://127.0.0.1:8888/samples/xsp/soap/ in
> your local Cocoon installation. Maybe so it's easier.
>
> Joerg

There is very good support indeed for calling external web services from
within Cocoon, such as (taken from samples):

--------

<soap:call url="http://services.xmethods.net:9090/soap">
    <ns1:getRate xmlns:ns1="urn:xmethods-CurrencyExchange"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
        <soap:enc/>
        <country1 xsi:type="xsd:string">euro</country1>
        <country2 xsi:type="xsd:string">united states</country2>
    </ns1:getRate>
</soap:call>

--------

Still this only uses another server's SOAP services hence it isn't actually
serving them. As the hello-world samples also state there is some REST-style
web service example available (meaning, just serialize the XML) but I'd like
to go all the way with the SOAP-compatibility.


Cheers,
   Ulf Sahlin


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


Re: Concerning a) Woody bindings, b) Web Service publishing using existing Generator?

Posted by Joerg Heinicke <jo...@gmx.de>.
On 18.03.2004 13:55, Ulf Sahlin wrote:

>>><map:match pattern="*.service">
>>>  <map:read type="soap-rpc" mime-type="text/xml"/>
>>>  <map:generate src="generator.xsp">
>>>    <map:parameter name="myparam"
>>>value="{axis.getParameter('/soap:Envelope/soap:Body/myparam')}"/>
>>
>>If you store this XML structure somewhere the XModuleSource should work:
>>http://wiki.cocoondev.org/Wiki.jsp?page=XModuleSource.
> 
> 
> Bear in mind that I need to make use of the XSP Generators since I generate
> the XML data from it. Afaik there can be only one Generator in a Cocoon
> pipeline. The methods used for reading XMLized input I've looked into
> unfortunately replace the ServerPages generator. If the XModule is used in
> the same manner as request.getParameter I see the possibilities!

XModuleSource is a source, not a sitemap component, so it is not a 
replacement for XSPGenerator (in good or bad sense). Furthermore there 
is still the possibility of aggregation.

But you are right, using it in map:parameter directly would not be 
possible, but for example in combination with XMLFileModule (which can 
not only read files but probably from all resolvable sources).

> I didn't find any examples in cocoon/samples/ (I'm using 2.1.3). XModule
> being in Scratchpad could be a reason.

Yes, it's new.

> Could you please expand on your XModule thoughts, in particular how to use
> it to read the contents of a SOAP call to extract parameters to be used in
> the generator (as I pseudo-sketched above). I truly appreciate your help!

It depends on which you get the result of the SOAP call in or where you 
store it. The above pseudo code using a reader first and a generator 
afterwards is not possible.

But wait, there is also a SOAP call from inside XSP possible ... 
searching for the samples ... http://127.0.0.1:8888/samples/xsp/soap/ in 
your local Cocoon installation. Maybe so it's easier.

Joerg

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


Re: Concerning a) Woody bindings, b) Web Service publishing using existing Generator?

Posted by Ulf Sahlin <ul...@s2communications.se>.
Hello Joerg! Thank you for your input.

> > 1. I've been playing around a little with Woody. From my short usage
> > experience, it looks very promising for form management. My
> business logic
> > is implemented in EJB. Is there some load/save binding framework for EJB
> > available? Also, I have implemented an XML representation of my
> Entity Bean
> > data using a Cocoon Generator. Is there some way I could use the XML
> > representation work already put in place there, by feeding
> Woody with data
> > from a Generator? I don't know if I'm right on the mechanics of
> Cocoon here,
> > please let me know if I'm way off. I know I have to handle
> saving validated
> > form data anyway so maybe using a Generator isn't the right way
> to go (e.g.
> > I cannot avoid using Woody's binding stuff?).
>
> You can also bind to XML, writing some stuff in flow including the
> storing of the pipeline output (that pipeline with your generator) into
> DOM should be no problem. But I don't understand why don't bind directly
> to beans? That's at least what I do though I don't use enterprise beans.

Yes, I realized there is no point in trying to use XML binding for form
population and Bean binding for reading the posted form data, since the
bindings are used in both the load and the save operations. I've been
experimenting some with the bean binding and it looks great!


> > 2. I would like to publish my own Web Services, based on my
> existing work in
> > Generators (basically, have the SOAP/Axis Reader getting calls using
> > existing pipeline structure). Is there some way I can read the
> data from the
> > SOAP XML structure (i.e. retrieve the parameters, encapsulated
> in SOAP XML,
> > to my Generator EJB Finder call)? I'm thinking maybe I could set the
> > Generator parameters directly in the pipeline rather than using
> > request.getParameter within the Generator (thereby de-coupling it from
> > web-based calls only). Based on the call type maybe I could use a common
> > Generator to create the XML (*.html = set parameters using
> > request.getParameter, *.service = set parameters using ????).
> >
> > Pseudo-sitemap below (my guess is it's not very correct syntax):
> >
> > <map:match pattern="*.html">
> >   <map:generate src="generator.xsp">
> >     <map:parameter name="myparam"
> > value="{request.getParameter('myparam')}"/>
>
> This can be done by input modules.
>
> >   </map:generate>
> >   <map:transform src="transformer-html.xsl"/>
> >   <map:serialize type="html"/>
> > </map:match>
> >
> > <map:match pattern="*.service">
> >   <map:read type="soap-rpc" mime-type="text/xml"/>
> >   <map:generate src="generator.xsp">
> >     <map:parameter name="myparam"
> > value="{axis.getParameter('/soap:Envelope/soap:Body/myparam')}"/>
>
> If you store this XML structure somewhere the XModuleSource should work:
> http://wiki.cocoondev.org/Wiki.jsp?page=XModuleSource.
>
> Joerg

Bear in mind that I need to make use of the XSP Generators since I generate
the XML data from it. Afaik there can be only one Generator in a Cocoon
pipeline. The methods used for reading XMLized input I've looked into
unfortunately replace the ServerPages generator. If the XModule is used in
the same manner as request.getParameter I see the possibilities!

I didn't find any examples in cocoon/samples/ (I'm using 2.1.3). XModule
being in Scratchpad could be a reason.

Could you please expand on your XModule thoughts, in particular how to use
it to read the contents of a SOAP call to extract parameters to be used in
the generator (as I pseudo-sketched above). I truly appreciate your help!


Cheers,

  Ulf Sahlin


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


Re: Concerning a) Woody bindings, b) Web Service publishing using existing Generator?

Posted by Joerg Heinicke <jo...@gmx.de>.
On 17.02.2004 19:05, Ulf Sahlin wrote:

> 1. I've been playing around a little with Woody. From my short usage
> experience, it looks very promising for form management. My business logic
> is implemented in EJB. Is there some load/save binding framework for EJB
> available? Also, I have implemented an XML representation of my Entity Bean
> data using a Cocoon Generator. Is there some way I could use the XML
> representation work already put in place there, by feeding Woody with data
> from a Generator? I don't know if I'm right on the mechanics of Cocoon here,
> please let me know if I'm way off. I know I have to handle saving validated
> form data anyway so maybe using a Generator isn't the right way to go (e.g.
> I cannot avoid using Woody's binding stuff?).

You can also bind to XML, writing some stuff in flow including the 
storing of the pipeline output (that pipeline with your generator) into 
DOM should be no problem. But I don't understand why don't bind directly 
to beans? That's at least what I do though I don't use enterprise beans.

> 2. I would like to publish my own Web Services, based on my existing work in
> Generators (basically, have the SOAP/Axis Reader getting calls using
> existing pipeline structure). Is there some way I can read the data from the
> SOAP XML structure (i.e. retrieve the parameters, encapsulated in SOAP XML,
> to my Generator EJB Finder call)? I'm thinking maybe I could set the
> Generator parameters directly in the pipeline rather than using
> request.getParameter within the Generator (thereby de-coupling it from
> web-based calls only). Based on the call type maybe I could use a common
> Generator to create the XML (*.html = set parameters using
> request.getParameter, *.service = set parameters using ????).
> 
> Pseudo-sitemap below (my guess is it's not very correct syntax):
> 
> <map:match pattern="*.html">
>   <map:generate src="generator.xsp">
>     <map:parameter name="myparam"
> value="{request.getParameter('myparam')}"/>

This can be done by input modules.

>   </map:generate>
>   <map:transform src="transformer-html.xsl"/>
>   <map:serialize type="html"/>
> </map:match>
> 
> <map:match pattern="*.service">
>   <map:read type="soap-rpc" mime-type="text/xml"/>
>   <map:generate src="generator.xsp">
>     <map:parameter name="myparam"
> value="{axis.getParameter('/soap:Envelope/soap:Body/myparam')}"/>

If you store this XML structure somewhere the XModuleSource should work:
http://wiki.cocoondev.org/Wiki.jsp?page=XModuleSource.

Joerg

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