Client Connector
Username:  
Password:
  > Home
v User Guide
    > Introduction
    > Hello World
    > Flow Control
    > Function Calls
    > Authentication
    > Database access
    > Content Management
    v Remote Calling
       o It is BEE calling
       o Client Connector
       o Server Connector
    > Object-Oriented
    > Other Features
> Reference
> Portal Object
> Development Guide


Shortcuts
sys Class
debug Class
Intrinsic Conversions
>> User Guide >> Remote Calling >> Client Connector <=  =>      <  1  >  
Client Connector

A Client Connector is a hidden HTML construct on the client side.  It is invoked from a client script like "JavaScript".

There are some tricks to have both the client JavaScript and the server BEE Script work together.  Firstly, the BEE "call" command locates in the JavaScript scope and generates JavaScript codes to talk to the Client Connector.  Secondly, a "@" prefix is used to indicate a value being a JavaScript expression.

In the following example, the "call" command issues a call to /remotefunc/search.htm (a URL pointing to the service) via the Client Connector "srch".  The parameter "key" is arbitrary and will be passed to the remote function.  (You can have as many arbitrary parameters as you want as long as their names do not crash with the BEE commands, names such as "connector", "call", "tag", and "this".)

<script language="JavaScript">

 

function searchOnClick(fld)

{

   // In JavaScript, we need to use BEE Tag instead of BEE Statement.

   <beecall "http://myserver.com/ws/search.htm" connector="srch"

      key="@fld.value">

   // Arbitrary parameters (like "key") for the remote function allowed

   // "@" indicates that "fld.value" is a JavaScript expression.

}

 

// The callback function (named after the connector)

function srch(result, status, message)

{

   // The arguments (result, status and message) are returned

   // from the server function.

   // They are also available globally via connector_srch.result,

   // connector_srch.status and connector_srch.message.

   if (status > 0) alert(message);

   else myForm.myField.value = result['Name'];

}

 

...

</script>

...

<beeconnector "srch">

 

When the JavaScript function "searchOnClick" is called (e.g. when the visitor click on a button with onclick="searchOnClick(this)"), the BEE "call" command is invoked.  The value of the form entry (fld.value) is passed to the Connector "srch", which will pack the parameter "key" and send it to "/remotefunc/search.htm".

When the remote function (the one in /remotefunc/search.htm) returns with the result, status and message (as any normal BEE function would), the Client Connector will call the callback function and pass it the three variables.  (The callback function is a client script named after the connector unless overwritten by the "callback" parameter in the "call" command.)

Note: If the information is sensitive and SSL is required to protect the communication, you will need to specify in the "call" command, such as https://myserver.com/ws/search.htm.

 

Previous Page       Next Page

Accsoft Computer Technology Pty Ltd     ABN: 98 065 617 549
PO Box 892, Epping NSW 1710         Level 1, Epping Office Park, 242 Beecroft Rd, Epping NSW 2121, Australia
Tel: Sydney - (02)98691668     National - 1300-881668         Fax: (02)98691866
© Copyright 2003 Accsoft Computer Technology Pty Ltd