DZone ForumsDZone Forums  

Go Back   DZone Forums > Community > Languages & Frameworks > Ajax & Javascript
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
LinkBack Thread Tools Display Modes

Topic: JSON RPC Rookie here... cant get this code working
Old 05-13-2008, 11:36 PM   #1 (permalink)
Member
 
Join Date: May 2008
Posts: 1
First, thank you for taking a look at this. If you have a suggestion as to another place that I should be asking these questions, please just let me know.

===

Hi. I'm brand new here - and new to a lot of ways to web programming. I have done some basic html, vbscript, javascript, database stuff... but I'm learning by the "see what doesn't work" method for the most part. My latest interest has to do with JSON RPC. I've received an API key from a service provider that sends reminder SMS messages... and I'm trying to get a javascript together that will send a test message to my phone.

A couple of the facts herein have been changed to protect the innocent (and ignorant...namely, me).

Now, I have no idea if I've posted this in the right section..so if a moderator feels compelled to move this thread or to blast me to another planet, I'll understand...

Here is my little script... (In Firefox this comes back with a 'permission error' and in IE, it comes back with some sort of 'object' error...)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
</head>

<script language="JavaScript" type="text/JavaScript"></script>

<script src="jsolait.js"></script>

<script>

var serviceURL = "http://api.bunkerbunwarmer.com/RPC3";
var methods = [ "test1" ];

var jsonrpc = imprt("jsonrpc");
var service = new jsonrpc.ServiceProxy(serviceURL, methods);

var xmlspec = <?xml version="1.0"?>

</script>

<script src="xmlrpc.js"></script>

<script>

function test() {
try {
var myphn = document.getElementById('myphn').value;
var mymsg = document.getElementById('mymsg').value;
var mesg = new XMLRPCMessage("system.send");
mesg.addParameter(xmlspec);
mesg.addParameter("0g3deceg-1bd8-45a4-92e8-211c9f5a3039");
mesg.addParameter(myphn);
mesg.addParameter("2008-05-12 11:00:00");
mesg.addParameter(mymsg);
mesg.addParameter(6);
mesg.addParameter("");
document.getElementById('result').innerHTML =
"<PRE>" + service.test1(mesg) + "</PRE>";
} catch(e) {
alert(e);
}
return false;
}
</script>

<body>
<form action="" method="post" onSubmit="return test()">
<div id="result">
</div>
<p>
First Argument: <input id="myphn" />
</p>
<p>
Second Argument: <input id="mymsg"/>
</p>
<p>
<input type="submit" value="Do JSON-RPC call"/>
</p>
</form>
</body>
</html>



In the "form" above, I type my cell phone number into the field called "argument one" and in "argument two", I put the text I'd like to have sent to my phone number... but this stuff isn't working. Appreciate any and all help.
swoop80 is offline   Reply /w Quote -


Old 05-29-2008, 12:26 PM   #2 (permalink)
Member
 
Join Date: May 2008
Posts: 12
This is just a guess since I am just starting to look at JSON myself but it appears javascript does not understand that XMLRPCMessage function.
I was under the impression that it connects up to java (or whatever language you are using) somehow but as yet am still trying to sort that whole thing out.
If you figure out please post the solution.
__________________
Registry Cleaner Reviews
garvagh is offline   Reply /w Quote -


Thread Tools
Display Modes




All times are GMT -5. The time now is 08:09 PM.