0% found this document useful (0 votes)
27 views19 pages

4 Soap XMLRPC

XML-RPC and SOAP are protocols that allow for remote procedure calls over HTTP. XML-RPC uses XML to encode procedure calls and responses, while SOAP builds on this to support more complex data types and namespaces. Both protocols transmit requests and responses within HTTP messages to leverage existing infrastructure. While XML-RPC is simpler, SOAP enables more robust data exchange and supports multiple protocols. Resources are available to help programmers work with these XML-based messaging standards.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views19 pages

4 Soap XMLRPC

XML-RPC and SOAP are protocols that allow for remote procedure calls over HTTP. XML-RPC uses XML to encode procedure calls and responses, while SOAP builds on this to support more complex data types and namespaces. Both protocols transmit requests and responses within HTTP messages to leverage existing infrastructure. While XML-RPC is simpler, SOAP enables more robust data exchange and supports multiple protocols. Resources are available to help programmers work with these XML-based messaging standards.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 19

XML-RPC and SOAP

Netprog: Soap & XML-RPC 1


XML
Extensible Markup Language
Markup Language.
HTML is also a markup language (but it's
not extensible!).
XML allows you to make up your own
tags.
Document Type Definition
Schema

Netprog: Soap & XML-RPC 2


Sample XML
<?xmlversion="1.0"?>
<student>
<rid>660012345</rid>
<first>Joe</first>
<middle>X.</middle>
<last>Smith</last>
<coursessemester="fall02">
<course>
<name>ExploitingtheInformation
World</name>
<crn>12345</crn>
<num>ITEC2110</num>
</course>
</courses>
<address>123mainstreet</address>
<phone>5552929</phone>
</student>Netprog: Soap & XML-RPC 3
So What ?
XML generation is simple
XML Parsing is also pretty simple
there are lots of parsers available!
Browsers understand XML (somewhat).
CSS style sheets
XSL: Extensible Stylesheet Language
XML can be used for document storage
and transfer.
Netprog: Soap & XML-RPC 4
XML messaging
RPC: XML is used to encode procedure
calls and responses.

EDI: Electronic Document Interchange


transfer documents between applications
across a network
purchase orders, financial transactions, etc.

Netprog: Soap & XML-RPC 5


XML-RPC
Use XML to encode requests
procedure name
parameter values
Response is also an XML document
return value(s)
errors (faults)
Both are well defined document types
tag names are defined in the XML-RPC
specification document.

Netprog: Soap & XML-RPC 6


Uses HTTP POST
Use existing protocol (and software!).
Avoid firewall issues (everyone allows
HTTP traffic).
XML-RPC Request is the body of an
HTTP POST.
XML-RPC Response is the body
(content) of the HTTP response.

Netprog: Soap & XML-RPC 7


Example Request
(swiped from xml-rpc.com)
POST /RPC2 HTTP/1.0
Host: betty.userland.com
User-Agent: Frontier/5.1.2 (WinNT)
Content-Type: text/xml
Content-length: 181

<?xml version="1.0"?>
<methodCall>
<methodName>examples.getStateName</methodName>
<params>
<param>
<value><i4>41</i4></value>
</param>
</params>
</methodCall>
Netprog: Soap & XML-RPC 8
HTTP/1.1 200 OK
Sample
Connection: close
Content-Length: 158
Response
Content-Type: text/xml
Date: Fri, 17 Jul 1998 19:55:08 GMT
Server: UserLand Frontier/5.1.2-WinNT<p>

<xml version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<string>South Dakota</string>
</value>
</param>
</params>
</methodResponse>
Netprog: Soap & XML-RPC 9
XML-RPC Data Types
<int> or <i4>
<boolean>
<string>
<double>
<dateTime.iso8601>
<struct>
<array>
Netprog: Soap & XML-RPC 10
<struct>
<member>
XML-RPC struct
<name>Hostname</name>
<value>
<string>monte.cs.rpi.edu</string>
</value>
</member>
<member>
<name>IPAddress</name>
<value>
<string>128.213.7.32</string>
</value>
</member>
</struct>
Netprog: Soap & XML-RPC 11
XML-RPC array
<array>
<data>
<value><i4>12</i4></value>
<value><string>Egypt</string></value>
<value><boolean>0</boolean></value>
<value><i4>-31</i4></value>
</data>
</array>

Netprog: Soap & XML-RPC 12


XML-RPC Programming
Need to be able to generate HTTP
requests (client) and responses(server).
Need to generate XML documents.
Need to parse XML documents and
extract specific items.
Need to handle faults (errors).

Netprog: Soap & XML-RPC 13


SOAP
Simple Object Access Protocol
Same general idea as XML-RPC, but
more features:
enumerations
Polymorphism (type determined at run
time)
user defined data types

Netprog: Soap & XML-RPC 14


SOAP
XML Documents are more complex
use namespaces
formal "envelope"
Soap Header
Soap Body

Netprog: Soap & XML-RPC 15


SOAP Request Example
POST /StockQuote HTTP/1.1
Host: www.stockquoteserver.com
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "Some-URI"

<SOAP-ENV:Envelope
xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:GetLastTradePrice xmlns:m="Some-URI">
<symbol>DIS</symbol>
</m:GetLastTradePrice>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Netprog: Soap & XML-RPC 16


XML-RPC vs. SOAP
XML-RPC is much simpler
There are lots of web services based on
XML-RPC.
SOAP makes it easier to exchange
more complex documents.
SOAP runs over many protocols:
HTTP, SMTP, FTP,

Netprog: Soap & XML-RPC 17


SOAP is an integral part of .NET

Programmer Transparency
Multiple Languages

Netprog: Soap & XML-RPC 18


Resources
xml-rpc.com (userland)
specification, info, tutorials, code resources

www.soapware.org
tutorials, code resources

www.w3.org
SOAP specification
Netprog: Soap & XML-RPC 19

You might also like