XML Over The Web Today

Download Report

Transcript XML Over The Web Today

XML Over The
Web Today
Dino Esposito
Wrox Press
6-313
Agenda




Present and future of XML and HTTP
XmlHttpRequest
Using XmlHttpRequest in
Visual C++® apps
Architecturally speaking…
Why XML




Text-based and human-authorable
Available on (almost) all platforms
Great for describing data
Designed to be simple and effective
Why HTTP



Broadly accepted
Jumps through firewalls
Designed to be simple but effective

No runtime support unlike DCOM
Why XML And HTTP




Another (better?) component model
Increase interoperability
No mandated API or runtime
Industry standards
The World Without XML

HTML and ASP


Remote data services


Server-side pages
COM calls through HTTP
Remote scripting

ECMAScript calls through HTTP
The World Without HTTP

DCOM


COM Internet services


Complexity and dynamic ports
DCOM over HTTP via tunneling TCP
Internet InterORB protocol

Protocol to connect different ORBs
The World With XML+HTTP

Connect to remote services



Platform and language neutrality
Send and receive XML text
Get the best of both worlds


Encoding and data representation
Connect to a Linux CGI from Visual Basic®!
SOAP Breaks In

Services over the network





Connect through HTTP
Communicate through XML
An XML-based language for remote
method invocation
Open specification with trial
implementations
Doesn’t reinvent any wheel
Agenda




Present and future of XML and HTTP
XmlHttpRequest
Using XmlHttpRequest in
Visual C++ apps
Architecturally speaking…
XmlHttpRequest?



Part of MSXML (Microsoft.XMLHTTP)
Arbitrary HTTP requests and responses
Does not use SOAP (yet?)
XmlHttpRequest And SOAP
Web Service
XmlHttpRequest
URL
Web Service
SOAP Request
SOAP Response
XMLDOM
Client
COM-based client
How It Works




Create an instance of the object
Set operation and URL
Send data
Get the response

Raw text, XMLDOM, IStream, array
A XMLHTTP Request
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", “http://expoware/demo/test.asp",
false
xmltext = "<magazine>MSDN</magazine>"
Set xmldom = CreateObject("Microsoft.XMLDOM")
xmldom.loadXML xmltext
xmlhttp.send xmldom
A XMLHTTP Response
<%
set xmldom = Server.CreateObject("Microsoft.XMLDOM")
xmldom.load(Request)
set n = xmldom.selectSingleNode("magazine")
n.text = “MSDN Magazine"
strText = “New text is: " & xmldom.xml
Response.Write strText
%>
Methods And Properties
Description
Method/Property
open
M
Sets the params for the conversation
send
M
Sends data through HTTP
abort
M
Cancels the current operation
readyState
P
Readiness of the object
responseText
P
Response as raw text
responseXML
P
Response as XMLDOM
responseBody
P
Response as an array of bytes
Agenda




Present and future of XML and HTTP
XmlHttpRequest
Using XmlHttpRequest in
Visual C++ apps
Architecturally speaking…
Example #1

C++ application that utilizes
the component
XmlHttpRequest
Example #2

MFC application that fills its own UI with
XML data taken from an ASP page
XmlHttpRequest
XmlHttpRequest
Exchanging XMLDOM


Use send to pass an XMLDOM
Target ASP pages process it


xml.loadXML(Request)
ASP page returns XML text


Set ContentType to text/xml
Use responseXML to retrieve it
Agenda




Present and future of XML and HTTP
XmlHttpRequest
Using XmlHttpRequest in
Visual C++ apps
Architecturally speaking…
Web Services

Any service available on the Web



Components, applications, servers, pages
Platform and language neutrality
Web services versus DCOM
New Web Apps
Web client
Components
Win32 client
Web Server
Other platform
client
Operating
System
Any platform!
Data
Store