96
STEP 2: Call RPC with HTTP Post
STEP 2: Call RPC with HTTP Post
STEP 2: Call RPC with HTTP Post
STEP 2: Call RPC with HTTP Post
Once you have the IP address, you are able to access the RPC server. Load the method and it's
parameters into a LoadVars() object as shown below, then make the call with sendAndLoad().
// Get WACI IP
RPCServerIP = [callerID, or whatever you used to get the IP address of the
WACI];
// Initialize Call & Response Tokens
WACI_Call = new LoadVars()
WACI_Response = new LoadVars()
// Set up RPC method and parameters you desire to call.
// Note that these are all URL-encoded strings.
// You may assign values based on buttons, text fields, constants, or
whatever else is appropriate for your page.
WACI_Call.method = “[Desired RPC Method]”;
WACI_Call.param1 = “[Parameter 1 for the Method]”;
WACI_Call.param2 = “[Parameter 2 for the Method]”;
WACI_Call.param3 = “[Parameter 3 for the Method]”;
[etc.]
// Call the RPC using HTTP Post
WACI_Call.sendAndLoad(“http://”+RPCS”/RPC”, WACI_Response, POST);
STEP 3: Response Tokens
STEP 3: Response Tokens
STEP 3: Response Tokens
STEP 3: Response Tokens
At this point, if you used the script template above, you may now examine, use, and/or display the
contents of:
WACI_Response.status
WACI_Response.faultCode
WACI_Response.response1
WACI_Response.response2
WACI_Response.response3
[etc.]
The response tokens, like methods and call tokens are all in the form of URL-encoded strings.