The WebServiceProxyGenerator (WSPG) is a very simple concept to understand. Here's what it looks like when you use it in a sitemap:

<map:match pattern="/foo/bar">
  <map:generate type="wsproxy" src="http://www.server.com/asdf/endpoint">
    <map:parameter name="wsproxy-method" value="post"/>
  </map:generate>
  <map:transform src="stylesheets/endpoint2html.xsl"/>
  <map:serialize type="xhtml"/>
</map:match>

and here's a sample form that you can submit to cocoon:

<form method="post" action="http://localhost:8080/cocoon/foo/bar">
  <input type="hidden" name="mode" value="keyword"/>
  <input type="text" name="keywords"/>
</form>

When you submit this form to /foo/bar under Cocoon, the WSPG will proxy the POST parameters to the URL specified in the sitemap. The WSPG will also honor the wsproxy-method sitemap parameter, and use that method when submitting to the remote server.

Assuming that the remote server returns well-formed XML, the WSPG will take it, and send it to the next component in the pipeline. It's pretty simple.

See also:

WebServiceProxyGenerator (last edited 2009-09-20 23:41:38 by localhost)