Author: reinhard
Date: Mon Oct 11 03:33:06 2004
New Revision: 54550
Added:
cocoon/trunk/src/blocks/scratchpad/samples/flow-webservices/flowWebServices.js
cocoon/trunk/src/blocks/scratchpad/samples/flow-webservices/output.jx
cocoon/trunk/src/blocks/scratchpad/samples/flow-webservices/sitemap.xmap
Modified:
cocoon/trunk/status.xml
Log:
apply patch 31359 by Adam Ratclif
Added:
cocoon/trunk/src/blocks/scratchpad/samples/flow-webservices/flowWebServices.js
==============================================================================
--- (empty file)
+++
cocoon/trunk/src/blocks/scratchpad/samples/flow-webservices/flowWebServices.js
Mon Oct 11 03:33:06 2004
@@ -0,0 +1,60 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+importClass(Packages.org.apache.cocoon.components.flow.ws.WebServiceLoader);
+
+/*
+ * Remote service returns an xsd string that is mapped to a Javascript string.
+ */
+function randomQuoteWebService() {
+ var loader = null;
+ var msg;
+ var value;
+ try {
+ loader = cocoon.createObject(WebServiceLoader);
+ var randomQuoteService =
loader.load("http://www.boyzoid.com/comp/randomQuote.cfc?wsdl");
+ var quote = randomQuoteService.getQuote(false);
+ msg = "Random quote: ";
+ value = quote;
+ } catch(e) {
+ msg = "Error invoking web service: " + e.name + ": " + e.message;
+ cocoon.log.error(msg, e);
+ } finally {
+ cocoon.disposeObject(loader);
+ }
+ cocoon.sendPage("page/output", {msg:msg, value:value});
+}
+
+/*
+ * Remote service returns an xsd complex type that is mapped to a Javascript
object.
+ */
+function mortgageIndexWebService() {
+ var loader = null;
+ var msg;
+ var value;
+ try {
+ loader = cocoon.createObject(WebServiceLoader);
+ var mortgageService =
loader.load("http://www.webservicex.net/MortgageIndex.asmx?WSDL",
"MortgageIndex", "MortgageIndexSoap");
+ var monthlyIndex = mortgageService.getCurrentMortgageIndexMonthly();
+ msg = "Monthly index date: ";
+ value = monthlyIndex.indexDate;
+ } catch(e) {
+ msg = "Error invoking web service: " + e.name + ": " + e.message;
+ cocoon.log.error(msg, e);
+ } finally {
+ cocoon.disposeObject(loader);
+ }
+ cocoon.sendPage("page/output", {msg:msg, value:value});
+}
Added: cocoon/trunk/src/blocks/scratchpad/samples/flow-webservices/output.jx
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/scratchpad/samples/flow-webservices/output.jx
Mon Oct 11 03:33:06 2004
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<page>
+ <title>Webservices from within Flowscript</title>
+ <content>
+ <para>${msg}${value}</para>
+ </content>
+</page>
Added: cocoon/trunk/src/blocks/scratchpad/samples/flow-webservices/sitemap.xmap
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/scratchpad/samples/flow-webservices/sitemap.xmap
Mon Oct 11 03:33:06 2004
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+ <!-- =========================== Views ===================================
-->
+ <map:views>
+ <map:view from-label="content" name="content">
+ <map:serialize type="xml"/>
+ </map:view>
+ <map:view from-label="content" name="pretty-content">
+ <map:transform src="context://stylesheets/system/xml2html.xslt"/>
+ <map:serialize type="html"/>
+ </map:view>
+ <map:view from-position="last" name="links">
+ <map:serialize type="links"/>
+ </map:view>
+ </map:views>
+ <!-- indicates what flowscript to attach to this sitemap -->
+ <map:flow language="javascript">
+ <map:script src="flowWebServices.js"/>
+ </map:flow>
+ <map:pipelines>
+ <map:pipeline>
+ <!--+
+ | produces the screens called by the flowscript
+ +-->
+ <map:match pattern="page/*">
+ <map:generate type="jx" src="{1}.jx"/>
+ <map:transform
src="context://samples/common/style/xsl/html/simple-page2html.xsl">
+ <map:parameter name="servletPath" value="{request:servletPath}"/>
+ <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
+ <map:parameter name="contextPath" value="{request:contextPath}"/>
+ <map:parameter name="remove" value="{0}"/>
+ </map:transform>
+ <map:serialize/>
+ </map:match>
+ </map:pipeline>
+ <map:pipeline>
+ <map:match pattern="*">
+ <map:call function="{1}"/>
+ </map:match>
+ </map:pipeline>
+ </map:pipelines>
+</map:sitemap>
Modified: cocoon/trunk/status.xml
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Mon Oct 11 03:33:06 2004
@@ -205,6 +205,9 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="RP" type="add" due-to="Adam Ratclif" fixes-bug="31359">
+ Apply patch: Add support for calling webservices from within Flowscript.
+ </action>
<action dev="TC" type="fix" fixes-bug="31545">
Throw a more meaningful exception if charset classes are missing
</action>