home *** CD-ROM | disk | FTP | other *** search
- <?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.
- -->
-
- <!--
- Author: Ovidiu Predescu "ovidiu@cup.hp.com"
- Date: October 9, 2001
- CVS $Id: getquote2.xsp,v 1.2 2004/04/05 12:25:33 antonio Exp $
- -->
-
- <xsp:page language="java"
- xmlns:xsp="http://apache.org/xsp"
- xmlns:xsp-request="http://apache.org/xsp/request/2.0"
- xmlns:xscript="http://apache.org/xsp/xscript/1.0"
- xmlns:soap="http://apache.org/xsp/soap/3.0">
-
- <page>
- <title>SOAP Stock Quote Example 2</title>
-
- <content>
- <xsp:logic>
- String symbol = request.getParameter("symbol");
- if (symbol == null || symbol.equals("")) {
- <para>This page demonstrates the SOAP logicsheet for
- Cocoon2. It accesses a SOAP service that provides stock quotes
- and displays the result.</para>
-
- <para>This example uses an inline XSLT stylesheet and an
- XScript <code>transform</code> instruction to extract the stock
- price. Compare this with the approach used in
- <code>soap-getquote1.xsp</code>, which uses a sitemap XSLT
- transformer to achieve the same thing.</para>
-
- <para>Please enter the stock ticker: </para>
- <form href="soap-getquote">
- <input name="symbol" type="text" value="HPQ"/>
- <input value="Do it!" type="submit"/>
- </form>
- } else {
- <para>The stock price for <xsp:expr>symbol</xsp:expr> is
- <xscript:variable name="soap-result">
- <soap:call url="http://services.xmethods.net:80/soap">
- <ns1:getQuote xmlns:ns1="urn:xmethods-delayed-quotes">
- <soap:enc/>
- <symbol xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"><xsp-request:get-parameter name="symbol"/></symbol>
- </ns1:getQuote>
- </soap:call>
- </xscript:variable>
-
- <xscript:variable name="stylesheet">
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:n="urn:xmethods-delayed-quotes"
- exclude-result-prefixes="soap n">
- <xsl:template match="/">
- <b>
- <xsl:value-of select="/soap:Envelope/soap:Body/n:getQuoteResponse/Result"/>
- </b>
- </xsl:template>
- </xsl:stylesheet>
- </xscript:variable>
-
- <xscript:transform name="soap-result" stylesheet="stylesheet"/>
- </para>
-
- <form href="soap-getquote">
- <input value="Back" type="submit"/>
- </form>
- }
- </xsp:logic>
- </content>
- </page>
- </xsp:page>
-