You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ivelin Ivanov <iv...@apache.org> on 2002/06/24 05:10:59 UTC

[RT] WebServicesProxy Generator

Following is an initial draft of a new component I am starting to work on.

Fire and Ice welcome ;)


------------------------------------------------------------------------

The WebServiceProxy Cocoon generator is intended to:

1) Allow easy syndication of dynamic content as a natural extension of 
the currently popular static content syndication with RSS.

2) Allow transparent routing of web service request through GET, POST, 
SOAP-RPC and SOAP-DOC binding methods.

3) Allow almost full control through sitemap configuration.

4) Allow use of Cocoon components for content formatting, aggregation 
and styling through a tight integration with the Cocoon sitemap.

5) Require 0 (zero) lines of Java or other business logic code in most 
cases.

6) Be generic and flexible enough to allow custom extensions for 
advanced and non-typical uses.

7) Support sessions, authentication, http 1.1, https,  request 
manipulation, redirects following, connection pooling, and others.

8) Use the Jakarta HttpClient library which provides many sophisticated 
features for HTTP connections.



------------------------------------------------------------------------
Example I: Integration of the Amazon book search service in a Cocoon portal:
------------------------------------------------------------------------

pipeline:
---------

     <map:pipeline>
       <map:match pattern="amazon/searchform">
           <map:generate src="AmazonForm.xml"/>
           <map:transform src="AmazonForm2html.xsl"/>
           <map:transform 
src="context://stylesheets/xmlform/xmlform2html.xsl"/>
           <map:serialize type="html"/>
         </map:act>
       </map:match>

       <map:match pattern="amazon/search*">

           <map:generate src="http://rcm.amazon.com/e/cm{1}">
               <!-- The WebSericeProxy generator takes 3 arguments: -->
               <!-- 1) The URL of the targeted web service -->
               <!-- 2) The binding method: GET, POST, SOAP-RPC or 
SOAP-DOC -->
               <!-- 3) Optionally, name of the session to the remote 
service, which allows scoping and grouping between different sitemap 
sections. -->
               <map:parameter name="wsproxy-method" value="GET"/>
               <map:parameter name="wsproxy-session" 
value="myAmazonSession"/>
           </map:generate>

           <map:transform src="amazonform2html.xsl"/>
           <map:transform 
src="context://stylesheets/xmlform/xmlform2html.xsl"/>
           <map:serialize type="html"/>
         </map:act>
       </map:match>
     </map:pipeline>


AmazonForm.xml:
---------------

<?xml version="1.0" ?>
<document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
   <xf:form id="form-amazon" view="search" 
action="amazon/search?t=myAmazonId-02-20&l=st1&mode=books&p=102&o=1&f=xml">
     <xf:caption>Amazon book search by keyword</xf:caption>
     <xf:textbox ref="search">
         <xf:caption>Keywords</xf:caption>
     </xf:textbox>
     <xf:submit id="submit" class="button">
       <xf:caption>Submit</xf:caption>
     </xf:submit>
   </xf:form>
</document>


------------------------------------------------------------------------
Example II: Even more interesting.
Integration with an interactive web service - the Cocoon FeedBack Wizard.
Notice that it is actually simpler to integrate with an interactive 
service then a "single call" based one, because WebServiceProxy supports 
sessions as well !
------------------------------------------------------------------------

     <map:pipeline>
       <map:match pattern="RemoteWizard/*">
         <map:generate 
src="http://remotehost:8080/cocoon/samples/xmlform/{1}">
           <map:generate src="http://rcm.amazon.com/e/cm{1}">
               <map:parameter name="wsproxy-method" value="POST"/>
               <map:parameter name="wsproxy-session" 
value="myFeedbackWizardSession"/>
           </map:generate>
           <map:transform src="myNewStyle-wizard2html.xsl"/>
           <map:transform 
src="context://stylesheets/xmlform/xmlform2html.xsl"/>
           <map:serialize type="html"/>
         </map:act>
       </map:match>
     </map:pipeline>



------------------------------------------------------------------------
End of file
------------------------------------------------------------------------


-- 

-= Ivelin =-


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


RE: [RT] WebServicesProxy Generator

Posted by Per Kreipke <pe...@onclave.com>.
Ivelin,

> Currently the proxy only supports HTTP GET binding.
> I have not found time to implement XML-RPC and SOAP proxying,
> although it should be relatively easy using Axis' client libraries.
> If you are interested, feel free to help.

Thanks for the feedback. I ended up wrapping SOAP with XSP code but will
revisit when I get a little time.

Per

> > Ivelin,
> >
> > In the javadocs for this generator, the Axis connection is 'TBD'.
> >
> > I'm wondering if it currently would allow me to proxy Axis web services
> > running on the same machine. E.g. I would like the SOAP request to go
> > through C2 to get config info and other authentication and state info
> before
> > calling Axis to serve the request.
> >
> > Can it do that?
> >
> > Per
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>


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


Re: [RT] WebServicesProxy Generator

Posted by Ivelin Ivanov <iv...@apache.org>.
Currently the proxy only supports HTTP GET binding.
I have not found time to implement XML-RPC and SOAP proxying,
although it should be relatively easy using Axis' client libraries.
If you are interested, feel free to help.

Ivelin

----- Original Message -----
From: "Per Kreipke" <pe...@onclave.com>
To: <co...@xml.apache.org>
Sent: Wednesday, August 21, 2002 1:27 PM
Subject: RE: [RT] WebServicesProxy Generator


> Ivelin,
>
> In the javadocs for this generator, the Axis connection is 'TBD'.
>
> I'm wondering if it currently would allow me to proxy Axis web services
> running on the same machine. E.g. I would like the SOAP request to go
> through C2 to get config info and other authentication and state info
before
> calling Axis to serve the request.
>
> Can it do that?
>
> Per
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>


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


RE: [RT] WebServicesProxy Generator

Posted by Per Kreipke <pe...@onclave.com>.
Ivelin,

In the javadocs for this generator, the Axis connection is 'TBD'.

I'm wondering if it currently would allow me to proxy Axis web services
running on the same machine. E.g. I would like the SOAP request to go
through C2 to get config info and other authentication and state info before
calling Axis to serve the request.

Can it do that?

Per


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


Re: [RT] WebServicesProxy Generator

Posted by Ivelin Ivanov <iv...@apache.org>.
Andy, I encourage your work, but ICE is way beyond the scope of my 
simple generator.


Ivelin


Andy Lewis wrote:
> How about ICE?
> 
> I've got a Cocoon-friendly ICE 1.1 effort underway. If I get it working.....(amidst the myriad of
> other things going on)
> Besides ICE 2.0 is beingrefactored for SOAP integration...so it would be a shame to miss out on
> that....
> 
>>Following is an initial draft of a new component I am starting to work on.
>>
>>Fire and Ice welcome ;)
>>
>>
>>------------------------------------------------------------------------
>>
>>The WebServiceProxy Cocoon generator is intended to:
>>
>>1) Allow easy syndication of dynamic content as a natural extension of  the currently popular
>>static content syndication with RSS.
>>
>>2) Allow transparent routing of web service request through GET, POST,  SOAP-RPC and SOAP-DOC
>>binding methods.
>>
>>3) Allow almost full control through sitemap configuration.
>>
>>4) Allow use of Cocoon components for content formatting, aggregation  and styling through a
>>tight integration with the Cocoon sitemap.
>>
>>5) Require 0 (zero) lines of Java or other business logic code in most  cases.
>>
>>6) Be generic and flexible enough to allow custom extensions for
>>advanced and non-typical uses.
>>
>>7) Support sessions, authentication, http 1.1, https,  request
>>manipulation, redirects following, connection pooling, and others.
>>
>>8) Use the Jakarta HttpClient library which provides many sophisticated  features for HTTP
>>connections.
>>
>>
>>
>>------------------------------------------------------------------------ Example I: Integration
>>of the Amazon book search service in a Cocoon portal:
>>------------------------------------------------------------------------
>>
>>pipeline:
>>---------
>>
>>    <map:pipeline>
>>      <map:match pattern="amazon/searchform">
>>          <map:generate src="AmazonForm.xml"/>
>>          <map:transform src="AmazonForm2html.xsl"/>
>>          <map:transform
>>src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>>          <map:serialize type="html"/>
>>        </map:act>
>>      </map:match>
>>
>>      <map:match pattern="amazon/search*">
>>
>>          <map:generate src="http://rcm.amazon.com/e/cm{1}">
>>              <!-- The WebSericeProxy generator takes 3 arguments: --> <!-- 1) The URL of the
>>              targeted web service -->
>>              <!-- 2) The binding method: GET, POST, SOAP-RPC or
>>SOAP-DOC -->
>>              <!-- 3) Optionally, name of the session to the remote
>>service, which allows scoping and grouping between different sitemap  sections. -->
>>              <map:parameter name="wsproxy-method" value="GET"/>
>>              <map:parameter name="wsproxy-session"
>>value="myAmazonSession"/>
>>          </map:generate>
>>
>>          <map:transform src="amazonform2html.xsl"/>
>>          <map:transform
>>src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>>          <map:serialize type="html"/>
>>        </map:act>
>>      </map:match>
>>    </map:pipeline>
>>
>>
>>AmazonForm.xml:
>>---------------
>>
>><?xml version="1.0" ?>
>><document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
>>  <xf:form id="form-amazon" view="search"
>>action="amazon/search?t=myAmazonId-02-20&l=st1&mode=books&p=102&o=1&f=xml">
>>    <xf:caption>Amazon book search by keyword</xf:caption>
>>    <xf:textbox ref="search">
>>        <xf:caption>Keywords</xf:caption>
>>    </xf:textbox>
>>    <xf:submit id="submit" class="button">
>>      <xf:caption>Submit</xf:caption>
>>    </xf:submit>
>>  </xf:form>
>></document>
>>
>>
>>------------------------------------------------------------------------ Example II: Even more
>>interesting.
>>Integration with an interactive web service - the Cocoon FeedBack Wizard. Notice that it is
>>actually simpler to integrate with an interactive  service then a "single call" based one,
>>because WebServiceProxy supports  sessions as well !
>>------------------------------------------------------------------------
>>
>>    <map:pipeline>
>>      <map:match pattern="RemoteWizard/*">
>>        <map:generate
>>src="http://remotehost:8080/cocoon/samples/xmlform/{1}">
>>          <map:generate src="http://rcm.amazon.com/e/cm{1}">
>>              <map:parameter name="wsproxy-method" value="POST"/> <map:parameter
>>              name="wsproxy-session"
>>value="myFeedbackWizardSession"/>
>>          </map:generate>
>>          <map:transform src="myNewStyle-wizard2html.xsl"/>
>>          <map:transform
>>src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>>          <map:serialize type="html"/>
>>        </map:act>
>>      </map:match>
>>    </map:pipeline>
>>
>>
>>
>>------------------------------------------------------------------------ End of file
>>------------------------------------------------------------------------
>>
>>
>>--
>>
>>-= Ivelin =-
>>
>>
>>--------------------------------------------------------------------- To unsubscribe, e-mail:
>>cocoon-dev-unsubscribe@xml.apache.org
>>For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 
> 



-- 

-= Ivelin =-


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


Re: [RT] WebServicesProxy Generator

Posted by Andy Lewis <aj...@ascii27.net>.
How about ICE?

I've got a Cocoon-friendly ICE 1.1 effort underway. If I get it working.....(amidst the myriad of
other things going on)
Besides ICE 2.0 is beingrefactored for SOAP integration...so it would be a shame to miss out on
that....
>
> Following is an initial draft of a new component I am starting to work on.
>
> Fire and Ice welcome ;)
>
>
> ------------------------------------------------------------------------
>
> The WebServiceProxy Cocoon generator is intended to:
>
> 1) Allow easy syndication of dynamic content as a natural extension of  the currently popular
> static content syndication with RSS.
>
> 2) Allow transparent routing of web service request through GET, POST,  SOAP-RPC and SOAP-DOC
> binding methods.
>
> 3) Allow almost full control through sitemap configuration.
>
> 4) Allow use of Cocoon components for content formatting, aggregation  and styling through a
> tight integration with the Cocoon sitemap.
>
> 5) Require 0 (zero) lines of Java or other business logic code in most  cases.
>
> 6) Be generic and flexible enough to allow custom extensions for
> advanced and non-typical uses.
>
> 7) Support sessions, authentication, http 1.1, https,  request
> manipulation, redirects following, connection pooling, and others.
>
> 8) Use the Jakarta HttpClient library which provides many sophisticated  features for HTTP
> connections.
>
>
>
> ------------------------------------------------------------------------ Example I: Integration
> of the Amazon book search service in a Cocoon portal:
> ------------------------------------------------------------------------
>
> pipeline:
> ---------
>
>     <map:pipeline>
>       <map:match pattern="amazon/searchform">
>           <map:generate src="AmazonForm.xml"/>
>           <map:transform src="AmazonForm2html.xsl"/>
>           <map:transform
> src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>           <map:serialize type="html"/>
>         </map:act>
>       </map:match>
>
>       <map:match pattern="amazon/search*">
>
>           <map:generate src="http://rcm.amazon.com/e/cm{1}">
>               <!-- The WebSericeProxy generator takes 3 arguments: --> <!-- 1) The URL of the
>               targeted web service -->
>               <!-- 2) The binding method: GET, POST, SOAP-RPC or
> SOAP-DOC -->
>               <!-- 3) Optionally, name of the session to the remote
> service, which allows scoping and grouping between different sitemap  sections. -->
>               <map:parameter name="wsproxy-method" value="GET"/>
>               <map:parameter name="wsproxy-session"
> value="myAmazonSession"/>
>           </map:generate>
>
>           <map:transform src="amazonform2html.xsl"/>
>           <map:transform
> src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>           <map:serialize type="html"/>
>         </map:act>
>       </map:match>
>     </map:pipeline>
>
>
> AmazonForm.xml:
> ---------------
>
> <?xml version="1.0" ?>
> <document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
>   <xf:form id="form-amazon" view="search"
> action="amazon/search?t=myAmazonId-02-20&l=st1&mode=books&p=102&o=1&f=xml">
>     <xf:caption>Amazon book search by keyword</xf:caption>
>     <xf:textbox ref="search">
>         <xf:caption>Keywords</xf:caption>
>     </xf:textbox>
>     <xf:submit id="submit" class="button">
>       <xf:caption>Submit</xf:caption>
>     </xf:submit>
>   </xf:form>
> </document>
>
>
> ------------------------------------------------------------------------ Example II: Even more
> interesting.
> Integration with an interactive web service - the Cocoon FeedBack Wizard. Notice that it is
> actually simpler to integrate with an interactive  service then a "single call" based one,
> because WebServiceProxy supports  sessions as well !
> ------------------------------------------------------------------------
>
>     <map:pipeline>
>       <map:match pattern="RemoteWizard/*">
>         <map:generate
> src="http://remotehost:8080/cocoon/samples/xmlform/{1}">
>           <map:generate src="http://rcm.amazon.com/e/cm{1}">
>               <map:parameter name="wsproxy-method" value="POST"/> <map:parameter
>               name="wsproxy-session"
> value="myFeedbackWizardSession"/>
>           </map:generate>
>           <map:transform src="myNewStyle-wizard2html.xsl"/>
>           <map:transform
> src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>           <map:serialize type="html"/>
>         </map:act>
>       </map:match>
>     </map:pipeline>
>
>
>
> ------------------------------------------------------------------------ End of file
> ------------------------------------------------------------------------
>
>
> --
>
> -= Ivelin =-
>
>
> --------------------------------------------------------------------- To unsubscribe, e-mail:
> cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org


-- 
"The heights of genius are only measurable by the depths of stupidity."



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


Re: [RT] WebServicesProxy Generator

Posted by Ivelin Ivanov <iv...@apache.org>.
Hi Matthew.



Matthew Langham wrote:
> Hi Ivelin,
> 
> I think a component like this is a natural addition to Cocoon and the
> portal. It's been talked about several times before and it's great to see
> you starting to work on it.
> 
> 
> Fire and Ice welcome ;)
> <<
> How can I select which parameters to pass to the Webservice? From your
> example it looks as though all the parameters are passed from the request to
> the service.


To be able to plug-in an interactive remote application, which was 
designed for http request/ xml response, like the feedback wizard,
you would want to require minimum effort for integration.
This is why I expect that in most cases a simple pass through proxy will 
do a fine job.

If you will need to manipulate the request stream, then you can extend 
the proxy generator and override the formatting methods.

Allowing too much flexibility through sitemap config parameters will 
obscure the main purpose of this component - transparent integration 
between portal applications.


> 
> Wouldn't it be better for the WebServicesProxy to be a transformer? That way
> it would be more flexible to build up the actual call and parameters using
> previous components in the pipeline, stylesheets etc. Also I could have
> multiple WSPtransformers in the pipeline to do multiple calls.



Initially I was thinking about a transformer as well.
Over the last few months, as I gained more experience with Cocoon,
I came to agree with something Stefano was preaching all along.
Sitemap is the place to handle metadata, not to process data.
Similarly transformers are the place to transform XML, not any data in 
general.

This is why I agree that the emailer for example should be an action or 
generator, not a transformer.

Of course this is all too vague, easy to talk about and hard to prove, 
but I cannot make a case for the opposite yet. Maybe you can help.

Once a generator the WebServiceProxy can be turned into a transformer,
although I have yet to learn who and when would like to have that.

> 
> Are you going to use Axis?

Didn't plan to initially, but you make me think about it.
I was simply going to implement an HTTP proxy using Jakarta HttpClient. 
Can you tell why I would want to use Axis?


Thanks for the feedback,

Ivelin


> 
> Matthew
> 
> --
> Open Source Group       Cocoon { Consulting, Training, Projects }
> =================================================================
> Matthew Langham, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
> Tel:+49-5251-1581-30  mlangham@s-und-n.de - http://www.s-und-n.de
> -----------------------------------------------------------------
> Cocoon book:
>   http://www.amazon.com/exec/obidos/ASIN/0735712352/needacake-20
> =================================================================
> 
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> The WebServiceProxy Cocoon generator is intended to:
> 
> 1) Allow easy syndication of dynamic content as a natural extension of
> the currently popular static content syndication with RSS.
> 
> 2) Allow transparent routing of web service request through GET, POST,
> SOAP-RPC and SOAP-DOC binding methods.
> 
> 3) Allow almost full control through sitemap configuration.
> 
> 4) Allow use of Cocoon components for content formatting, aggregation
> and styling through a tight integration with the Cocoon sitemap.
> 
> 5) Require 0 (zero) lines of Java or other business logic code in most
> cases.
> 
> 6) Be generic and flexible enough to allow custom extensions for
> advanced and non-typical uses.
> 
> 7) Support sessions, authentication, http 1.1, https,  request
> manipulation, redirects following, connection pooling, and others.
> 
> 8) Use the Jakarta HttpClient library which provides many sophisticated
> features for HTTP connections.
> 
> 
> 
> ------------------------------------------------------------------------
> Example I: Integration of the Amazon book search service in a Cocoon portal:
> ------------------------------------------------------------------------
> 
> pipeline:
> ---------
> 
>      <map:pipeline>
>        <map:match pattern="amazon/searchform">
>            <map:generate src="AmazonForm.xml"/>
>            <map:transform src="AmazonForm2html.xsl"/>
>            <map:transform
> src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>            <map:serialize type="html"/>
>          </map:act>
>        </map:match>
> 
>        <map:match pattern="amazon/search*">
> 
>            <map:generate src="http://rcm.amazon.com/e/cm{1}">
>                <!-- The WebSericeProxy generator takes 3 arguments: -->
>                <!-- 1) The URL of the targeted web service -->
>                <!-- 2) The binding method: GET, POST, SOAP-RPC or
> SOAP-DOC -->
>                <!-- 3) Optionally, name of the session to the remote
> service, which allows scoping and grouping between different sitemap
> sections. -->
>                <map:parameter name="wsproxy-method" value="GET"/>
>                <map:parameter name="wsproxy-session"
> value="myAmazonSession"/>
>            </map:generate>
> 
>            <map:transform src="amazonform2html.xsl"/>
>            <map:transform
> src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>            <map:serialize type="html"/>
>          </map:act>
>        </map:match>
>      </map:pipeline>
> 
> 
> AmazonForm.xml:
> ---------------
> 
> <?xml version="1.0" ?>
> <document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
>    <xf:form id="form-amazon" view="search"
> action="amazon/search?t=myAmazonId-02-20&l=st1&mode=books&p=102&o=1&f=xml">
>      <xf:caption>Amazon book search by keyword</xf:caption>
>      <xf:textbox ref="search">
>          <xf:caption>Keywords</xf:caption>
>      </xf:textbox>
>      <xf:submit id="submit" class="button">
>        <xf:caption>Submit</xf:caption>
>      </xf:submit>
>    </xf:form>
> </document>
> 
> 
> ------------------------------------------------------------------------
> Example II: Even more interesting.
> Integration with an interactive web service - the Cocoon FeedBack Wizard.
> Notice that it is actually simpler to integrate with an interactive
> service then a "single call" based one, because WebServiceProxy supports
> sessions as well !
> ------------------------------------------------------------------------
> 
>      <map:pipeline>
>        <map:match pattern="RemoteWizard/*">
>          <map:generate
> src="http://remotehost:8080/cocoon/samples/xmlform/{1}">
>            <map:generate src="http://rcm.amazon.com/e/cm{1}">
>                <map:parameter name="wsproxy-method" value="POST"/>
>                <map:parameter name="wsproxy-session"
> value="myFeedbackWizardSession"/>
>            </map:generate>
>            <map:transform src="myNewStyle-wizard2html.xsl"/>
>            <map:transform
> src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>            <map:serialize type="html"/>
>          </map:act>
>        </map:match>
>      </map:pipeline>
> 
> 
> 
> ------------------------------------------------------------------------
> End of file
> ------------------------------------------------------------------------
> 
> 
> --
> 
> -= Ivelin =-
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 



-- 

-= Ivelin =-


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


RE: [RT] WebServicesProxy Generator

Posted by Matthew Langham <ml...@s-und-n.de>.
Hi Ivelin,

I think a component like this is a natural addition to Cocoon and the
portal. It's been talked about several times before and it's great to see
you starting to work on it.

>>
Fire and Ice welcome ;)
<<
How can I select which parameters to pass to the Webservice? From your
example it looks as though all the parameters are passed from the request to
the service.

Wouldn't it be better for the WebServicesProxy to be a transformer? That way
it would be more flexible to build up the actual call and parameters using
previous components in the pipeline, stylesheets etc. Also I could have
multiple WSPtransformers in the pipeline to do multiple calls.

Are you going to use Axis?

Matthew

--
Open Source Group       Cocoon { Consulting, Training, Projects }
=================================================================
Matthew Langham, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
Tel:+49-5251-1581-30  mlangham@s-und-n.de - http://www.s-und-n.de
-----------------------------------------------------------------
Cocoon book:
  http://www.amazon.com/exec/obidos/ASIN/0735712352/needacake-20
=================================================================







------------------------------------------------------------------------

The WebServiceProxy Cocoon generator is intended to:

1) Allow easy syndication of dynamic content as a natural extension of
the currently popular static content syndication with RSS.

2) Allow transparent routing of web service request through GET, POST,
SOAP-RPC and SOAP-DOC binding methods.

3) Allow almost full control through sitemap configuration.

4) Allow use of Cocoon components for content formatting, aggregation
and styling through a tight integration with the Cocoon sitemap.

5) Require 0 (zero) lines of Java or other business logic code in most
cases.

6) Be generic and flexible enough to allow custom extensions for
advanced and non-typical uses.

7) Support sessions, authentication, http 1.1, https,  request
manipulation, redirects following, connection pooling, and others.

8) Use the Jakarta HttpClient library which provides many sophisticated
features for HTTP connections.



------------------------------------------------------------------------
Example I: Integration of the Amazon book search service in a Cocoon portal:
------------------------------------------------------------------------

pipeline:
---------

     <map:pipeline>
       <map:match pattern="amazon/searchform">
           <map:generate src="AmazonForm.xml"/>
           <map:transform src="AmazonForm2html.xsl"/>
           <map:transform
src="context://stylesheets/xmlform/xmlform2html.xsl"/>
           <map:serialize type="html"/>
         </map:act>
       </map:match>

       <map:match pattern="amazon/search*">

           <map:generate src="http://rcm.amazon.com/e/cm{1}">
               <!-- The WebSericeProxy generator takes 3 arguments: -->
               <!-- 1) The URL of the targeted web service -->
               <!-- 2) The binding method: GET, POST, SOAP-RPC or
SOAP-DOC -->
               <!-- 3) Optionally, name of the session to the remote
service, which allows scoping and grouping between different sitemap
sections. -->
               <map:parameter name="wsproxy-method" value="GET"/>
               <map:parameter name="wsproxy-session"
value="myAmazonSession"/>
           </map:generate>

           <map:transform src="amazonform2html.xsl"/>
           <map:transform
src="context://stylesheets/xmlform/xmlform2html.xsl"/>
           <map:serialize type="html"/>
         </map:act>
       </map:match>
     </map:pipeline>


AmazonForm.xml:
---------------

<?xml version="1.0" ?>
<document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
   <xf:form id="form-amazon" view="search"
action="amazon/search?t=myAmazonId-02-20&l=st1&mode=books&p=102&o=1&f=xml">
     <xf:caption>Amazon book search by keyword</xf:caption>
     <xf:textbox ref="search">
         <xf:caption>Keywords</xf:caption>
     </xf:textbox>
     <xf:submit id="submit" class="button">
       <xf:caption>Submit</xf:caption>
     </xf:submit>
   </xf:form>
</document>


------------------------------------------------------------------------
Example II: Even more interesting.
Integration with an interactive web service - the Cocoon FeedBack Wizard.
Notice that it is actually simpler to integrate with an interactive
service then a "single call" based one, because WebServiceProxy supports
sessions as well !
------------------------------------------------------------------------

     <map:pipeline>
       <map:match pattern="RemoteWizard/*">
         <map:generate
src="http://remotehost:8080/cocoon/samples/xmlform/{1}">
           <map:generate src="http://rcm.amazon.com/e/cm{1}">
               <map:parameter name="wsproxy-method" value="POST"/>
               <map:parameter name="wsproxy-session"
value="myFeedbackWizardSession"/>
           </map:generate>
           <map:transform src="myNewStyle-wizard2html.xsl"/>
           <map:transform
src="context://stylesheets/xmlform/xmlform2html.xsl"/>
           <map:serialize type="html"/>
         </map:act>
       </map:match>
     </map:pipeline>



------------------------------------------------------------------------
End of file
------------------------------------------------------------------------


--

-= Ivelin =-


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


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