The toolkit provides the BTTServiceRequester super class for you to extend when creating your own service requesters. The BTTServiceRequester super class has predefined methods for creating service requester instances using the information in resource bundles, and accessing service holders through local Java(TM) call, remote EJB call, and WSIF. See the Javadoc of the BTTServiceRequester for details about the predefined methods in this super class.
The following is a sample of a service requester. The method processRequest passes the service ID (addCounter) and other necessary parameters (those stored in the hash table) to the corresponding service object. The service requester sends the request to the service object through the invocation type defined in the service requester resource bundle file.
public class SampleServiceRequester extends BTTServiceRequester { /** * Add value to the counter. * @param inc. An integer to increase the counter. * @throws Exception * @return A string to present the counter's value */ public String addCounter(int inc) throws Exception { java.util.Hashtable paras = new java.util.Hashtable(1); Hashtable datah = new Hashtable(); datah.put("inc", String.valueOf(inc)); paras.put("inc", (java.util.Hashtable)datah); Object result = processRequest("addCounter", paras); return result.toString(); } }