Writing a Basic Client


Using BasicAPI

The Caucho Web server hosts a Burlap server designed around a simple interface called BasicAPI. This interface is designed to give new developers using Burlap a working test bed to become familiar with the code. The BasicAPI, which you can find at www.caucho.com/burlap/test/basic, fundamentally acts like a Web service by exposing various methods. Following is a list of the methods currently available. In this list we also indicate the interface exposed by the BasicAPI Web service hosted at Caucho.com; we describe each of the interface methods based on their purpose as well as the SML commands that are generated from the various interface methods; and we examine the SML commands in more detail later in this chapter.

  • Object echo(Object value)—Sends the method parameter to the server and waits for the server to return the parameter. This method illustrates the serialization of Java objects because the parameter to the method can be an object derived from java.lang.Object.

        echo(1)    <burlap:call>      <method>echo</method>      <int>1</int>    </burlap:call>    <burlap:reply>      <int>1</int>    </burlap:reply> 

  • void fault()—Causes an application fault to occur by throwing an exception.

        <burlap:call>         <method>fault</method>       </burlap:call>       <burlap:reply>         <fault>           <string>code</string>           <string>ServerException</string>           <string>message</string>           <string>test fault</string>           <string>detail</string>       <map>               <type>java.io.IOException</type>        <string>detailMessage</string>        <string>test fault</string>       </map>         </fault>        </burlap:reply> 

  • String hello()—Returns a String object with the value of "Hello, World".

        <burlap:call>        <method>hello</method>       </burlap:call>       <burlap:reply>         <value>           <string>Hello,world</string>         </value>       </burlap:reply> 

  • void nullCall()—No operation.

        <burlap:call>         <method>nullCall</method>       </burlap:call>       <burlap:reply>         <value>           <null></null>         </value>       </burlap:reply> 

  • int subtract(int, int)—Returns the result of subtracting the second parameter from the first. Example: subtract(15,15)

     <burlap:call>   <method>subtract</method>   <int>15</int>   <int>15</int> </burlap:call> <burlap:reply>   <value>    <int>0</int>   </value> </burlap:reply> 




Mastering Resin
Mastering Resin
ISBN: 0471431036
EAN: 2147483647
Year: 2002
Pages: 180

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net