home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / getquote2.xsp < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  3.4 KB  |  88 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17.  
  18. <!--
  19.   Author: Ovidiu Predescu "ovidiu@cup.hp.com"
  20.   Date: October 9, 2001
  21.   CVS $Id: getquote2.xsp,v 1.2 2004/04/05 12:25:33 antonio Exp $
  22.  -->
  23.  
  24. <xsp:page language="java"
  25.           xmlns:xsp="http://apache.org/xsp"
  26.           xmlns:xsp-request="http://apache.org/xsp/request/2.0"
  27.           xmlns:xscript="http://apache.org/xsp/xscript/1.0"
  28.           xmlns:soap="http://apache.org/xsp/soap/3.0">
  29.  
  30.   <page>
  31.     <title>SOAP Stock Quote Example 2</title>
  32.  
  33.     <content>
  34.       <xsp:logic>
  35.         String symbol = request.getParameter("symbol");
  36.         if (symbol == null || symbol.equals("")) {
  37.           <para>This page demonstrates the SOAP logicsheet for
  38.           Cocoon2. It accesses a SOAP service that provides stock quotes
  39.           and displays the result.</para>
  40.  
  41.           <para>This example uses an inline XSLT stylesheet and an
  42.           XScript <code>transform</code> instruction to extract the stock
  43.           price. Compare this with the approach used in
  44.           <code>soap-getquote1.xsp</code>, which uses a sitemap XSLT
  45.           transformer to achieve the same thing.</para>
  46.  
  47.           <para>Please enter the stock ticker: </para>
  48.           <form href="soap-getquote">
  49.             <input name="symbol" type="text" value="HPQ"/>
  50.             <input value="Do it!" type="submit"/>
  51.           </form>
  52.         } else {
  53.           <para>The stock price for <xsp:expr>symbol</xsp:expr> is 
  54.             <xscript:variable name="soap-result">
  55.               <soap:call url="http://services.xmethods.net:80/soap">
  56.                 <ns1:getQuote xmlns:ns1="urn:xmethods-delayed-quotes">
  57.                   <soap:enc/>
  58.                   <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>
  59.                 </ns1:getQuote>
  60.               </soap:call>
  61.             </xscript:variable>
  62.  
  63.             <xscript:variable name="stylesheet">
  64.               <xsl:stylesheet version="1.0"
  65.                               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  66.                               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  67.                               xmlns:n="urn:xmethods-delayed-quotes"
  68.                               exclude-result-prefixes="soap n">
  69.                 <xsl:template match="/">
  70.                   <b>
  71.                     <xsl:value-of select="/soap:Envelope/soap:Body/n:getQuoteResponse/Result"/>
  72.                   </b>
  73.                 </xsl:template>
  74.               </xsl:stylesheet>
  75.             </xscript:variable>
  76.  
  77.             <xscript:transform name="soap-result" stylesheet="stylesheet"/>
  78.           </para>
  79.  
  80.           <form href="soap-getquote">
  81.             <input value="Back" type="submit"/>
  82.           </form>
  83.         }
  84.       </xsp:logic>
  85.     </content>
  86.   </page>
  87. </xsp:page>
  88.