<?xml version="1.0" encoding="ISO-8859-1"?>

<!--
  Author: Ovidiu Predescu "ovidiu@cup.hp.com"

  Date: October 9, 2001
 -->

<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"
  xmlns:n="http://sdexpo.com/2002/cocoon"
  >
  
  <page>

   <title>Location Information from ZipCode</title>

   <content>

   <xsp:logic>
    String zipcode = request.getParameter("zipcode");

    if (zipcode == null || zipcode.equals("")) {

       <para>This example demonstrates the use of Cocoon to build a simple
       application that invokes Web Services to get information about a
       geographical location.</para>

       <para>Please enter a US zipcode: </para>
       <form href="zipcode-info">
         <input name="zipcode" type="text" value="95051"/>
         <input value="Get Info." type="submit"/>
       </form>
    }
    else {
      <soap:call url="http://alethea.net:80/webservices/LocalTime.asmx"
                 method="http://alethea.net/webservices/LocalTimeByZipCode">
        <LocalTimeByZipCode>
          <ZipCode 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="zipcode"/>
          </ZipCode>
        </LocalTimeByZipCode>
      </soap:call>

      <soap:call url="http://www.vbws.com:80/services/weatherretriever.asmx"
                 method="http://tempuri.org/GetWeather">
        <s0:GetWeather xmlns:s0="http://tempuri.org/">
          <zipCode 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="zipcode"/>
          </zipCode>
        </s0:GetWeather>
      </soap:call>

      <para>Information for <xsp:expr>zipcode</xsp:expr> location :</para>
      
      <para>Local Time : <n:local-time/> </para>
      <para>Weather Conditions ( updated at <n:weather-updatetime/> ): </para>
      <para>Current Temperature: <n:weather-temp/></para>
      <para>Current Humidity   : <n:weather-humidity/></para>
      <para>Current Barometer  : <n:weather-barometer/></para>
      <para>Barometer Direction: <n:weather-bdirection/></para>
      
      <form href="zipcode-info">
        <input value="Back" type="submit"/>
      </form>
    }
  </xsp:logic>

  </content>

  </page>
</xsp:page>
