File:  [mozdev] / certs / www / soap.js
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Fri Jun 14 05:13:42 2002 UTC (16 years, 9 months ago) by eric
Branches: MAIN
CVS tags: HEAD
no message

const soapVersion  = 0; // Version 1.1
const object = "uri:SnakeScore";
const transportURI = "http://localhost/SnakeService/SnakeService.asmx";

// SAVE PLAYER SCORE
 
function SaveScore()
{
  Score = "10"; //window.opener.document.getElementById("currentscore").getAttribute("value");
  PlayerName = document.getElementById("SaveCode").value;

  var method  = "SaveScore";
  var headers = new Array();
  var params  = new Array(new SOAPParameter(PlayerName,"PlayerName"),
  new SOAPParameter(Score,"Score"));
  var call = new SOAPCall();
  call.transportURI = transportURI;
  call.actionURI = object+"/"+method;

  call.encode(soapVersion,method,object,headers.length,headers,params.length,params);

  //DUMP
  //var r = new XMLSerializer().serializeToString(call.message);
  //document.getElementById("P").firstChild.nodeValue = r;
  var currentRequest = call.asyncInvoke(SaveScoreResponse);
}

function SaveScoreResponse(resp,call,status)
{
  SaveResult = resp.body.firstChild.firstChild.firstChild.data;
  document.getElementById("SaveResult").setAttribute("value",SaveResult);
}

// GET PLAYER SCORE

function GetScore(PlayerName,Score)
{
  var method  = "GetScore";
  var headers = new Array();
  var params  = new Array(new SOAPParameter(PlayerName,"PlayerName"));
  var call = new SOAPCall();
  call.transportURI = transportURI;
  call.actionURI = object+"/"+method;

  call.encode(soapVersion,method,object,headers.length,headers,params.length,params);

  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
  currentRequest = call.asyncInvoke(GetScoreResponse);
}

function GetScoreResponse(resp,call,status)
{
  alert(resp.body.firstChild.firstChild.firstChild.data);
}

// GET HIGH SCORES

function GetHighScores()
{
  var method  = "GetHighScores";
  var headers = new Array();
  var params  = new Array();
  var call = new SOAPCall();
  call.transportURI = transportURI;
  call.actionURI = object+"/"+method;

  call.encode(soapVersion,method,object,headers.length,headers,params.length,params);

  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
  currentRequest = call.asyncInvoke(GetScoreResponse);
}

function GetHighScoresResponse(resp,call,status)
{
  alert(resp.body.firstChild.firstChild.firstChild.data);
}


/* Non-working Response code.
  try {
    ret = resp.getParameters(false, new Array());
  }
  catch(e){
    alert(e);
  }
*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>