Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

B2B XML Application: Step by Step , 18 of 32

## 1 Retailer Browses the Supplier's OnLine "Hi-Tech Mall" Catalog

See Figure 13-5 for the detailed procedural flow of the B2B XML application.

Note: We assume here that a copy of the Supplier's catalog is in the Retailer's database.

1. Check the StyleSheet utility to ensure it works by invoking`SS.bat`.

   Stylesheet Batch File: SS.bat

       @echo off
       @echo Stylesheet Util
       D:\jdev31\java\bin\java -mx50m -classpath "D:\xml817\references\olivier_new;
       D:\jdev31\lib\jdev-rt.zip;
       D:\jdev31\jdbc\lib\oracle8.1.6\classes111.zip;
       D:\jdev31\lib\connectionmanager.zip;
       D:\jdev31\lib;
       D:\jdev31\lib\oraclexsql.jar;
       D:\jdev31\lib\oraclexmlsql.jar;
       D:\jdev31\lib\xmlparserv2_2027.jar;
       D:\jdev31\jfc\lib\swingall.jar;
       D:\jdev31\jswdk-1.0.1\lib\servlet.jar;
       D:\Ora8i\rdbms\jlib\aqapi11.jar;
       D:\Ora8i\rdbms\jlib\aqapi.jar;
       D:\XMLWorkshop\xmlcomp.jar;
       D:\jdev31\java\lib\classes.zip"  B2BDemo.StyleSheetUtil.GUIStylesheet

   Using this utility you can browse the actual table, `Stylesheets`, in which the stylesheets are stored. These stylesheets are used by the AQ Broker-Transformer to process the documents it received. See Figure 13-7.

#### Figure 13-7 Checking the StyleSheet Utility

1. Start the Retailer application by running retailer.bat. See Figure 13-8.

#### Figure 13-8 Starting the Retailer Application

1. Start the AQ Broker-Transformer application by running broker.bat. See Figure 13-9.

#### Figure 13-9 Starting the AQ Broker-Transformer Application

1. Start the Supplier application by running supplier.bat. See Figure 13-10.

#### Figure 13-10 Starting the Supplier Application: "Supplier Watcher"

The three batch files for the Retailer, AQ Broker-Transformer (Broker), and Supplier applications are listed here:

retailer.bat

    @echo off
    @echo Retail Side
    D:\jdev31\java\bin\java -mx50m -classpath
    "D:\xml817\references\Ora817DevGuide;
    D:\jdev31\lib\jdev-rt.zip;
    D:\jdev31\jdbc\lib\oracle8.1.6\classes111.zip;
    D:\jdev31\lib\connectionmanager.zip;
    D:\jdev31\lib;
    D:\jdev31\lib\oraclexsql.jar;
    D:\jdev31\lib\oraclexmlsql.jar;
    D:\jdev31\lib\xmlparserv2_2027.jar;
    D:\jdev31\jfc\lib\swingall.jar;
    D:\jdev31\jswdk-1.0.1\lib\servlet.jar;
    D:\Ora8i\rdbms\jlib\aqapi11.jar;
    D:\Ora8i\rdbms\jlib\aqapi.jar;
    D:\XMLWorkshop\xmlcomp.jar;
    D:\jdev31\java\lib\classes.zip"  B2BDemo.Retailer.UpdateMaster -step=1000
    -verbose=y -dbURL=jdbc:oracle:thin:@atp-1.us.oracle.com:1521:ORCL

broker.bat

    @echo off
    @echo Broker
    D:\jdev31\java\bin\java -mx50m -classpath
    "D:\xml817\references\Ora817DevGuide;
    D:\jdev31\lib\jdev-rt.zip;
    D:\jdev31\jdbc\lib\oracle8.1.6\classes111.zip;
    D:\jdev31\lib\connectionmanager.zip;
    D:\jdev31\lib;D:\jdev31\lib\oraclexsql.jar;
    D:\jdev31\lib\oraclexmlsql.jar;
    D:\jdev31\lib\xmlparserv2_2027.jar;
    D:\jdev31\jfc\lib\swingall.jar;
    D:\jdev31\jswdk-1.0.1\lib\servlet.jar;
    D:\Ora8i\rdbms\jlib\aqapi11.jar;
    D:\Ora8i\rdbms\jlib\aqapi.jar;
    D:\XMLWorkshop\xmlcomp.jar;
    D:\jdev31\java\lib\classes.zip"  B2BDemo.Broker.MessageBroker -step=1000
    -verbose=y

supplier.bat

    @echo off
    @echo Supplier
    D:\jdev31\java\bin\java -mx50m -classpath
    "D:\xml817\references\Ora817DevGuide;
    D:\jdev31\lib\jdev-rt.zip;
    D:\jdev31\jdbc\lib\oracle8.1.6\classes111.zip;
    D:\jdev31\lib\connectionmanager.zip;
    D:\jdev31\lib;D:\jdev31\lib\oraclexsql.jar;
    D:\jdev31\lib\oraclexmlsql.jar;
    D:\jdev31\lib\xmlparserv2_2027.jar;
    D:\jdev31\jfc\lib\swingall.jar;
    D:\jdev31\jswdk-1.0.1\lib\servlet.jar;
    D:\Ora8i\rdbms\jlib\aqapi11.jar;
    D:\Ora8i\rdbms\jlib\aqapi.jar;
    D:\XMLWorkshop\xmlcomp.jar;
    D:\jdev31\java\lib\classes.zip"  B2BDemo.Supplier.SupplierWatcher -step=1000
    -verbose=y -dbURL=jdbc:oracle:thin:@atp-1.us.oracle.com:1521:ORCL

- Finally, start the Client, from a browser, a PDA such as Palm Pilot, cell phone, or other device.

- [Retailer] Log in. You will see a Welcome! screen. See Figure 13-11.

  ### XSQL Script Example 2: Checking the ID of Users Logging In: getlogged.xsql

      <?xml version="1.0"?>

      <!--
       | Second script to be called.
       | Check if the user in known in the database.
       | $Author: olediour@us $
       | $Revision: 1.1 $
       +-->
      <?xml-stylesheet type="text/xsl" media="HandHTTP"     href="PP.xsl"?>
      <?xml-stylesheet type="text/xsl" media="Mozilla"      href="HTML.xsl"?>

      <loginResult xmlns:xsql="urn:oracle-xsql"
                   connection="retail"
                   custName="XXX">
        <pageTitle>Hi-Tech Mall</pageTitle>
        <xsql:query tag-case="upper">
          <![CDATA[
          select C.ID, C.NAME
          from CUSTOMER C
          where Upper(C.NAME) = Upper('{@custName}')
          ]]>
          <xsql:no-rows-query>
            Select '{@custName}' as "unknown" from dual
          </xsql:no-rows-query>
        </xsql:query>
        <nextStep>inventory.xsql</nextStep>
        <returnHome>index.xsql</returnHome>

      </loginResult>

  This XSQL script calls the following XSL scripts:

  - pp.xsl. See "XSL Stylesheet Example 1: Converts Results to HTML -- html.xsl"

  - html.xsl. See "XSL Stylesheet Example 2: Converts Results for Palm Pilot Browser -- pp.xsl"

  #### Figure 13-11 [Retailer]: Logging in from a Browser or PDA

- [Retailer]: Click on 'Please Enter the Mall'.

  ### XSQL Script Example 1: Displays First Hi-Tech Mall Screen -- index.xsql

      <?xml version="1.0"?>

      <!--
       | This is the entry point in the application.
       | Notice that this script does not access the database.
       | $Author: olediour@us $
       | $Revision: 1.1 $
       +-->
      <?xml-stylesheet type="text/xsl" media="HandHTTP"     href="PP.xsl"?>
      <?xml-stylesheet type="text/xsl" media="Mozilla"      href="HTML.xsl"?>

      <index xmlns:xsql="urn:oracle-xsql">
        <pageTitle>Hi-Tech Mall</pageTitle>
        <form action="getLogged.xsql" method="post">
          <field type="text" name="custName" prompt="Your ID"/>
          <button type="submit" label="Log In"/>
        </form>
      </index>

- [Retailer]: The resulting screen displays the Hi-Tech Mall Catalog product listing. Click on the product you are interested in. See Figure 13-12.

  ### XSQL Script Example 3: Lists Catalog Products -- inventory.xsql

      <?xml version="1.0"?>

      <!--
       | This is the third script called.
       | It produces the catalog from the Retailer's database.
       |
       | $Author: olediour@us $
       | $Revision: 1.1 $
       +-->
      <?xml-stylesheet type="text/xsl" media="HandHTTP"     href="PP.xsl"?>
      <?xml-stylesheet type="text/xsl" media="Mozilla"      href="HTML.xsl"?>

      <inventory xmlns:xsql="urn:oracle-xsql"
                 connection="retail"
                 custId="000">
        <pageTitle>Hi-Tech Mall</pageTitle>
        <form action="order.xsql" method="post">
          <hiddenFields>
            <xsql:include-param name="custId"/>
          </hiddenFields>
          <theMart>
            <xsql:query tag-case="upper">
              <![CDATA[
              select I.ID,
                     I.DESCRIPTION,
                     I.PRICE,
                     S.NAME
              from INVENTORY_ITEM I,
                   SUPPLIER S
              where I.SUPPLIER_ID = S.ID
              ]]>
              <xsql:no-rows-query>
                Select 'No items !' as "Wow" from dual
              </xsql:no-rows-query>
            </xsql:query>
          </theMart>
        </form>
        <returnHome>index.xsql</returnHome>

      </inventory>

  #### Figure 13-12 [Retailer] Enter the Hi-Tech Mall (Mart) Catalog

- [Retailer]: Enter the quantity you need and click the "Place Order" button. See Figure 13-13.

  #### Figure 13-13 [Retailer]: Enter the Quantity and Click on "Place Order"

  1. [Retailer] Click "Go On", or "Give Up". See Figure 13-14.

  ### XSQL Script Example 4: Enter a Quantity -- order.xsql

      <?xml version="1.0"?>
      <!--
       | This is the fourth script called.
       | It prompts you to enter a quantity.
       |
       | $Author: olediour@us $
       | $Revision: 1.1 $
       +-->
      <?xml-stylesheet type="text/xsl" media="HandHTTP"     href="PP.xsl"?>
      <?xml-stylesheet type="text/xsl" media="Mozilla"      href="HTML.xsl"?>

      <order xmlns:xsql="urn:oracle-xsql"
             connection="retail"
             custId="000"
             prodId="000">
        <pageTitle>Hi-Tech Mall</pageTitle>
        <xsql:query tag-case      = "upper"
                    rowset-element= ""
                    row-element   = "cust">
          <![CDATA[
          select C.ID,
                 C.NAME
          from CUSTOMER C
          where C.ID = '{@custId}'
          ]]>
          <xsql:no-rows-query>
            Select '{@custId}' as "unknown" from dual
          </xsql:no-rows-query>
        </xsql:query>

        <xsql:query tag-case="upper"
              rowset-element=""
              row-element="prod">
          <![CDATA[
              select I.ID,
                     I.DESCRIPTION,
                     I.PRICE,
                     S.NAME
              from INVENTORY_ITEM I,
                   SUPPLIER S
              where I.SUPPLIER_ID = S.ID and
                    I.ID = '{@prodId}'
          ]]>
          <xsql:no-rows-query>
            Select '{@prodId}' as "unknown" from dual
          </xsql:no-rows-query>
        </xsql:query>

        <returnHome>index.xsql</returnHome>
      </order>

  #### Figure 13-14 [Retailer}: Click "Go On"

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index