Need a web service connection to an existing REST based Web service Interface. In simple terms, connect to web service (documentation is online for this service) using JS, after user enters KEY in a simple web form, take the response from webservice which comes in XML, and store this to be used for the session. The values should be used as a variable to access rest of the site, primarily the KEY, local IP address etc.
The files required are JS, and the html page(s) to call the JS, and store the response and an a page to call the dynamically based on the response.
Ask the user for an access key
An access key will be six case-sensitive letters. No digits or symbols are used.
Lookup server addresses from access key
Call the web service (replace [Access Key] with the actual access key):
It is recommended that you use a short timeout.
Optionally wake computers
Loop the IP addresses returned and send a wake request to each MAC address returned. The details of creating magic packets for wake requests. For Java code, this might help: [login to view URL]
Try connecting to each IP address
Loop the IP addresses returned, and attempt to connect to: http://[Returned IP Address]:[Returned Port]/MCWS/v1/Alive
Be sure to loop the addresses in order so that you first attempt to connect on the LAN and only fallback to the WAN if necessary.
Use a short timeout, usually 2 to 5 seconds.
Parse the response and make sure the access key matches the access key entered by the user.
Also, check the library version and program version as necessary.
Call the web service function: MCWS/v1/Authenticate
Provide the saved username and password if you have one.
If authentication does not succeeed, ask the user for their username and password. Then repeat.
Store the token returned and include it in all future calls.
You can start using the web service at this point. Include the token in each call using &Token=[Token Received During Authentication].
Most all web service responses use the same XML response format. Create a single object to represent the response you can use for all calls.