Poll

XML-RPC or JSON-RPC?

XML-RPC
JSON-RPC
other, dunno, no opinion, etc

Author Topic: XML-RPC vs JSON-RPC  (Read 1352 times)

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
XML-RPC vs JSON-RPC
« on: August 20, 2011, 04:20:19 AM »
I'm preparing for Bigpoint integration and I have to choose between XML-RPC and JSON-RPC. So, which one (and why)?

http://en.wikipedia.org/wiki/XML-RPC
http://en.wikipedia.org/wiki/JSON-RPC

Offline gnoh

  • Game Owner
  • Level 15
  • *
  • Posts: 127
  • Reputation: +2/-0
    • View Profile
Re: XML-RPC vs JSON-RPC
« Reply #1 on: August 20, 2011, 04:58:47 AM »
Toss a coin...   I used xml-rpc but the json service wasn't available then, so luckily I didn't have to make a decision. :)

I do remember I had to warp a library due to a service end point definition on there part.

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: XML-RPC vs JSON-RPC
« Reply #2 on: August 20, 2011, 05:08:30 PM »
Me? I'd use JSON. XML is way too much fluff way too much extra data way too much waste. It was never really meant to hold any sort of data, just markup(or that's how I view it.) It'd be like asking "which format do I want to store my database in? xml(basically pure markup language) or JSON(key value store)." I'd always go key-value store over XML. It's how I'm doing client-side in the browser caching. It's pure JSON key-value stored with indexes to make lookups faster. I'll always prefer a JSON response over an XML response. Best of all is an SQL response, but I know that most people don't do that. For me dataformats are SQL(full RDMS)->JSON-like(any of the random nosql things out there)->XML->CSV

Offline jack13580

  • Level 7
  • *
  • Posts: 35
  • Reputation: +0/-0
    • View Profile
Re: XML-RPC vs JSON-RPC
« Reply #3 on: August 22, 2011, 07:56:08 PM »
ok here is a much better and easier way of doing this language thing

first you shoulod make it so people who want to translate must already have an account and if they do want to translate the website have a form where they select which language they want to translate to then if they did that have it so 2 new lnks apear for them an edit link that is next to options that gets the page they are on and they can edit the text on that page next the seconed link could be something that shows them how close they are to completing the translation based on the number of pages submited like lets say there are 10 pages and they submit 5 it would show 50% complete for them and when they reach 100% all pages submited they get an option on that page to submit it to you and if its good you could have an option to make it the main thing for the language choosen lets say spanish and they submitted it completely done to you for spanish and if you aprove it that one is now used for the spanish version when someone clicks the spanish flag

just an example and here is my own example i made

whatever.php
Code: [Select]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
*{
padding:0;
margin:0;
}
#container {
width: 100%;
text-align:center;
}
#header {
border-bottom:1px solid #000;
height:100px;
width: 100%;
text-align:center;

}
#nav {
border-bottom:1px solid #000;
width: 100%;
height:30px;
background-color: #d1c0a7;
}
#nav a {
color: blue;
text-decoration:none;
}
img {
border: none;
}
#left-side {
width: 11%;
border-right:1px solid #000;
float:left;
height:800px;
}
#right-side {
width: 11%;
border-left:1px solid #000;
float:right;
height:800px;
}
#body {
width:78%;
position:absolute;
left:150px;
}
#bottom {
clear:both;
border-top:1px solid #000;
background-color: #d1c0a7;
height:30px;
border-bottom:1px solid #000;
}
</style>
</head>
<body bgcolor="cyan">

<?php

$server 
"localhost";
$dbuser "root";
$dbpass "";
$database "database";

mysql_connect($server$dbuser$dbpass);
mysql_select_db($database)or die(mysql_error());

$sql "SELECT * FROM `head`";
$res mysql_query($sql) or die(mysql_error());
$row mysql_fetch_assoc($res);
$head $row['head'];

$sql2 "SELECT * FROM `navigation`";
$res2 mysql_query($sql2) or die(mysql_error());
$row2 mysql_fetch_assoc($res2);
$nav $row2['navigation'];

$sql3 "SELECT * FROM `left-side`";
$res3 mysql_query($sql3) or die(mysql_error());
$row3 mysql_fetch_assoc($res3);
$left_side $row3['left-side'];

$sql4 "SELECT * FROM `right-side`";
$res4 mysql_query($sql4) or die(mysql_error());
$row4 mysql_fetch_assoc($res4);
$right_side $row4['right-side'];

$sql5 "SELECT * FROM `body`";
$res5 mysql_query($sql5) or die(mysql_error());
$row5 mysql_fetch_assoc($res5);
$body $row5['body'];

$sql6 "SELECT * FROM `bottom`";
$res6 mysql_query($sql6) or die(mysql_error());
$row6 mysql_fetch_assoc($res6);
$bottom $row6['bottom'];

echo 
noslashes(bbcode(
"

 [container]
 [header]
$head
 [/header]
 [navigation]
$nav
 [/navigation]
 [left-side]
$left_side
 [/left-side]
 [right-side]
$right_side
 [/right-side]
 [body]
$body
 [/body]
 [bottom]
$bottom
 [/bottom]
 [/container]
"
));

function 
noslashes($input){//no slashes
return stripslashes($input);
}

function 
bbcode($input){//for obvious reasons
$search = array(
'/\[underline](.*?)\[\/underline]/is',
'/\[comment](.*?)\[\/comment]/is',
'/\[header](.*?)\[\/header]/is',
'/\[navigation](.*?)\[\/navigation]/is',
'/\[br]/is',
'/\[nav-link=(.*?)](.*?)\[\/nav-link]/is',
'/\[img=(.*?)](.*?)\[\/img]/is',
'/\[left-side](.*?)\[\/left-side]/is',
'/\[right-side](.*?)\[\/right-side]/is',
'/\[body](.*?)\[\/body]/is',
'/\[bottom](.*?)\[\/bottom]/is',
'/\[container](.*?)\[\/container]/is'
);

$replace = array(
'<font style="text-decoration: underline;">$1</font>',
'<!-- $1 -->',
'<div id="header">$1</div>',
'<div id="nav">$1</div>',
'<br />',
'<a href="$1">$2</a> ',
'<img src="$1" title="$2" />',
'<div id="left-side">$1</div>',
'<div id="right-side">$1</div>',
'<div id="body">$1</div>',
'<div id="bottom">$1</div>',
'<div id="container">$1</div>'
);

return preg_replace($search,$replace,$input);
}
?>


</body>
</html>


whatever-edit.php
Code: [Select]

<?php
session_start
();

$server "localhost";
$dbuser "root";
$dbpass "";
$database "database";

mysql_connect($server$dbuser$dbpass);
mysql_select_db($database)or die(mysql_error());

$sql "SELECT * FROM `head`";
$res mysql_query($sql) or die(mysql_error());
$row mysql_fetch_assoc($res);
$head $row['head'];

$sql2 "SELECT * FROM `navigation`";
$res2 mysql_query($sql2) or die(mysql_error());
$row2 mysql_fetch_assoc($res2);
$nav $row2['navigation'];

$sql3 "SELECT * FROM `left-side`";
$res3 mysql_query($sql3) or die(mysql_error());
$row3 mysql_fetch_assoc($res3);
$left_side $row3['left-side'];

$sql4 "SELECT * FROM `right-side`";
$res4 mysql_query($sql4) or die(mysql_error());
$row4 mysql_fetch_assoc($res4);
$right_side $row4['right-side'];

$sql5 "SELECT * FROM `body`";
$res5 mysql_query($sql5) or die(mysql_error());
$row5 mysql_fetch_assoc($res5);
$body $row5['body'];

$sql6 "SELECT * FROM `bottom`";
$res6 mysql_query($sql6) or die(mysql_error());
$row6 mysql_fetch_assoc($res6);
$bottom $row6['bottom'];

$update_head $_SESSION['head-changes'];
$update_nav $_SESSION['nav-changes'];
$update_left_side $_SESSION['left-side-changes'];
$update_right_side $_SESSION['right-side-changes'];
$update_body $_SESSION['body-changes'];
$update_bottom $_SESSION['bottom-changes'];

function 
notags($input){//makes it inpossible to get tags to work and hack
return trim(htmlspecialchars(addslashes($input)));
}

$form "<table>
<tr>
<td>
<form method=\"post\" action=\"better way.php\">Head"
;
if(
$update_head){ $form .= $update_head"session_destroy(); } 
$form .= "<br /><textarea name=\"head\" style=\"width:300px;height:100px;\">$head</textarea><input type=\"submit\" value=\"Edit Header\" name=\"edit-header\"></form></td>
</tr>
<tr>
<td><form method=\"post\" action=\"better way.php\">Navigation"
;
if(
$update_nav){ $form .= $update_nav"session_destroy(); } 
$form .= "<br /><textarea name=\"navigation\" style=\"width:300px;height:100px;\">$nav</textarea><input type=\"submit\" value=\"Edit Navigation\" name=\"edit-nav\"></form></td>
</tr>
<tr>
<td><form method=\"post\" action=\"better way.php\">Left Side"
;
if(
$update_left_side){ $form .= $update_left_side"session_destroy(); }
$form .= "<br /><textarea name=\"left-side\" style=\"width:300px;height:100px;\">$left_side</textarea><input type=\"submit\" value=\"Edit Left-Side\" name=\"edit-left-side\"></form></td>
</tr>
<tr>
<td><form method=\"post\" action=\"better way.php\">Right Side"

if(
$update_right_side){ $form .= $update_right_side"session_destroy(); }
$form .="<br /><textarea name=\"right-side\" style=\"width:300px;height:100px;\">$right_side</textarea><input type=\"submit\" value=\"Edit Right-Side\" name=\"edit-right-side\"></form></td>
</tr>
<tr>
<td><form method=\"post\" action=\"better way.php\">Body"
;
if(
$update_body){ $form .= $update_body"session_destroy();  }
$form .= "<br /><textarea name=\"body\" style=\"width:300px;height:100px;\">$body</textarea><input type=\"submit\" value=\"Edit Body\" name=\"edit-body\"></form></td>
</tr>
<tr>
<td><form method=\"post\" action=\"better way.php\">Bottom"
;
if(
$update_bottom){ $form .= $update_bottom"session_destroy();  }
$form .= "<br /><textarea name=\"bottom\" style=\"width:300px;height:100px;\">$bottom</textarea><input type=\"submit\" value=\"Edit Bottom\" name=\"edit-bottom\"></form></td>
</tr>
</table>
"
;

echo 
$form;

if(
$_POST['edit-header']){
$header notags($_POST['head']);
$update "UPDATE `head` SET `head`='$header'";
$update_set mysql_query($update)or die(mysql_error());
$_SESSION['head-changes'] = "Changes Saved";
header("Location: better way.php");
}

if(
$_POST['edit-nav']){
$navigation notags($_POST['navigation']);
$update "UPDATE `navigation` SET `navigation`='$navigation'";
$update_set mysql_query($update)or die(mysql_error());
$_SESSION['nav-changes'] = "Changes Saved";
header("Location: better way.php");
}

if(
$_POST['edit-left-side']){
$edit_left_side notags($_POST['left-side']);
$update "UPDATE `left-side` SET `left-side`='$edit_left_side'";
$update_set mysql_query($update)or die(mysql_error());
$_SESSION['left-side-changes'] = "Changes Saved";
header("Location: better way.php");
}

if(
$_POST['edit-right-side']){
$edit_right_side notags($_POST['right-side']);
$update "UPDATE `right-side` SET `right-side`='$edit_right_side'";
$update_set mysql_query($update)or die(mysql_error());
$_SESSION['right-side-changes'] = "Changes Saved";
header("Location: better way.php");
}

if(
$_POST['edit-body']){
$edit_body notags($_POST['body']);
$update "UPDATE `body` SET `body`='$edit_body'";
$update_set mysql_query($update)or die(mysql_error());
$_SESSION['body-changes'] = "Changes Saved";
header("Location: better way.php");
}

if(
$_POST['edit-bottom']){
$edit_bottom notags($_POST['bottom']);
$update "UPDATE `bottom` SET `bottom`='$edit_bottom'";
$update_set mysql_query($update)or die(mysql_error());
$_SESSION['bottom-changes'] = "Changes Saved";
header("Location: better way.php");
}
?>



database information
Code: [Select]

--
-- Table structure for table `body`
--

CREATE TABLE IF NOT EXISTS `body` (
  `body` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `body`
--

INSERT INTO `body` (`body`) VALUES
('[underline]the body[/underline]\r\n[br]\r\n&lt;a href=&quot;test&quot;&gt;test&lt;/a&gt;');

-- --------------------------------------------------------

--
-- Table structure for table `bottom`
--

CREATE TABLE IF NOT EXISTS `bottom` (
  `bottom` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `bottom`
--

INSERT INTO `bottom` (`bottom`) VALUES
('[underline]bottom[/underline]');

-- --------------------------------------------------------

--
-- Table structure for table `head`
--

CREATE TABLE IF NOT EXISTS `head` (
  `head` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `head`
--

INSERT INTO `head` (`head`) VALUES
('[underline]header[/underline]');

-- --------------------------------------------------------

--
-- Table structure for table `left-side`
--

CREATE TABLE IF NOT EXISTS `left-side` (
  `left-side` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `left-side`
--

INSERT INTO `left-side` (`left-side`) VALUES
('[underline]left side[/underline]');

-- --------------------------------------------------------

--
-- Table structure for table `navigation`
--

CREATE TABLE IF NOT EXISTS `navigation` (
  `navigation` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `navigation`
--

INSERT INTO `navigation` (`navigation`) VALUES
('[nav-link=#]nav link 1[/nav-link]\r\n | \r\n[nav-link=#]nav link 2[/nav-link]\r\n |\r\n[nav-link=whatever-edit.php]To edit page[/nav-link]');

-- --------------------------------------------------------

--
-- Table structure for table `right-side`
--

CREATE TABLE IF NOT EXISTS `right-side` (
  `right-side` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `right-side`
--

INSERT INTO `right-side` (`right-side`) VALUES
('[underline]right side[/underline]');


for this example i used a template from one of my very first sites

and here is a working example
http://the-test.comoj.com/files/better-way.php

and chris you said in my topic my database could use work what could i do to make it better?
« Last Edit: August 22, 2011, 08:06:03 PM by jack13580 »

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: XML-RPC vs JSON-RPC
« Reply #4 on: August 23, 2011, 04:32:32 AM »
ok here is a much better and easier way of doing this language thing

first you shoulod make it so people who want to translate must already have an account and if they do want to translate the website have a form where they
Oh, it's not this topic. I need the something-RPC thing for integration with Bigpoint portal, it has nothing to do with translation. I asked about XML for translation in the "XML_" topic (similar names, easy to confuse :)). Also, I already use the standard gettext() for interface translation and the XML thing (in the other topic) was for big files, like manuals, only.
If you are doing translation for your game too, just start a topic about it, I will gladly exchange experiences :)

Quote
and chris you said in my topic my database could use work what could i do to make it better?
Link to the topic please.

Offline jack13580

  • Level 7
  • *
  • Posts: 35
  • Reputation: +0/-0
    • View Profile
Re: XML-RPC vs JSON-RPC
« Reply #5 on: August 23, 2011, 06:01:48 PM »
i already use the system i told you about for one of my games it worked perfectly just took a while for the users to submit something here is the link to my topic
http://community.bbgamezone.net/coding-discussion/making-a-browsergame-nead-help/

Offline BlackScorp

  • Level 15
  • *
  • Posts: 123
  • Reputation: +6/-0
    • View Profile
    • Cruel Online
Re: XML-RPC vs JSON-RPC
« Reply #6 on: September 02, 2011, 07:41:44 AM »
I'd use JSON. XML is way too much fluff way too much extra data way too much waste.

this + there is a reason why Facebook API and other big APIs use in most cases JSON, it is just better;)

but dude, please DONT implement your game into BP portal.. a friend of mine, who made overwatch, implemented the game to Bigpoint , but he spend so much time for realize the standards of Bigpoint and at the end he didnt earned money. make an Facebook login into your game and publish the game over facebook its the better alternative way.
« Last Edit: September 02, 2011, 07:56:48 AM by BlackScorp »

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: XML-RPC vs JSON-RPC
« Reply #7 on: September 04, 2011, 01:31:57 AM »
0:7 for JSON-RPC, I love definite answers and obvious choices :D

but dude, please DONT implement your game into BP portal.. a friend of mine, who made overwatch, implemented the game to Bigpoint , but he spend so much time for realize the standards of Bigpoint and at the end he didnt earned money. make an Facebook login into your game and publish the game over facebook its the better alternative way.
Hmm, has he made FB version too? Does he see the difference in performance in these? (also invite your friend to join our forum :))

Offline BlackScorp

  • Level 15
  • *
  • Posts: 123
  • Reputation: +6/-0
    • View Profile
    • Cruel Online
Re: XML-RPC vs JSON-RPC
« Reply #8 on: September 05, 2011, 02:44:24 AM »
He is actually making a facebook login, he dont work on facebook version. you can just use facebook account to create ingame account to log the player in. you dont need an extra facebook version. its just a big advertisment if your game is added to Application list on facebook.

btw: Facebook use JSON as well;)

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: XML-RPC vs JSON-RPC
« Reply #9 on: September 05, 2011, 04:21:31 AM »
He is actually making a facebook login, he dont work on facebook version. you can just use facebook account to create ingame account to log the player in. you dont need an extra facebook version. its just a big advertisment if your game is added to Application list on facebook.

btw: Facebook use JSON as well;)
But to use FB you need to integrate their payment system (and disable yours and all ads). So, it's kind of like a separate version...

Offline BlackScorp

  • Level 15
  • *
  • Posts: 123
  • Reputation: +6/-0
    • View Profile
    • Cruel Online
Re: XML-RPC vs JSON-RPC
« Reply #10 on: September 05, 2011, 05:18:16 AM »
yeah bit its still yeasier and faster to make a small sperated version for FB than for BP , you have just to check if facebook user is logged in, then disable adds, facebooks payment system u dont need to intergrate(as far as i know, maybe they changed the rules..)

EDIT: how did you changed my reputation? i cannot find the link to it:D

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: XML-RPC vs JSON-RPC
« Reply #11 on: September 05, 2011, 08:16:04 AM »
yeah bit its still yeasier and faster to make a small sperated version for FB than for BP , you have just to check if facebook user is logged in, then disable adds, facebooks payment system u dont need to intergrate(as far as i know, maybe they changed the rules..)
Well, you need some kind of payment system to get, well, payments :D If they disallow PayPal = you have to implement theirs.

Quote
EDIT: how did you changed my reputation? i cannot find the link to it:D
You need 100 something (probably posts).

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal