Category: Entertainment

Presentation Description

No description available.


By: sherifmayika (129 month(s) ago)


Presentation Transcript

Creating and Connecting to XML-RPC Web Services: 

Creating and Connecting to XML-RPC Web Services Presented by Adam Platti aplatti@hotmail.com Maine JUG March 20, 2002

Who is this guy?: 

Who is this guy? Just moved to Portland from London to live with my girlfriend In London, I worked for a P2P gambling website called Flutter.com The web’s first e-commerce XML-RPC browser based UI (I think )

Silicon Valley Experience: 

Silicon Valley Experience Kodak Imagination Works C-Bridge Internet Consulting (Excelon) Consulted with Chevron Broadband Mechanics Founded by Marc Canter (Macromedia) DigiScents IDEO Flutter.com

XML-RPC Experience: 

XML-RPC Experience Been using XML-RPC for 3 years JavaScript, Java, Userland Frontier, Python, Zope First at Broadband Mechanics TV/Web broadcast production tools for satellite TV station DHTML applications ran in a single web page Flutter.com DHTML XML-RPC UI for P2P gambling

Other Projects: 

Other Projects Burning Man Festival Hypknowtron Ransom Letters Hollywood-style “Ransom Letter” generator and tools

Presentation Outline: 

Presentation Outline Web Services and RPC Ransom Letters Demos The XML-RPC Protocol XML-RPC Client/Server Setup Java XML-RPC Client/Server JavaScript XML-RPC Client Userland Frontier Flutter.com User Interface Demo

Example of Using the Web Today: 

Example of Using the Web Today Consumer services mostly accessible as HTML Forms Example: To buy a product Open browser to website Fill out multiple HTML forms and submit them Feedback from transactions is HTML Accessing these services by programs difficult

What is a Web Service?: 

What is a Web Service? Component procedures remotely accessible via standard web formats and protocols. Specifically XML and HTTP Apps can communicate over the web with all devices and platforms Anything that can speak XML and HTTP can participate Deploy services to widest possible audience

What is a Web Service? (2): 

What is a Web Service? (2) A new web paradigm for distributed application development Service vendors can deploy a web service API No need for in house front end development Clients connect to the API over HTTP from whatever environment they use

Demo: Ransom Letters: 

Demo: Ransom Letters Shows multiple environments connecting together with XML-RPC Userland Frontier as Ransom Letters server Methods written in Frontier add/retrieve letters over XML-RPC 2 Clients access database via XML-RPC Ransom Letter Typewriter (IE DHTML Client) Pulls urls of letters out Letter Collection Tool (Visual Basic Client) Puts letters in

Remote Procedure Call Basics: 

Remote Procedure Call Basics What are the parts of an RPC ? A network A client computer A remote procedure on a server Method name Parameters Return Value

What is XML-RPC?: 

What is XML-RPC? Protocol that allows different platforms to interoperate with each other over the web “Less is More” Lacks most overhead of other RPC mechanisms Simple XML Object Serialization to XML Lowest common denominator data types that can map to almost any language/environment

XML-RPC Request Lifecycle: 

XML-RPC Request Lifecycle Client specifies remote method and passes native parameters to client XML-RPC library Native parameters “marshalled” into XML with method name to make request message XML request message sent to RPC computer over HTTP Remote computer “unmarshalls” params and executes specified procedure

XML-RPC Request Lifecycle (2): 

XML-RPC Request Lifecycle (2) Return value of procedure “marhshalled” into XML response message Response message sent back to client Client “unmarshalls” return value and passes the object to the caller

XML-RPC Data Types: 

XML-RPC Data Types Types for Parameters and Return Values Integer (4 bytes) Double Boolean DateTime (ISO 8601) String Base64 Array ordered list Struct contains objects accessible by a string key

Mapping XML-RPC Types to Java: 

Mapping XML-RPC Types to Java

XML-RPC Types to JavaScript: 

XML-RPC Types to JavaScript

An XML-RPC Request: 

An XML-RPC Request Method Name A-Z, a-z, 0-9, dot, colon, slash characters Mapping of method name to procedure is not specified Method Parameters Parameter order must match the order that they are declared for the target method Some languages require that the types also match

Sample XML-RPC Request: 

Sample XML-RPC Request

XML-RPC Response Message: 

XML-RPC Response Message Contains a return value or a fault Fault structure contains error info An implementation specific fault code An implementation specific fault message

Sample XML-RPC Response: 

Sample XML-RPC Response

Sample XML-RPC Fault Response: 

Sample XML-RPC Fault Response

Demo: Connecting to a Web Service With Java: 

Demo: Connecting to a Web Service With Java Use Apache XML-RPC library’s XmlRpcClient class Connect to a simple method in Userland Frontier Synchronous connection Asynchronous connection

Demo: Creating an XML-RPC Service: 

Demo: Creating an XML-RPC Service Using Apache XML-RPC library Compile XmlRpcServer object into servlet Call “addHandler” method to attach object you want to make XML-RPC accessible Connect to the new web service in JavaScript

XML-RPC in Internet Explorer: 

XML-RPC in Internet Explorer Builds the XML request with strings XML gets sent with XMLHTTP ActiveX Control Response XML parsed automatically Scripts traverse XML DOM to unmarshall the response object Response object returned to calling script

XML-RPC in Internet Explorer: XMLHTTP ActiveX control: 

XML-RPC in Internet Explorer:XMLHTTP ActiveX control Uses “XMLHTTP” ActiveX Control Makes an HTTP from script in background Supports synch/asynch communication XML content returned automatically parsed Response body can also be processed as plain text

Demo: Connecting to Java with JavaScript: 

Demo: Connecting to Java with JavaScript Using my XML-RPC library for JavaScript (others available at http://www.xmlrpc.com) We’ll connect to the service we created with Java Connect to Frontier services too

XML-RPC Strengths: 

XML-RPC Strengths Simplicity Minimal use of XML features Visually understandable messages Easy to build clients/servers for any platform LESS IS MORE Firewall compatible

XML-RPC Strengths (2): 

XML-RPC Strengths (2) XML details are transparent to developers Clients Pass native data types for parameters Caller receives return values XML-RPC client handles translations to/from XML Server Components Methods take native parameters Methods return native types values XML-RPC server handles translations to/from XML


XML-RPC vs. SOAP SOAP is very similar to XML-RPC Both use XML and HTTP Both are RPC mechanisms SOAP is more feature rich Gives more control over XML content Supports XML namespaces and schemas Supports User Defined Types Message defined processing instructions

XML-RPC vs. SOAP (2): 

XML-RPC vs. SOAP (2) XML-RPC is about simplicity 7 page spec (40+ pages for SOAP) Lowest common denominator data types cover most needs Does not require fancy development tools to make it “easy to use” XML-RPC is a frozen spec

Some XML-RPC Weaknesses: 

Some XML-RPC Weaknesses LESS IS MORE Verbose tag names make messages large Method parameters only passed by order Not possible to extend supported data types Check “XML-RPC vs. SOAP” article by Kate Rhodes for some other comparisons

Flutter.com & P2P Gambling: 

Flutter.com & P2P Gambling Gamblers get better odds betting against each other than against the house The house dictates odds for their own profits P2P lets the market decide the odds

Flutter.com’s DHTML XML-RPC Interface: 

Flutter.com’sDHTML XML-RPC Interface Leveraged XML-RPC in browser for continuous betting experience Application-like behavior in single web page Supported multiple transactions simultaneously Gamblers view of market never interrupted Over two million pounds a week in matched bets

Demo: Flutter’s DHTML XML-RPC UI: 

Demo: Flutter’s DHTML XML-RPC UI Viewing bets in market Place bets Managing your existing bets

Conclusion Summary: 

Conclusion Summary XML-RPC is an easy way to connect different environments together Learned how to set up XML-RPC clients and servers in Java Learned a little about XML-RPC in the browser Saw some cool demos of my work

Where can I learn more about XML-RPC?: 

Where can I learn more about XML-RPC? Scripting News (http://www.scripting.com) Dave Winer’s Weblog Great updates on current events with XML-RPC and SOAP http://www.xmlrpc.com The spec Open source implementations Tutorials, etc. Apache XML-RPC for Java Project http://xml.apache.org/xmlrpc/ XMLRPC, O’Reilly Book


Questions? I can answer questions now You can ask me questions later too: Adam Platti aplatti@hotmail.com 207-775-4965


XML-RPC vs. CORBA CORBA: popular protocol for distributed applications Supported by many vendors and free software projects Works well with many languages including Java and C++ Interface Definition Language (IDL) allows you to define readable, object oriented APIs

XML-RPC vs. CORBA (2): 

XML-RPC vs. CORBA (2) CORBA is very complex Steep learning curve Requires sophisticated clients Requires significant effort to implement XML-RPC lacks most CORBA infrastructure Designed for simplicity of implementation Designed for web standards Firewalls


XML-RPC vs. DCOM DCOM is “CORBA” for Windows Great if you are already using COM Only communicate with windows components XML-RPC Multi-platform accessible Uses web standards (HTTP, XML)

What do I care? Java is already on all platforms!: 

What do I care? Java is already on all platforms! Deploy services to widest audience Use services not written in Java for your apps Connect with competing products easily The web’s future is as a heterogeneous platform Visual Studio .NET - all languages can compile to CLR SOAP, XML-RPC picking up steam

XML-RPC vs. Java RMI: 

XML-RPC vs. Java RMI RMI is cross-platform but Java only RMI does not use web protocols RMI is not firewall friendly

authorStream Live Help