SlideShare une entreprise Scribd logo
1  sur  61
Télécharger pour lire hors ligne
Stephan Schmidt | 1&1 Internet AG

JSON-RPC-Proxy Generation with
PHP 5
Connecting PHP and JavaScript
What will I talk about today?

 •   The Speaker
 •   Web 2.0 and the Proxy Pattern
 •   JavaScript-Object-Notation
 •   JSON in PHP
 •   The JSON-RPC Specification
 •   Server- and Clientside JSON-RPC
 •   Generating Remote Proxies
 •   SMD and the Dojo Toolkit

Stephan Schmidt | 1&1 Internet AG
Who is Stephan Schmidt?

 • Head of Web-Development at 1&1 Internet AG
   in Karlsruhe (Java, PHP, JavaScript, XSL)
 • Developing PHP since 1999
 • Contributor to various Open Source Projects
   since 2001 (PEAR, pecl, pat, Stubbles, …)
 • Author of „PHP Design Patterns“ and co-author
   of several other PHP related books
 • Speaker at international conferences since 2001


Stephan Schmidt | 1&1 Internet AG
A classic web application
                                          POST /projects/json-rpc/classic/result.php HTTP/1.1
                                          Host: localhost
                                          User-Agent: Mozilla/5.0
                                          Accept-Encoding: gzip,deflate
                                          Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
                                          Keep-Alive: 300
                                          Connection: keep-alive
                                          Referer: http://localhost/projects/json-
                                          rpc/classic/form.php
                                          Content-Type: application/x-www-form-urlencoded
                                          Content-Length: 9
                                          a=28&b=14




HTTP/1.x 200 OK
Date: Sat, 24 May 2008 16:28:32 GMT
Server: Apache/2.2.8 (Win32) DAV/2
X-Powered-By: PHP/5.2.5
Content-Length: 299
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

<html>
<head>
  <title>Classic Webapplication</title>
</head>
…


Stephan Schmidt | 1&1 Internet AG
Classic web applications

 • Business logic and presentation layer are
   both on the server side
 • Every action triggers an HTTP request,
   that reloads the complete page
 • No functionality in the client
       – Except some small JavaScript components
         that are not business critical



Stephan Schmidt | 1&1 Internet AG
The business logic layer
 class Calculator
 {
     /**
       * Add two numbers
       *
       * @param   int     $a
       * @param   int     $b
       * @return int
       */
     public function add($a, $b)
     {
          return $a + $b;
     }
 }



Stephan Schmidt | 1&1 Internet AG
The presentation layer (server-side)
 <?php
 require_once '../Calculator.php';
 $calc = new Calculator();
 ?>
 <html xmlns=quot;http://www.w3.org/1999/xhtmlquot; xml:lang=quot;dequot;
     lang=quot;dequot;>
 <head>
    <title>Classic Webapplication</title>
 </head>
 <body>
 <h1>Result</h1>
 <?php echo $_POST['a']; ?> + <?php echo $_POST['b']; ?> =
 <?php echo $calc->add($_POST['a'], $_POST['a']); ?>
 </body>
 </html>


Stephan Schmidt | 1&1 Internet AG
What has changed with Web 2.0?

 Presentation logic has been moved to the
   client
       – DOM manipulations to show/hide parts of the
         page or change content
       – Actions do not trigger a reload of the complete
         page
 BUT: The business logic still resides on the
  server and must be accessed by the
  presentation layer
Stephan Schmidt | 1&1 Internet AG
How can this dilemma be solved?

 • Business logic has to stay in PHP, as you
   cannot trust the client
 • We need a JavaScript object as a stand-in
   for the business logic implemented in PHP
 • The presentation layer should make calls
   on this object and the calls should
   transparently be routed to the business
   logic

Stephan Schmidt | 1&1 Internet AG
The Proxy Pattern

 Provide a surrogate or placeholder for
   another object to control access to it.




Source: http://en.wikipedia.org/wiki/Proxy_pattern


Stephan Schmidt | 1&1 Internet AG
The Remote Proxy Pattern

 The Remote Proxy pattern uses a proxy to
  hide the fact that a service object is
  located on a different machine than the
  client objects that want to use it.




Source: http://www.titu.jyu.fi/modpa/Patterns/pattern-RemoteProxy.html


Stephan Schmidt | 1&1 Internet AG
How does this pattern help us?

 1. The proxy is implemented in JavaScript
    and provides the same public methods
    as the business logic class implemented
    in PHP
 2. The proxy serializes the method call and
    sends the request to the server
 3. On the server, the request is deserialized
    and the requested method is invoked

Stephan Schmidt | 1&1 Internet AG
How does this pattern help us?

 4. The return value of the PHP business
    logic call again is serialized and sent as
    a response
 5. On the client, the proxy deserializes the
    response and returns the result.

 This is completely transparent to the client!


Stephan Schmidt | 1&1 Internet AG
Serializing the method call

 Complex data structures need to be
   serialized
 • anything that could be a parameter of a
   method call
 • Strings, integers, booleans, arrays,
   objects, …



Stephan Schmidt | 1&1 Internet AG
Serializing the method call

 Different formats for serializing data are
   available
 • XML
       – XML is very verbose, the requests should be
         as small as possible
 • PHP‘s serialize format
       – Restricted to PHP
 • Custom formats (binary or plaintext)

Stephan Schmidt | 1&1 Internet AG
Enter JSON

 JSON = JavaScript Object Notation
 ☺lightweight data-interchange format
 ☺Easy to read/parse for humans and
   machines
 ☺completely language independent
 ☺uses conventions that are familiar to
   programmers of the C-family of languages


Stephan Schmidt | 1&1 Internet AG
Enter JSON

 JSON is built on two structures:
 • A collection of name/value pairs. In
   various languages, this is realized as an
   object, record, struct, dictionary, hash
   table, keyed list, or associative array.
 • An ordered list of values. In most
   languages, this is realized as an array,
   vector, list, or sequence.

Stephan Schmidt | 1&1 Internet AG
Objects in JSON




 •   Set of unordered key/value pairs
 •   Starts and ends with curly braces
 •   Key and value are separated by a colon
 •   Key/value pairs are separated by commas


Stephan Schmidt | 1&1 Internet AG
Arrays in JSON




 • Ordered collection of values
 • Starts and ends with square brackets
 • Values are separated by commas




Stephan Schmidt | 1&1 Internet AG
Values in JSON




 • Can be any of the types listed above
 • Objects and arrays are also values, which
   leads to nesting
Stephan Schmidt | 1&1 Internet AG
JSON examples
 PHP                                JSON
 Array                              [1,2,3]
 (
     [0] => 1
     [1] => 2
     [2] => 3
 )

 stdClass Object                    {quot;idquot;:quot;schstquot;,
 (                                   quot;mailquot;:quot;schst@php.netquot;}
     [id] => schst
     [mail] => schst@php.net
 )




Stephan Schmidt | 1&1 Internet AG
JSON in JavaScript

 • JSON is a subset of the literal notation of
   JavaScript
 • Deserialization can be done via eval()
       – Leads to security issues
 • json.org provides a JSON parser/stringifier
   at http://www.json.org/js.html
       – Smaller than 2k, if minified


Stephan Schmidt | 1&1 Internet AG
JSON in PHP

 • Various parsers / stringifiers are available
       – PHP based: Zend_JSON, Solar_JSON, …
       – C based: pecl/json
 • Since PHP 5.2, the PECL extension is part
   of PHP core
       – Use it, if possible
 • Benchmark available at
     http://gggeek.altervista.org/sw/article_20070425.html


Stephan Schmidt | 1&1 Internet AG
Encoding data with PHP

 • Extension provides json_encode()
   function
 • Encodes any value, except resources, in
   JSON format
 • Requires UTF-8 data

 $data = array(1,2,3);
 $json = json_encode($data);


Stephan Schmidt | 1&1 Internet AG
Decoding data with PHP

 • Extension provides json_decode()
   function
 • Decodes any JSON-string to PHP data
   structures
 • Objects can be decoded to stdClass
   instances or arrays
 $json = quot;[1,2,3]quot;;
 $data = json_decode($json);


Stephan Schmidt | 1&1 Internet AG
Invoking a remote method

 Method of an object that is located on a
   different machine is invoked via the
   network.
 Already used in different areas:
 • RMI
 • SOAP
 • XML-RPC


Stephan Schmidt | 1&1 Internet AG
The JSON-RPC protocol

 JSON-RPC is a stateless and light-weight
   remote procedure call (RPC) protocol for
   inter-networking applications over HTTP.
   It uses JSON as the data format for all
   facets of a remote procedure call,
   including all application data carried in
   parameters.
Source: http://www.json-rpc.org/




Stephan Schmidt | 1&1 Internet AG
The JSON-RPC protocol

 • Inspired by the XML-RPC protocol
 • Request and response are serialized in
   JSON
 • Data is transported via HTTP
 • Very often used asynchronously, to avoid
   that the application is frozen while the
   request is being processed


Stephan Schmidt | 1&1 Internet AG
JSON-RPC Request

 The request is a single object with the
   following properties:
 • method
   A string containing the name.
 • params
   An array of objects
 • id
   A unique identifier of the request

Stephan Schmidt | 1&1 Internet AG
JSON-RPC Response

 The response is a single object with the
   following properties:
 • result
   The result of the method call
 • error
   An error object, if an error occurred
 • id
   The same identifier used in the request

Stephan Schmidt | 1&1 Internet AG
JSON-RPC examples

 Request
 { quot;methodquot;: quot;echoquot;,
   quot;paramsquot;: [quot;Hello JSON-RPCquot;],
   quot;idquot;: 1}


 Response
 { quot;resultquot;: quot;Hello JSON-RPCquot;,
   quot;errorquot;: null,
   quot;idquot;: 1}


Stephan Schmidt | 1&1 Internet AG
Let’s get practical

 • Implement a JavaScript class that
   provides a method to call arbitrary JSON-
   RPC services
 • Implement a PHP script, that acts as a
   server for this class
 • Use PHP to generate JavaScript proxies
   for existing PHP classes that make use of
   this JavaScript JSON-RPC client

Stephan Schmidt | 1&1 Internet AG
JSON-RPC Client (simplified)
 var JsonRpcClient = function(clientObj) {
   // map ids to callbacks
   var reqRespMapping = [];

     var callback = {
       // callback functions for asynchronous calls
     }

   this.createId = function() {
     // create a unique id
   };
 };

Stephan Schmidt | 1&1 Internet AG
JSON-RPC Client (simplified)
 var JsonRpcClient = function(clientObj) {
   this.doCall = function(classAndMethod, args) {
     var id = this.createId();
     var jsonRpcReq = {
             method: classAndMethod,
             params: arr,
             id: id
         };

           YAHOO.util.Connect.asyncRequest('POST', finalServiceUrl,
                               callback, jsonRpcReq.toJSONString());
           reqRespMapping.push(jsonRpcReq);
           return id;
      };
 };


Stephan Schmidt | 1&1 Internet AG
Using the JSON-RPC Client (simplified)
   // Callback object, as calls are asynchronous
 var CalculatorCallback = {
    callback__add: function(id, result, error) {
      alert(result);
    }
 }

 function add() {
   var a = document.getElementById('a').value;
   var b = document.getElementById('b').value;

     var client = new JsonRpcClient(CalculatorCallback);
     client.doCall('Calculator.add', [a,b]);
 }



Stephan Schmidt | 1&1 Internet AG
JSON-RPC Client

 • Name of the PHP class and method has
   been separated using a dot (“.”)
 • Callback method is called
   “callback__$METHOD”
 • YUI is used for XmlHttpRequest
   abstraction
 • The complete code can be downloaded
   from http://www.stubbles.net

Stephan Schmidt | 1&1 Internet AG
JSON-RPC Server

 • Decode the JSON-RPC request
 • Extract the class and the method name
   from the “method” property of the request
   object
 • Dynamically load the class
 • Create a stdClass object to contain the
   response and copy the id property from
   the request

Stephan Schmidt | 1&1 Internet AG
JSON-RPC Server (simplified)
 // Get the request
 $requestRaw = file_get_contents('php://input');
 $request    = json_decode($requestRaw);
 // Prepare the response
 $response = new stdClass();
 $response->id = $request->id;

 // Get the class and method
 $methodRaw = $request->method;
 list($class, $method) = explode('.', $methodRaw);
 require_once quot;../{$class}.phpquot;;



Stephan Schmidt | 1&1 Internet AG
JSON-RPC Server

 • Use the Reflection API to create a new
   instance of the class
 • Use the Reflection API to dynamically
   invoke the method on this instance,
   passing the parameters from the JSON-
   RPC request



Stephan Schmidt | 1&1 Internet AG
JSON-RPC Server (simplified)
 try {
   $clazz = new ReflectionClass($class);
   $service = $clazz->newInstanceArgs();
   // Invoke the method
   $methodObj = $clazz->getMethod($method);
   $result = $methodObj->invokeArgs($service,
                                   $request->params);
   $response->error = null;
   $response->result = $result;
 } catch (Exception $e) {
 }



Stephan Schmidt | 1&1 Internet AG
JSON-RPC Server

 • Set the “result” property, if the method
   call was successful.
 • Catch any exception during processing
   and set the “error” property
 • Encode the result in JSON and send it to
   the browser



Stephan Schmidt | 1&1 Internet AG
JSON-RPC Server (simplified)
 try {
   …
 } catch (Exception $e) {
   $response->error = $e->getMessage();
   $response->result = null;
 }

 // Send the response
 echo json_encode($response);




Stephan Schmidt | 1&1 Internet AG
A JSON-RPC web application
                                                     POST /projects/json-rpc/json-rpc/server.php HTTP/1.1
                                                     Host: localhost
                                                     User-Agent: Mozilla/5.0
                                                     Accept-Encoding: gzip,deflate
                                                     Keep-Alive: 300
                                                     Connection: keep-alive
                                                     X-Requested-With: XMLHttpRequest
                                                     Content-Type: application/x-www-form-urlencoded; charset=UTF-8
                                                     Referer: http://localhost/projects/json-rpc/json-rpc/form.php
                                                     Content-Length: 63
                                                     Pragma: no-cache
                                                     Cache-Control: no-cache
                                                     {quot;methodquot;:quot;Calculator.addquot;,quot;paramsquot;:[quot;28quot;,
                                                     quot;14quot;],quot;idquot;:quot;1248167quot;}




   HTTP/1.x 200 OK
   Date: Sun, 25 May 2008 10:48:44 GMT
   Server: Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g
   mod_autoindex_color PHP/5.2.5
   X-Powered-By: PHP/5.2.5
   Content-Length: 41
   Keep-Alive: timeout=5, max=100
   Connection: Keep-Alive
   Content-Type: text/html

   {quot;idquot;:quot;1246838quot;,quot;errorquot;:null,quot;resultquot;:42}


Stephan Schmidt | 1&1 Internet AG
JSON-RPC Proxy generation

 • Dynamically create a JavaScript class,
   that encapsulates the doCall() calls on
   the JsonRpcClient object
 • Use PHP’s reflection API to extract all
   public methods from any PHP class
 • Provide this functionality over HTTP to
   generate the clients on-the-fly.


Stephan Schmidt | 1&1 Internet AG
JSON-RPC Proxy Generator
 // dynamically load the class
 $className = $_GET['class'];
 require_once quot;../{$className}.phpquot;;
 $clazz = new ReflectionClass($className);

 // Create a JavaScript class for this class
 echo quot;var {$className} = function(clientObj) {nquot;;
 echo quot; this.dispatcher =
                  new JsonRpcClient(clientObj);nquot;;
 echo quot;};nquot;;




Stephan Schmidt | 1&1 Internet AG
JSON-RPC Proxy Generator
 // Iterate over all methods
 foreach ($clazz->getMethods() as $method) {
   // only export public methods to the proxy
   if (!$method->isPublic()) {
     continue;
   }
   $methodName = $method->getName();
   // JS generation on next slide
 }




Stephan Schmidt | 1&1 Internet AG
JSON-RPC Proxy Generator
 // Iterate over all methods
 foreach ($clazz->getMethods() as $method) {
   $methodName = $method->getName();
   echo quot;{$className}.prototype.{$methodName} =
                                     function() {nquot;;
   // route this call to the server
   echo “ return this.dispatcher.doCall(
                       '{$className}.{$methodName}',
                       arguments);nquot;;
   echo quot;};nquot;;
 }



Stephan Schmidt | 1&1 Internet AG
Using the JSON-RPC Proxy generator

 • Generated JavaScript code can be loaded
   the same way as static JavaScript code,
   using the src-attribute of the <script/>
   tag
 • Generated JavaScript provides a new
   JavaScript class that resembles the PHP
   class and is used as a proxy


Stephan Schmidt | 1&1 Internet AG
Using the JSON-RPC Proxy generator
 <script type=quot;text/javascriptquot;
   src=quot;./proxygen.php?class=Calculatorquot;></script>


 Resulting JavaScript
 var Calculator = function(clientObj) {
   this.dispatcher = new JsonRpcClient(clientObj);
 };
 Calculator.prototype.add = function() {
   return this.dispatcher.doCall(
                       'Calculator.add', arguments);
 };



Stephan Schmidt | 1&1 Internet AG
Using the JSON-RPC Proxy
 var CalculatorCallback = {
   callback__add: function(id, result, error) {
   alert(result);
   }
 }
 function add() {
   var a = document.getElementById('a').value;
   var b = document.getElementById('b').value;
   var calc = new Calculator(CalculatorCallback);
   calc.add(a, b);
 }



Stephan Schmidt | 1&1 Internet AG
Problems with this approach

 • Server-side code generates client side
   code, which leads to a tight coupling
   between PHP code and JavaScript code
 • Client framework cannot easily be
   replaced
 • We need something like WSDL for JSON-
   RPC


Stephan Schmidt | 1&1 Internet AG
Enter SMD

 SMD = Simple Method Description
 • Very easy data structure, that describes all
   methods and their parameters, that a
   service provides
 • Encoded in JSON format
 • Invented by the Dojo Toolkit
 • Might be replaced by “Service Mapping
   Description”
Stephan Schmidt | 1&1 Internet AG
Format of an SMD

 SMD always contains:
 • The SMD version
 • Name of the object or class it represents
 • Service type (e.g. JSON-RPC)
 • Service URL
 • Array of all available methods and their
   parameters

Stephan Schmidt | 1&1 Internet AG
Example SMD
 {quot;SMDVersionquot;:quot;.1quot;,
  quot;objectNamequot;:quot;Calculatorquot;,
  quot;serviceTypequot;:quot;JSON-RPCquot;,
  quot;serviceURLquot;:quot;./server.phpquot;,
  quot;methodsquot;:[
    {quot;namequot;:quot;addquot;,
     quot;parametersquot;:[
       {quot;namequot;:quot;aquot;, quot;typequot;:quot;INTEGERquot;},
       {quot;namequot;:quot;bquot;, quot;typequot;:quot;INTEGERquot;}
     ]}
 ]}



Stephan Schmidt | 1&1 Internet AG
Generating SMD with PHP
 $className = $_GET['class'];
 require_once quot;../{$className}.phpquot;;
 $clazz = new ReflectionClass($className);

 $smdData = new stdClass();
 $smdData->SMDVersion = 1;
 $smdData->serviceType = 'JSON-RPC';
 $smdData->serviceURL = './server-smd.php?class=' .
                                         $className;
 $smdData->objectName = $className;
 $smdData->methods     = array();



Stephan Schmidt | 1&1 Internet AG
Generating SMD with PHP
 foreach ($clazz->getMethods() as $method) {
   if (!$method->isPublic()) {
     continue;
   }
   $methodDef = new stdClass();
   $methodDef->name = $method->getName();
   $methodDef->parameters = array();
   $smdData->methods[] = $methodDef;
   foreach ($method->getParameters() as $parameter) {
     $paramDef = new stdClass();
     $paramDef->name = $parameter->getName();
     $methodDef->parameters[] = $paramDef;
   }
 }
 echo json_encode($smdData);



Stephan Schmidt | 1&1 Internet AG
Using SMD with the Dojo Toolkit

 • First framework that makes use of SMD
 • Dynamically generates proxies at run-time
   based on an SMD structure, JSON-String
   or URL
 • Extremely easy to use
 • Similar to ext/soap in PHP 5



Stephan Schmidt | 1&1 Internet AG
Using SMD with the Dojo Toolkit
 <script type=quot;text/javascriptquot;
   src=quot;http://...dojo/dojo.xd.jsquot;></script>

 djConfig.usePlainJson = true;
 dojo.require('dojo.rpc.JsonService');
 var smdURL = './smdgen.php?class=Calculator';
 proxy = new dojo.rpc.JsonService(smdURL);


 Server returns this SMD:
 {quot;SMDVersionquot;:1,quot;serviceTypequot;:quot;JSON-RPCquot;,quot;serviceURLquot;:quot;./server-
     smd.php?class=Calculatorquot;,quot;methodsquot;:[{quot;namequot;:quot;addquot;,quot;parametersquot;:[{quot;namequot;:quot;aquot;},
     {quot;namequot;:quot;bquot;}]}],quot;objectNamequot;:quot;Calculatorquot;}




Stephan Schmidt | 1&1 Internet AG
Using the proxy
 // Dojo only needs a callback function, no object
 function doAddCallback(result) {
   alert(result);
 }

 function add() {
   var a = document.getElementById('a').value;
   var b = document.getElementById('b').value;
   // Execute the call and add the callback
   proxy.add(a, b).addCallback(doCalcCallback);
 }



Stephan Schmidt | 1&1 Internet AG
Existing Frameworks

 Several frameworks already provide the
   generation of proxies:
 • pecl/SCA_SDO
 • PEAR::HTML_AJAX (no real JSON-RPC)
 • Sajax (no real JSON-RPC)
 • Stubbles
       – The only framework that implements the
         JSON-RPC and SMD specs

Stephan Schmidt | 1&1 Internet AG
Thank you

 Any Questions?




                                        schst@stubbles.net
                                    http://www.stubbles.net
                                    http://www.stubbles.org

Stephan Schmidt | 1&1 Internet AG

Contenu connexe

Tendances

The Functional Web
The Functional WebThe Functional Web
The Functional WebRyan Riley
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web ServicesBradley Holt
 
Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5Michael Girouard
 
WebTalk - Implementing Web Services with a dedicated Java daemon
WebTalk - Implementing Web Services with a dedicated Java daemonWebTalk - Implementing Web Services with a dedicated Java daemon
WebTalk - Implementing Web Services with a dedicated Java daemonGeert Van Pamel
 
Iss letcure 7_8
Iss letcure 7_8Iss letcure 7_8
Iss letcure 7_8Ali Habeeb
 
What's new in PHP 5.5
What's new in PHP 5.5What's new in PHP 5.5
What's new in PHP 5.5Tom Corrigan
 
Fluentd unified logging layer
Fluentd   unified logging layerFluentd   unified logging layer
Fluentd unified logging layerKiyoto Tamura
 
Reactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaReactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaHermann Hueck
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHPZoran Jeremic
 
Automatically generating-json-from-java-objects-java-objects268
Automatically generating-json-from-java-objects-java-objects268Automatically generating-json-from-java-objects-java-objects268
Automatically generating-json-from-java-objects-java-objects268Ramamohan Chokkam
 
Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12N Masahiro
 
Common Gateway Interface
Common Gateway InterfaceCommon Gateway Interface
Common Gateway InterfaceBalu Masulkar
 
Writing and using php streams and sockets
Writing and using php streams and socketsWriting and using php streams and sockets
Writing and using php streams and socketsElizabeth Smith
 
Services web RESTful
Services web RESTfulServices web RESTful
Services web RESTfulgoldoraf
 

Tendances (19)

The Functional Web
The Functional WebThe Functional Web
The Functional Web
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 
Develop webservice in PHP
Develop webservice in PHPDevelop webservice in PHP
Develop webservice in PHP
 
Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5
 
WebTalk - Implementing Web Services with a dedicated Java daemon
WebTalk - Implementing Web Services with a dedicated Java daemonWebTalk - Implementing Web Services with a dedicated Java daemon
WebTalk - Implementing Web Services with a dedicated Java daemon
 
Iss letcure 7_8
Iss letcure 7_8Iss letcure 7_8
Iss letcure 7_8
 
Ruby
RubyRuby
Ruby
 
What's new in PHP 5.5
What's new in PHP 5.5What's new in PHP 5.5
What's new in PHP 5.5
 
Fluentd unified logging layer
Fluentd   unified logging layerFluentd   unified logging layer
Fluentd unified logging layer
 
Reactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaReactive Access to MongoDB from Scala
Reactive Access to MongoDB from Scala
 
Ajax
AjaxAjax
Ajax
 
httpie
httpiehttpie
httpie
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
Automatically generating-json-from-java-objects-java-objects268
Automatically generating-json-from-java-objects-java-objects268Automatically generating-json-from-java-objects-java-objects268
Automatically generating-json-from-java-objects-java-objects268
 
Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12
 
Fluentd meetup #2
Fluentd meetup #2Fluentd meetup #2
Fluentd meetup #2
 
Common Gateway Interface
Common Gateway InterfaceCommon Gateway Interface
Common Gateway Interface
 
Writing and using php streams and sockets
Writing and using php streams and socketsWriting and using php streams and sockets
Writing and using php streams and sockets
 
Services web RESTful
Services web RESTfulServices web RESTful
Services web RESTful
 

En vedette

RESTful JSON web databases
RESTful JSON web databasesRESTful JSON web databases
RESTful JSON web databaseskriszyp
 
Мероприятия как инструмент работы с молодыми специалистами и продвижения брен...
Мероприятия как инструмент работы с молодыми специалистами и продвижения брен...Мероприятия как инструмент работы с молодыми специалистами и продвижения брен...
Мероприятия как инструмент работы с молодыми специалистами и продвижения брен...FutureToday
 
Uncle Ben's Recipe Video Contest Flyer
Uncle Ben's Recipe Video Contest FlyerUncle Ben's Recipe Video Contest Flyer
Uncle Ben's Recipe Video Contest Flyeraeiser
 
Seattle SeaHawks
Seattle SeaHawksSeattle SeaHawks
Seattle SeaHawks1apinedo
 
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQLHTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQLUlf Wendel
 
Mars Business report
Mars  Business reportMars  Business report
Mars Business reportYiqiao Song
 
Sara's m&m slideshow
Sara's m&m slideshowSara's m&m slideshow
Sara's m&m slideshowreidhns1
 
03 json for java script
03 json for java script03 json for java script
03 json for java scriptAhmed Elbassel
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPressTaylor Lovett
 
Mars incorporated interview questions and answers
Mars incorporated interview questions and answersMars incorporated interview questions and answers
Mars incorporated interview questions and answersPenelopeCruz99
 
Customer Success Story: Mars Inc. [New York]
Customer Success Story: Mars Inc. [New York]Customer Success Story: Mars Inc. [New York]
Customer Success Story: Mars Inc. [New York]SAP Ariba
 
M&M's case study
M&M's case studyM&M's case study
M&M's case studyPat Velayo
 
Mars Incorporated Marketing Analysis
Mars Incorporated Marketing AnalysisMars Incorporated Marketing Analysis
Mars Incorporated Marketing AnalysisEmily Crowther
 
How to Write the Fastest JSON Parser/Writer in the World
How to Write the Fastest JSON Parser/Writer in the WorldHow to Write the Fastest JSON Parser/Writer in the World
How to Write the Fastest JSON Parser/Writer in the WorldMilo Yip
 
Mars, incorporated strategic swot analysis review
Mars, incorporated   strategic swot analysis reviewMars, incorporated   strategic swot analysis review
Mars, incorporated strategic swot analysis reviewCompanyProfile123
 

En vedette (20)

RESTful JSON web databases
RESTful JSON web databasesRESTful JSON web databases
RESTful JSON web databases
 
Mars
MarsMars
Mars
 
Мероприятия как инструмент работы с молодыми специалистами и продвижения брен...
Мероприятия как инструмент работы с молодыми специалистами и продвижения брен...Мероприятия как инструмент работы с молодыми специалистами и продвижения брен...
Мероприятия как инструмент работы с молодыми специалистами и продвижения брен...
 
Uncle Ben's Recipe Video Contest Flyer
Uncle Ben's Recipe Video Contest FlyerUncle Ben's Recipe Video Contest Flyer
Uncle Ben's Recipe Video Contest Flyer
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 
Seattle SeaHawks
Seattle SeaHawksSeattle SeaHawks
Seattle SeaHawks
 
CouchDB Day NYC 2017: JSON Documents
CouchDB Day NYC 2017: JSON DocumentsCouchDB Day NYC 2017: JSON Documents
CouchDB Day NYC 2017: JSON Documents
 
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQLHTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
 
Mars Business report
Mars  Business reportMars  Business report
Mars Business report
 
Sara's m&m slideshow
Sara's m&m slideshowSara's m&m slideshow
Sara's m&m slideshow
 
03 json for java script
03 json for java script03 json for java script
03 json for java script
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPress
 
Json
JsonJson
Json
 
Mars incorporated interview questions and answers
Mars incorporated interview questions and answersMars incorporated interview questions and answers
Mars incorporated interview questions and answers
 
Customer Success Story: Mars Inc. [New York]
Customer Success Story: Mars Inc. [New York]Customer Success Story: Mars Inc. [New York]
Customer Success Story: Mars Inc. [New York]
 
M&M's case study
M&M's case studyM&M's case study
M&M's case study
 
WALTHAM Puppy Growth Charts
WALTHAM Puppy Growth ChartsWALTHAM Puppy Growth Charts
WALTHAM Puppy Growth Charts
 
Mars Incorporated Marketing Analysis
Mars Incorporated Marketing AnalysisMars Incorporated Marketing Analysis
Mars Incorporated Marketing Analysis
 
How to Write the Fastest JSON Parser/Writer in the World
How to Write the Fastest JSON Parser/Writer in the WorldHow to Write the Fastest JSON Parser/Writer in the World
How to Write the Fastest JSON Parser/Writer in the World
 
Mars, incorporated strategic swot analysis review
Mars, incorporated   strategic swot analysis reviewMars, incorporated   strategic swot analysis review
Mars, incorporated strategic swot analysis review
 

Similaire à JSON-RPC Proxy Generation with PHP 5

Json Rpc Proxy Generation With Php
Json Rpc Proxy Generation With PhpJson Rpc Proxy Generation With Php
Json Rpc Proxy Generation With Phpthinkphp
 
Synapseindia dot net development web applications with ajax
Synapseindia dot net development  web applications with ajaxSynapseindia dot net development  web applications with ajax
Synapseindia dot net development web applications with ajaxSynapseindiappsdevelopment
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesciklum_ods
 
Pywps a tutorial for beginners and developers
Pywps a tutorial for beginners and developersPywps a tutorial for beginners and developers
Pywps a tutorial for beginners and developersJorge Mendes
 
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache CamelOpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache CamelJosé Román Martín Gil
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindSam Keen
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CIMartin de Keijzer
 
Service Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixService Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixBruce Snyder
 
Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.Alex Borysov
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATIONkrutitrivedi
 

Similaire à JSON-RPC Proxy Generation with PHP 5 (20)

Json Rpc Proxy Generation With Php
Json Rpc Proxy Generation With PhpJson Rpc Proxy Generation With Php
Json Rpc Proxy Generation With Php
 
Synapseindia dot net development web applications with ajax
Synapseindia dot net development  web applications with ajaxSynapseindia dot net development  web applications with ajax
Synapseindia dot net development web applications with ajax
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
 
Pywps a tutorial for beginners and developers
Pywps a tutorial for beginners and developersPywps a tutorial for beginners and developers
Pywps a tutorial for beginners and developers
 
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache CamelOpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
 
Api Design
Api DesignApi Design
Api Design
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CI
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
Service Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixService Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMix
 
Sergey Stoyan 2016
Sergey Stoyan 2016Sergey Stoyan 2016
Sergey Stoyan 2016
 
Sergey Stoyan 2016
Sergey Stoyan 2016Sergey Stoyan 2016
Sergey Stoyan 2016
 
unit1 part 1 sem4 php.docx
unit1 part 1 sem4 php.docxunit1 part 1 sem4 php.docx
unit1 part 1 sem4 php.docx
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
 
XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)
 

Plus de Stephan Schmidt

Das Web Wird Mobil - Geolocation und Location Based Services
Das Web Wird Mobil - Geolocation und Location Based ServicesDas Web Wird Mobil - Geolocation und Location Based Services
Das Web Wird Mobil - Geolocation und Location Based ServicesStephan Schmidt
 
23 Dinge, die Sie über Software Entwicklung in Teams wissen sollten
23 Dinge, die Sie über Software Entwicklung in Teams wissen sollten23 Dinge, die Sie über Software Entwicklung in Teams wissen sollten
23 Dinge, die Sie über Software Entwicklung in Teams wissen solltenStephan Schmidt
 
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten
23 Dinge, die Sie über Software-Entwicklung in Teams wissen solltenStephan Schmidt
 
Continuous Integration mit Jenkins
Continuous Integration mit JenkinsContinuous Integration mit Jenkins
Continuous Integration mit JenkinsStephan Schmidt
 
Die Kunst des Software Design - Java
Die Kunst des Software Design - JavaDie Kunst des Software Design - Java
Die Kunst des Software Design - JavaStephan Schmidt
 
Der Erfolgreiche Programmierer
Der Erfolgreiche ProgrammiererDer Erfolgreiche Programmierer
Der Erfolgreiche ProgrammiererStephan Schmidt
 
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten.
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten.23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten.
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten.Stephan Schmidt
 
Die Kunst Des Software Design
Die Kunst Des Software DesignDie Kunst Des Software Design
Die Kunst Des Software DesignStephan Schmidt
 
Software-Entwicklung Im Team
Software-Entwicklung Im TeamSoftware-Entwicklung Im Team
Software-Entwicklung Im TeamStephan Schmidt
 
Declarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHPDeclarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHPStephan Schmidt
 
XML and Web Services with PHP5 and PEAR
XML and Web Services with PHP5 and PEARXML and Web Services with PHP5 and PEAR
XML and Web Services with PHP5 and PEARStephan Schmidt
 
The Big Documentation Extravaganza
The Big Documentation ExtravaganzaThe Big Documentation Extravaganza
The Big Documentation ExtravaganzaStephan Schmidt
 
Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5Stephan Schmidt
 
Component and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPComponent and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPStephan Schmidt
 
Session Server - Maintaing State between several Servers
Session Server - Maintaing State between several ServersSession Server - Maintaing State between several Servers
Session Server - Maintaing State between several ServersStephan Schmidt
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHPStephan Schmidt
 
Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Stephan Schmidt
 
XML-Socket-Server zur Kommunikation mit Flash
XML-Socket-Server zur Kommunikation mit FlashXML-Socket-Server zur Kommunikation mit Flash
XML-Socket-Server zur Kommunikation mit FlashStephan Schmidt
 

Plus de Stephan Schmidt (20)

Das Web Wird Mobil - Geolocation und Location Based Services
Das Web Wird Mobil - Geolocation und Location Based ServicesDas Web Wird Mobil - Geolocation und Location Based Services
Das Web Wird Mobil - Geolocation und Location Based Services
 
23 Dinge, die Sie über Software Entwicklung in Teams wissen sollten
23 Dinge, die Sie über Software Entwicklung in Teams wissen sollten23 Dinge, die Sie über Software Entwicklung in Teams wissen sollten
23 Dinge, die Sie über Software Entwicklung in Teams wissen sollten
 
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten
 
Continuous Integration mit Jenkins
Continuous Integration mit JenkinsContinuous Integration mit Jenkins
Continuous Integration mit Jenkins
 
Die Kunst des Software Design - Java
Die Kunst des Software Design - JavaDie Kunst des Software Design - Java
Die Kunst des Software Design - Java
 
PHP mit Paul Bocuse
PHP mit Paul BocusePHP mit Paul Bocuse
PHP mit Paul Bocuse
 
Der Erfolgreiche Programmierer
Der Erfolgreiche ProgrammiererDer Erfolgreiche Programmierer
Der Erfolgreiche Programmierer
 
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten.
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten.23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten.
23 Dinge, die Sie über Software-Entwicklung in Teams wissen sollten.
 
Die Kunst Des Software Design
Die Kunst Des Software DesignDie Kunst Des Software Design
Die Kunst Des Software Design
 
Software-Entwicklung Im Team
Software-Entwicklung Im TeamSoftware-Entwicklung Im Team
Software-Entwicklung Im Team
 
Declarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHPDeclarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHP
 
XML and Web Services with PHP5 and PEAR
XML and Web Services with PHP5 and PEARXML and Web Services with PHP5 and PEAR
XML and Web Services with PHP5 and PEAR
 
The Big Documentation Extravaganza
The Big Documentation ExtravaganzaThe Big Documentation Extravaganza
The Big Documentation Extravaganza
 
Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5
 
Component and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPComponent and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHP
 
Session Server - Maintaing State between several Servers
Session Server - Maintaing State between several ServersSession Server - Maintaing State between several Servers
Session Server - Maintaing State between several Servers
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
PEAR For The Masses
PEAR For The MassesPEAR For The Masses
PEAR For The Masses
 
Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4
 
XML-Socket-Server zur Kommunikation mit Flash
XML-Socket-Server zur Kommunikation mit FlashXML-Socket-Server zur Kommunikation mit Flash
XML-Socket-Server zur Kommunikation mit Flash
 

Dernier

2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis UsageNeil Kimberley
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfJos Voskuil
 
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / NcrCall Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncrdollysharma2066
 
IoT Insurance Observatory: summary 2024
IoT Insurance Observatory:  summary 2024IoT Insurance Observatory:  summary 2024
IoT Insurance Observatory: summary 2024Matteo Carbone
 
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptxContemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptxMarkAnthonyAurellano
 
India Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportIndia Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportMintel Group
 
Case study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailCase study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailAriel592675
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...ictsugar
 
Innovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdfInnovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdfrichard876048
 
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...ShrutiBose4
 
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Servicecallgirls2057
 
Independent Call Girls Andheri Nightlaila 9967584737
Independent Call Girls Andheri Nightlaila 9967584737Independent Call Girls Andheri Nightlaila 9967584737
Independent Call Girls Andheri Nightlaila 9967584737Riya Pathan
 
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City GurgaonCall Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaoncallgirls2057
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03DallasHaselhorst
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?Olivia Kresic
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Pereraictsugar
 

Dernier (20)

2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdf
 
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / NcrCall Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
 
IoT Insurance Observatory: summary 2024
IoT Insurance Observatory:  summary 2024IoT Insurance Observatory:  summary 2024
IoT Insurance Observatory: summary 2024
 
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptxContemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
 
India Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportIndia Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample Report
 
Case study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailCase study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detail
 
Corporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information TechnologyCorporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information Technology
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
 
Japan IT Week 2024 Brochure by 47Billion (English)
Japan IT Week 2024 Brochure by 47Billion (English)Japan IT Week 2024 Brochure by 47Billion (English)
Japan IT Week 2024 Brochure by 47Billion (English)
 
Innovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdfInnovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdf
 
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
 
Call Us ➥9319373153▻Call Girls In North Goa
Call Us ➥9319373153▻Call Girls In North GoaCall Us ➥9319373153▻Call Girls In North Goa
Call Us ➥9319373153▻Call Girls In North Goa
 
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
 
Independent Call Girls Andheri Nightlaila 9967584737
Independent Call Girls Andheri Nightlaila 9967584737Independent Call Girls Andheri Nightlaila 9967584737
Independent Call Girls Andheri Nightlaila 9967584737
 
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City GurgaonCall Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Perera
 
No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...
No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...
No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...
 

JSON-RPC Proxy Generation with PHP 5

  • 1. Stephan Schmidt | 1&1 Internet AG JSON-RPC-Proxy Generation with PHP 5 Connecting PHP and JavaScript
  • 2. What will I talk about today? • The Speaker • Web 2.0 and the Proxy Pattern • JavaScript-Object-Notation • JSON in PHP • The JSON-RPC Specification • Server- and Clientside JSON-RPC • Generating Remote Proxies • SMD and the Dojo Toolkit Stephan Schmidt | 1&1 Internet AG
  • 3. Who is Stephan Schmidt? • Head of Web-Development at 1&1 Internet AG in Karlsruhe (Java, PHP, JavaScript, XSL) • Developing PHP since 1999 • Contributor to various Open Source Projects since 2001 (PEAR, pecl, pat, Stubbles, …) • Author of „PHP Design Patterns“ and co-author of several other PHP related books • Speaker at international conferences since 2001 Stephan Schmidt | 1&1 Internet AG
  • 4. A classic web application POST /projects/json-rpc/classic/result.php HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://localhost/projects/json- rpc/classic/form.php Content-Type: application/x-www-form-urlencoded Content-Length: 9 a=28&b=14 HTTP/1.x 200 OK Date: Sat, 24 May 2008 16:28:32 GMT Server: Apache/2.2.8 (Win32) DAV/2 X-Powered-By: PHP/5.2.5 Content-Length: 299 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html <html> <head> <title>Classic Webapplication</title> </head> … Stephan Schmidt | 1&1 Internet AG
  • 5. Classic web applications • Business logic and presentation layer are both on the server side • Every action triggers an HTTP request, that reloads the complete page • No functionality in the client – Except some small JavaScript components that are not business critical Stephan Schmidt | 1&1 Internet AG
  • 6. The business logic layer class Calculator { /** * Add two numbers * * @param int $a * @param int $b * @return int */ public function add($a, $b) { return $a + $b; } } Stephan Schmidt | 1&1 Internet AG
  • 7. The presentation layer (server-side) <?php require_once '../Calculator.php'; $calc = new Calculator(); ?> <html xmlns=quot;http://www.w3.org/1999/xhtmlquot; xml:lang=quot;dequot; lang=quot;dequot;> <head> <title>Classic Webapplication</title> </head> <body> <h1>Result</h1> <?php echo $_POST['a']; ?> + <?php echo $_POST['b']; ?> = <?php echo $calc->add($_POST['a'], $_POST['a']); ?> </body> </html> Stephan Schmidt | 1&1 Internet AG
  • 8. What has changed with Web 2.0? Presentation logic has been moved to the client – DOM manipulations to show/hide parts of the page or change content – Actions do not trigger a reload of the complete page BUT: The business logic still resides on the server and must be accessed by the presentation layer Stephan Schmidt | 1&1 Internet AG
  • 9. How can this dilemma be solved? • Business logic has to stay in PHP, as you cannot trust the client • We need a JavaScript object as a stand-in for the business logic implemented in PHP • The presentation layer should make calls on this object and the calls should transparently be routed to the business logic Stephan Schmidt | 1&1 Internet AG
  • 10. The Proxy Pattern Provide a surrogate or placeholder for another object to control access to it. Source: http://en.wikipedia.org/wiki/Proxy_pattern Stephan Schmidt | 1&1 Internet AG
  • 11. The Remote Proxy Pattern The Remote Proxy pattern uses a proxy to hide the fact that a service object is located on a different machine than the client objects that want to use it. Source: http://www.titu.jyu.fi/modpa/Patterns/pattern-RemoteProxy.html Stephan Schmidt | 1&1 Internet AG
  • 12. How does this pattern help us? 1. The proxy is implemented in JavaScript and provides the same public methods as the business logic class implemented in PHP 2. The proxy serializes the method call and sends the request to the server 3. On the server, the request is deserialized and the requested method is invoked Stephan Schmidt | 1&1 Internet AG
  • 13. How does this pattern help us? 4. The return value of the PHP business logic call again is serialized and sent as a response 5. On the client, the proxy deserializes the response and returns the result. This is completely transparent to the client! Stephan Schmidt | 1&1 Internet AG
  • 14. Serializing the method call Complex data structures need to be serialized • anything that could be a parameter of a method call • Strings, integers, booleans, arrays, objects, … Stephan Schmidt | 1&1 Internet AG
  • 15. Serializing the method call Different formats for serializing data are available • XML – XML is very verbose, the requests should be as small as possible • PHP‘s serialize format – Restricted to PHP • Custom formats (binary or plaintext) Stephan Schmidt | 1&1 Internet AG
  • 16. Enter JSON JSON = JavaScript Object Notation ☺lightweight data-interchange format ☺Easy to read/parse for humans and machines ☺completely language independent ☺uses conventions that are familiar to programmers of the C-family of languages Stephan Schmidt | 1&1 Internet AG
  • 17. Enter JSON JSON is built on two structures: • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. Stephan Schmidt | 1&1 Internet AG
  • 18. Objects in JSON • Set of unordered key/value pairs • Starts and ends with curly braces • Key and value are separated by a colon • Key/value pairs are separated by commas Stephan Schmidt | 1&1 Internet AG
  • 19. Arrays in JSON • Ordered collection of values • Starts and ends with square brackets • Values are separated by commas Stephan Schmidt | 1&1 Internet AG
  • 20. Values in JSON • Can be any of the types listed above • Objects and arrays are also values, which leads to nesting Stephan Schmidt | 1&1 Internet AG
  • 21. JSON examples PHP JSON Array [1,2,3] ( [0] => 1 [1] => 2 [2] => 3 ) stdClass Object {quot;idquot;:quot;schstquot;, ( quot;mailquot;:quot;schst@php.netquot;} [id] => schst [mail] => schst@php.net ) Stephan Schmidt | 1&1 Internet AG
  • 22. JSON in JavaScript • JSON is a subset of the literal notation of JavaScript • Deserialization can be done via eval() – Leads to security issues • json.org provides a JSON parser/stringifier at http://www.json.org/js.html – Smaller than 2k, if minified Stephan Schmidt | 1&1 Internet AG
  • 23. JSON in PHP • Various parsers / stringifiers are available – PHP based: Zend_JSON, Solar_JSON, … – C based: pecl/json • Since PHP 5.2, the PECL extension is part of PHP core – Use it, if possible • Benchmark available at http://gggeek.altervista.org/sw/article_20070425.html Stephan Schmidt | 1&1 Internet AG
  • 24. Encoding data with PHP • Extension provides json_encode() function • Encodes any value, except resources, in JSON format • Requires UTF-8 data $data = array(1,2,3); $json = json_encode($data); Stephan Schmidt | 1&1 Internet AG
  • 25. Decoding data with PHP • Extension provides json_decode() function • Decodes any JSON-string to PHP data structures • Objects can be decoded to stdClass instances or arrays $json = quot;[1,2,3]quot;; $data = json_decode($json); Stephan Schmidt | 1&1 Internet AG
  • 26. Invoking a remote method Method of an object that is located on a different machine is invoked via the network. Already used in different areas: • RMI • SOAP • XML-RPC Stephan Schmidt | 1&1 Internet AG
  • 27. The JSON-RPC protocol JSON-RPC is a stateless and light-weight remote procedure call (RPC) protocol for inter-networking applications over HTTP. It uses JSON as the data format for all facets of a remote procedure call, including all application data carried in parameters. Source: http://www.json-rpc.org/ Stephan Schmidt | 1&1 Internet AG
  • 28. The JSON-RPC protocol • Inspired by the XML-RPC protocol • Request and response are serialized in JSON • Data is transported via HTTP • Very often used asynchronously, to avoid that the application is frozen while the request is being processed Stephan Schmidt | 1&1 Internet AG
  • 29. JSON-RPC Request The request is a single object with the following properties: • method A string containing the name. • params An array of objects • id A unique identifier of the request Stephan Schmidt | 1&1 Internet AG
  • 30. JSON-RPC Response The response is a single object with the following properties: • result The result of the method call • error An error object, if an error occurred • id The same identifier used in the request Stephan Schmidt | 1&1 Internet AG
  • 31. JSON-RPC examples Request { quot;methodquot;: quot;echoquot;, quot;paramsquot;: [quot;Hello JSON-RPCquot;], quot;idquot;: 1} Response { quot;resultquot;: quot;Hello JSON-RPCquot;, quot;errorquot;: null, quot;idquot;: 1} Stephan Schmidt | 1&1 Internet AG
  • 32. Let’s get practical • Implement a JavaScript class that provides a method to call arbitrary JSON- RPC services • Implement a PHP script, that acts as a server for this class • Use PHP to generate JavaScript proxies for existing PHP classes that make use of this JavaScript JSON-RPC client Stephan Schmidt | 1&1 Internet AG
  • 33. JSON-RPC Client (simplified) var JsonRpcClient = function(clientObj) { // map ids to callbacks var reqRespMapping = []; var callback = { // callback functions for asynchronous calls } this.createId = function() { // create a unique id }; }; Stephan Schmidt | 1&1 Internet AG
  • 34. JSON-RPC Client (simplified) var JsonRpcClient = function(clientObj) { this.doCall = function(classAndMethod, args) { var id = this.createId(); var jsonRpcReq = { method: classAndMethod, params: arr, id: id }; YAHOO.util.Connect.asyncRequest('POST', finalServiceUrl, callback, jsonRpcReq.toJSONString()); reqRespMapping.push(jsonRpcReq); return id; }; }; Stephan Schmidt | 1&1 Internet AG
  • 35. Using the JSON-RPC Client (simplified) // Callback object, as calls are asynchronous var CalculatorCallback = { callback__add: function(id, result, error) { alert(result); } } function add() { var a = document.getElementById('a').value; var b = document.getElementById('b').value; var client = new JsonRpcClient(CalculatorCallback); client.doCall('Calculator.add', [a,b]); } Stephan Schmidt | 1&1 Internet AG
  • 36. JSON-RPC Client • Name of the PHP class and method has been separated using a dot (“.”) • Callback method is called “callback__$METHOD” • YUI is used for XmlHttpRequest abstraction • The complete code can be downloaded from http://www.stubbles.net Stephan Schmidt | 1&1 Internet AG
  • 37. JSON-RPC Server • Decode the JSON-RPC request • Extract the class and the method name from the “method” property of the request object • Dynamically load the class • Create a stdClass object to contain the response and copy the id property from the request Stephan Schmidt | 1&1 Internet AG
  • 38. JSON-RPC Server (simplified) // Get the request $requestRaw = file_get_contents('php://input'); $request = json_decode($requestRaw); // Prepare the response $response = new stdClass(); $response->id = $request->id; // Get the class and method $methodRaw = $request->method; list($class, $method) = explode('.', $methodRaw); require_once quot;../{$class}.phpquot;; Stephan Schmidt | 1&1 Internet AG
  • 39. JSON-RPC Server • Use the Reflection API to create a new instance of the class • Use the Reflection API to dynamically invoke the method on this instance, passing the parameters from the JSON- RPC request Stephan Schmidt | 1&1 Internet AG
  • 40. JSON-RPC Server (simplified) try { $clazz = new ReflectionClass($class); $service = $clazz->newInstanceArgs(); // Invoke the method $methodObj = $clazz->getMethod($method); $result = $methodObj->invokeArgs($service, $request->params); $response->error = null; $response->result = $result; } catch (Exception $e) { } Stephan Schmidt | 1&1 Internet AG
  • 41. JSON-RPC Server • Set the “result” property, if the method call was successful. • Catch any exception during processing and set the “error” property • Encode the result in JSON and send it to the browser Stephan Schmidt | 1&1 Internet AG
  • 42. JSON-RPC Server (simplified) try { … } catch (Exception $e) { $response->error = $e->getMessage(); $response->result = null; } // Send the response echo json_encode($response); Stephan Schmidt | 1&1 Internet AG
  • 43. A JSON-RPC web application POST /projects/json-rpc/json-rpc/server.php HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 Accept-Encoding: gzip,deflate Keep-Alive: 300 Connection: keep-alive X-Requested-With: XMLHttpRequest Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Referer: http://localhost/projects/json-rpc/json-rpc/form.php Content-Length: 63 Pragma: no-cache Cache-Control: no-cache {quot;methodquot;:quot;Calculator.addquot;,quot;paramsquot;:[quot;28quot;, quot;14quot;],quot;idquot;:quot;1248167quot;} HTTP/1.x 200 OK Date: Sun, 25 May 2008 10:48:44 GMT Server: Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5 X-Powered-By: PHP/5.2.5 Content-Length: 41 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html {quot;idquot;:quot;1246838quot;,quot;errorquot;:null,quot;resultquot;:42} Stephan Schmidt | 1&1 Internet AG
  • 44. JSON-RPC Proxy generation • Dynamically create a JavaScript class, that encapsulates the doCall() calls on the JsonRpcClient object • Use PHP’s reflection API to extract all public methods from any PHP class • Provide this functionality over HTTP to generate the clients on-the-fly. Stephan Schmidt | 1&1 Internet AG
  • 45. JSON-RPC Proxy Generator // dynamically load the class $className = $_GET['class']; require_once quot;../{$className}.phpquot;; $clazz = new ReflectionClass($className); // Create a JavaScript class for this class echo quot;var {$className} = function(clientObj) {nquot;; echo quot; this.dispatcher = new JsonRpcClient(clientObj);nquot;; echo quot;};nquot;; Stephan Schmidt | 1&1 Internet AG
  • 46. JSON-RPC Proxy Generator // Iterate over all methods foreach ($clazz->getMethods() as $method) { // only export public methods to the proxy if (!$method->isPublic()) { continue; } $methodName = $method->getName(); // JS generation on next slide } Stephan Schmidt | 1&1 Internet AG
  • 47. JSON-RPC Proxy Generator // Iterate over all methods foreach ($clazz->getMethods() as $method) { $methodName = $method->getName(); echo quot;{$className}.prototype.{$methodName} = function() {nquot;; // route this call to the server echo “ return this.dispatcher.doCall( '{$className}.{$methodName}', arguments);nquot;; echo quot;};nquot;; } Stephan Schmidt | 1&1 Internet AG
  • 48. Using the JSON-RPC Proxy generator • Generated JavaScript code can be loaded the same way as static JavaScript code, using the src-attribute of the <script/> tag • Generated JavaScript provides a new JavaScript class that resembles the PHP class and is used as a proxy Stephan Schmidt | 1&1 Internet AG
  • 49. Using the JSON-RPC Proxy generator <script type=quot;text/javascriptquot; src=quot;./proxygen.php?class=Calculatorquot;></script> Resulting JavaScript var Calculator = function(clientObj) { this.dispatcher = new JsonRpcClient(clientObj); }; Calculator.prototype.add = function() { return this.dispatcher.doCall( 'Calculator.add', arguments); }; Stephan Schmidt | 1&1 Internet AG
  • 50. Using the JSON-RPC Proxy var CalculatorCallback = { callback__add: function(id, result, error) { alert(result); } } function add() { var a = document.getElementById('a').value; var b = document.getElementById('b').value; var calc = new Calculator(CalculatorCallback); calc.add(a, b); } Stephan Schmidt | 1&1 Internet AG
  • 51. Problems with this approach • Server-side code generates client side code, which leads to a tight coupling between PHP code and JavaScript code • Client framework cannot easily be replaced • We need something like WSDL for JSON- RPC Stephan Schmidt | 1&1 Internet AG
  • 52. Enter SMD SMD = Simple Method Description • Very easy data structure, that describes all methods and their parameters, that a service provides • Encoded in JSON format • Invented by the Dojo Toolkit • Might be replaced by “Service Mapping Description” Stephan Schmidt | 1&1 Internet AG
  • 53. Format of an SMD SMD always contains: • The SMD version • Name of the object or class it represents • Service type (e.g. JSON-RPC) • Service URL • Array of all available methods and their parameters Stephan Schmidt | 1&1 Internet AG
  • 54. Example SMD {quot;SMDVersionquot;:quot;.1quot;, quot;objectNamequot;:quot;Calculatorquot;, quot;serviceTypequot;:quot;JSON-RPCquot;, quot;serviceURLquot;:quot;./server.phpquot;, quot;methodsquot;:[ {quot;namequot;:quot;addquot;, quot;parametersquot;:[ {quot;namequot;:quot;aquot;, quot;typequot;:quot;INTEGERquot;}, {quot;namequot;:quot;bquot;, quot;typequot;:quot;INTEGERquot;} ]} ]} Stephan Schmidt | 1&1 Internet AG
  • 55. Generating SMD with PHP $className = $_GET['class']; require_once quot;../{$className}.phpquot;; $clazz = new ReflectionClass($className); $smdData = new stdClass(); $smdData->SMDVersion = 1; $smdData->serviceType = 'JSON-RPC'; $smdData->serviceURL = './server-smd.php?class=' . $className; $smdData->objectName = $className; $smdData->methods = array(); Stephan Schmidt | 1&1 Internet AG
  • 56. Generating SMD with PHP foreach ($clazz->getMethods() as $method) { if (!$method->isPublic()) { continue; } $methodDef = new stdClass(); $methodDef->name = $method->getName(); $methodDef->parameters = array(); $smdData->methods[] = $methodDef; foreach ($method->getParameters() as $parameter) { $paramDef = new stdClass(); $paramDef->name = $parameter->getName(); $methodDef->parameters[] = $paramDef; } } echo json_encode($smdData); Stephan Schmidt | 1&1 Internet AG
  • 57. Using SMD with the Dojo Toolkit • First framework that makes use of SMD • Dynamically generates proxies at run-time based on an SMD structure, JSON-String or URL • Extremely easy to use • Similar to ext/soap in PHP 5 Stephan Schmidt | 1&1 Internet AG
  • 58. Using SMD with the Dojo Toolkit <script type=quot;text/javascriptquot; src=quot;http://...dojo/dojo.xd.jsquot;></script> djConfig.usePlainJson = true; dojo.require('dojo.rpc.JsonService'); var smdURL = './smdgen.php?class=Calculator'; proxy = new dojo.rpc.JsonService(smdURL); Server returns this SMD: {quot;SMDVersionquot;:1,quot;serviceTypequot;:quot;JSON-RPCquot;,quot;serviceURLquot;:quot;./server- smd.php?class=Calculatorquot;,quot;methodsquot;:[{quot;namequot;:quot;addquot;,quot;parametersquot;:[{quot;namequot;:quot;aquot;}, {quot;namequot;:quot;bquot;}]}],quot;objectNamequot;:quot;Calculatorquot;} Stephan Schmidt | 1&1 Internet AG
  • 59. Using the proxy // Dojo only needs a callback function, no object function doAddCallback(result) { alert(result); } function add() { var a = document.getElementById('a').value; var b = document.getElementById('b').value; // Execute the call and add the callback proxy.add(a, b).addCallback(doCalcCallback); } Stephan Schmidt | 1&1 Internet AG
  • 60. Existing Frameworks Several frameworks already provide the generation of proxies: • pecl/SCA_SDO • PEAR::HTML_AJAX (no real JSON-RPC) • Sajax (no real JSON-RPC) • Stubbles – The only framework that implements the JSON-RPC and SMD specs Stephan Schmidt | 1&1 Internet AG
  • 61. Thank you Any Questions? schst@stubbles.net http://www.stubbles.net http://www.stubbles.org Stephan Schmidt | 1&1 Internet AG