XMLRPC and SOAP - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

XMLRPC and SOAP

Description:

address 123 main street /address phone 555-2929 /phone /student Netprog: Soap & XML-RPC ... CSS style sheets. XSL: Extensible Stylesheet Language ... – PowerPoint PPT presentation

Number of Views:82
Avg rating:3.0/5.0
Slides: 20
Provided by: dav80
Category:
Tags: soap | xmlrpc

less

Transcript and Presenter's Notes

Title: XMLRPC and SOAP


1
XML-RPC and SOAP
2
XMLExtensible 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

3
Sample XML
  • lt?xml version"1.0"?gt
  • ltstudentgt
  • ltridgt660012345lt/ridgt
  • ltfirstgtJoelt/firstgt
  • ltmiddlegtX.lt/middlegt
  • ltlastgtSmithlt/lastgt
  • ltcourses semester"fall02"gt
  • ltcoursegt
  • ltnamegtExploiting the Information
    Worldlt/namegt
  • ltcrngt12345lt/crngt
  • ltnumgtITEC-2110lt/numgt
  • lt/coursegt
  • lt/coursesgt
  • ltaddressgt123 main streetlt/addressgt
  • ltphonegt555-2929lt/phonegt
  • lt/studentgt

4
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.

5
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.

6
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.

7
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.

8
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
  • lt?xml version"1.0"?gt
  • ltmethodCallgt ltmethodNamegtexamples.getStateNamelt/me
    thodNamegt ltparamsgt
  • ltparamgt
  • ltvaluegtlti4gt41lt/i4gtlt/valuegt
  • lt/paramgt
  • lt/paramsgt
  • lt/methodCallgt

9
Sample Response
  • HTTP/1.1 200 OK
  • Connection close
  • Content-Length 158
  • Content-Type text/xml
  • Date Fri, 17 Jul 1998 195508 GMT
  • Server UserLand Frontier/5.1.2-WinNTltpgt
  • ltxml version"1.0"?gt
  • ltmethodResponsegt
  • ltparamsgt
  • ltparamgt
  • ltvaluegt
  • ltstringgtSouth Dakotalt/stringgt
  • lt/valuegt
  • lt/paramgt
  • lt/paramsgt
  • lt/methodResponsegt

10
XML-RPC Data Types
  • ltintgt or lti4gt
  • ltbooleangt
  • ltstringgt
  • ltdoublegt
  • ltdateTime.iso8601gt
  • ltstructgt
  • ltarraygt

11
XML-RPC struct
  • ltstructgt
  • ltmembergt
  • ltnamegtHostnamelt/namegt
  • ltvaluegt
  • ltstringgtmonte.cs.rpi.edult/stringgt
  • lt/valuegt
  • lt/membergt
  • ltmembergt
  • ltnamegtIPAddresslt/namegt
  • ltvaluegt
  • ltstringgt128.213.7.32lt/stringgt
  • lt/valuegt
  • lt/membergt
  • lt/structgt

12
XML-RPC array
ltarraygt ltdatagt ltvaluegtlti4gt12lt/i4gtlt/valuegt
ltvaluegtltstringgtEgyptlt/stringgtlt/valuegt
ltvaluegtltbooleangt0lt/booleangtlt/valuegt
ltvaluegtlti4gt-31lt/i4gtlt/valuegt lt/datagt lt/arraygt
13
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).

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

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

16
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"
  • ltSOAP-ENVEnvelope
  • xmlnsSOAP-ENVhttp//schemas.xmlsoap.org/soap/e
    nvelope/
  • SOAP-ENVencodingStyle"http//schemas.xmlsoap.o
    rg/soap/encoding/"gt
  • ltSOAP-ENVBodygt ltmGetLastTradePrice
    xmlnsm"Some-URI"gt      ltsymbolgtDISlt/symbolgt  lt
    /mGetLastTradePricegtlt/SOAP-ENVBodygt
  • lt/SOAP-ENVEnvelopegt

17
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,

18
SOAP is an integral part of .NET
  • Programmer Transparency
  • Multiple Languages

19
Resources
  • xml-rpc.com (userland)
  • specification, info, tutorials, code resources
  • www.soapware.org
  • tutorials, code resources
  • www.w3.org
  • SOAP specification
Write a Comment
User Comments (0)
About PowerShow.com