# Readme.html Sample

This topic inludes the source code for the Readme.html Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/ProxyClient/mazegen/

## Sample Source Code

    <html>

    <head>
    <title>WebLogic Workshop Web Service Client Proxy Examples</title>
    <style type="text/css">h1, h2, h3, h4, p, li, blockquote { font-family: Verdana, Arial, Helvetica, sans-serif; margin-left: 0px }
    p, li        { font-size: 12 }
    blockquote   { font-size: 12 }
    blockquote   { margin-left: 1em }
    ul           { list-style-type: square }
    </style>
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    </head>

    <body>

    <h1>WebLogic Workshop Web Service Java Client Proxy Examples</h1>
    <h2>Introduction</h2>
    <p>The samples in this project demonstrate how to call the proxy for a WebLogic
    Workshop web service from a Java client. Two sample clients are provided in this
    project: a standalone Java console application and a Swing application. A third
    example demonstrates a JSP client using the web service proxy; that sample is
    available in the WebApp project in the SamplesApp application, in
    /WebApp/jspProxyClient/mazegen.</p>
    <p>The sample web service, MazeGenerator.jws, is available in the SamplesApp
    application in /WebServices/proxy/mazegen/. This is the web service that was
    used to generate the proxy classes called by the client applications. The web
    service exposes two operations. Each accepts two integers as parameters
    representing the desired number of rows and columns in a randomly generated
    maze. getRandomMaze returns the maze as an array of integers that encode the
    walls present in each cell of the maze. printRandomMaze returns a &quot;text
    graphics&quot; representation of the maze.</p>
    <p>The samples access the web service through the web service proxy. The proxy
    for any given Workshop web service is available from that service's Test View on
    the Overview Page. The proxy comes as a web service-specific JAR file containing
    proxy classes. To use the proxy, you also need the generic webserviceclient.jar
    that is also available from Test View.</p>
    <p>These examples require use of <b>ant</b>. ant is delivered with WLS and can
    be found in BEA_HOME/weblogic81/server/bin. Please make sure that directory is
    on your system path.</p>
    <h2>Contents</h2>
    <blockquote>
      <p>java_client/</p>
      <blockquote>
        <b>build.xml</b>: ant script that compiles the MazeClient standalone Java
        console client.<br>
        <b>MazeClient.java</b>: Standalone Java client of MazeGenerator web service,
        uses MazeGenerator proxy class.<br>
        <b>run.bat</b> | <b>run.sh</b>: Script that runs the client.
      </blockquote>
    </blockquote>
    <blockquote>
      <p>swing_client/</p>
      <blockquote>
        <b>build.xml</b>: ant script that compiles and runs <tt>MazeGUIClient</tt>.<br>
        <b>MazeGUIClient.java</b>: a rudimentary Swing app that uses the
        MazeGenerator web service via the proxy to specify maze parameters and
        display the resulting text maze. This client will be updated to display the
        maze graphically.<br>
      </blockquote>
      <p>JSP Clients</p>
      <blockquote>
        Two JSP clients are available at SamplesApp/WebApp/handlingData/traditional_vs_pageFlow_webApp/<br>
      </blockquote>
    </blockquote>
    <h2>Instructions</h2>
    <h3>The Standalone Java Client</h3>
    <ol>
      <li>In a cmd shell, cd to <tt>BEA_HOME/weblogic81/samples/workshop/SamplesApp/ProxyClient/mazegen/java_client</tt>.</li>
      <li>Run <b><tt>ant compile</tt></b> to compile the Java client. (<b>ant</b>
        must be on your PATH; <b>ant</b> can be found in BEA_HOME/weblogic81/server/bin)</li>
      <li>There is a <b><tt>run.bat</tt></b> (Windows) or <b><tt>run.sh</tt></b>
        (Linux/Unix) script to run the Java client. It relies on WL_HOME being set
        to BEA_HOME\weblogic81 on Windows and BEA_HOME/weblogic81 on
        Linux/Unix. Type <tt>run</tt> to run the client.</li>
      <li>Enter integers for rows and columns.</li>
    </ol>
    <p>You should see the maze printed as text.</p>
    <p>The program will loop until you enter an invalid value (blank line or
    non-numeric input) for the number of rows; then it will exit with an
    exception.</p>
    <h3>The Swing Client</h3>
    <ol>
      <li>In a cmd shell, cd to <tt>BEA_HOME/weblogic81/samples/workshop/SamplesApp/ProxyClient/mazegen/swing_client</tt>.</li>
      <li>Run <b><tt>ant run</tt></b> to compile and run the Swing client.</li>
      <li>Enter integers for rows and columns.</li>
      <li>Press the &quot;Generate Maze&quot; button.</li>
    </ol>
    <p>You should see the maze printed as text in the large text area.</p>
    </body>
    </html>