xml over the web today dino esposito wrox press 6-313

25
XML Over The XML Over The Web Today Web Today Dino Esposito Dino Esposito Wrox Press Wrox Press 6-313 6-313

Upload: damon-cooper

Post on 30-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: XML Over The Web Today Dino Esposito Wrox Press 6-313

XML Over The XML Over The Web TodayWeb Today

Dino EspositoDino EspositoWrox PressWrox Press

6-3136-313

Page 2: XML Over The Web Today Dino Esposito Wrox Press 6-313
Page 3: XML Over The Web Today Dino Esposito Wrox Press 6-313

AgendaAgenda

Present and future of XML and HTTPPresent and future of XML and HTTP XmlHttpRequestXmlHttpRequest Using XmlHttpRequest in Using XmlHttpRequest in

Visual C++Visual C++®® apps apps Architecturally speaking…Architecturally speaking…

Page 4: XML Over The Web Today Dino Esposito Wrox Press 6-313

Why XMLWhy XML

Text-based and human-authorableText-based and human-authorable Available on (almost) all platformsAvailable on (almost) all platforms Great for describing dataGreat for describing data Designed to be simple and effectiveDesigned to be simple and effective

Page 5: XML Over The Web Today Dino Esposito Wrox Press 6-313

Why HTTPWhy HTTP

Broadly accepted Broadly accepted Jumps through firewallsJumps through firewalls Designed to be simple but effectiveDesigned to be simple but effective

No runtime support unlike DCOMNo runtime support unlike DCOM

Page 6: XML Over The Web Today Dino Esposito Wrox Press 6-313

Why XML And HTTPWhy XML And HTTP

Another (better?) component modelAnother (better?) component model Increase interoperabilityIncrease interoperability No mandated API or runtimeNo mandated API or runtime Industry standardsIndustry standards

Page 7: XML Over The Web Today Dino Esposito Wrox Press 6-313

The World Without XMLThe World Without XML

HTML and ASPHTML and ASP Server-side pagesServer-side pages

Remote data services Remote data services COM calls through HTTPCOM calls through HTTP

Remote scriptingRemote scripting ECMAScript calls through HTTPECMAScript calls through HTTP

Page 8: XML Over The Web Today Dino Esposito Wrox Press 6-313

The World Without HTTPThe World Without HTTP

DCOMDCOM Complexity and dynamic ports Complexity and dynamic ports

COM Internet servicesCOM Internet services DCOM over HTTP via tunneling TCPDCOM over HTTP via tunneling TCP

Internet InterORB protocolInternet InterORB protocol Protocol to connect different ORBsProtocol to connect different ORBs

Page 9: XML Over The Web Today Dino Esposito Wrox Press 6-313

The World With XML+HTTPThe World With XML+HTTP

Connect to remote services Connect to remote services Platform and language neutrality Platform and language neutrality

Send and receive XML text Send and receive XML text Get the best of both worldsGet the best of both worlds

Encoding and data representationEncoding and data representation Connect to a Linux CGI from Visual BasicConnect to a Linux CGI from Visual Basic®®!!

Page 10: XML Over The Web Today Dino Esposito Wrox Press 6-313

SOAP Breaks InSOAP Breaks In

Services over the networkServices over the network Connect through HTTPConnect through HTTP Communicate through XML Communicate through XML

An XML-based language for remote An XML-based language for remote method invocationmethod invocation

Open specification with trial Open specification with trial implementations implementations

Doesn’t reinvent any wheelDoesn’t reinvent any wheel

Page 11: XML Over The Web Today Dino Esposito Wrox Press 6-313

AgendaAgenda

Present and future of XML and HTTPPresent and future of XML and HTTP XmlHttpRequestXmlHttpRequest Using XmlHttpRequest in Using XmlHttpRequest in

Visual C++ appsVisual C++ apps Architecturally speaking…Architecturally speaking…

Page 12: XML Over The Web Today Dino Esposito Wrox Press 6-313

XmlHttpRequest?XmlHttpRequest?

Part of MSXML (Part of MSXML (Microsoft.XMLHTTPMicrosoft.XMLHTTP)) Arbitrary HTTP requests and responsesArbitrary HTTP requests and responses Does not use SOAP (yet?)Does not use SOAP (yet?)

Page 13: XML Over The Web Today Dino Esposito Wrox Press 6-313

XmlHttpRequest And SOAPXmlHttpRequest And SOAP

ClientClient

Web ServiceWeb Service

SOAP RequestSOAP Request SOAP ResponseSOAP Response

Web ServiceWeb Service

COM-based clientCOM-based client

XmlHttpRequestXmlHttpRequest

URLURL XMLDOMXMLDOM

Page 14: XML Over The Web Today Dino Esposito Wrox Press 6-313

How It WorksHow It Works

Create an instance of the objectCreate an instance of the object Set operation and URL Set operation and URL Send dataSend data Get the response Get the response

Raw text, XMLDOM, IStream, arrayRaw text, XMLDOM, IStream, array

Page 15: XML Over The Web Today Dino Esposito Wrox Press 6-313

A XMLHTTP RequestA XMLHTTP Request

SSet xmlhttp = CreateObject("Microsoft.XMLHTTP")et xmlhttp = CreateObject("Microsoft.XMLHTTP")

xmlhttp.open "GET", xmlhttp.open "GET", “h“http://expoware/ttp://expoware/demodemo/test.asp",/test.asp",

falsefalse

xmltext = "<magazine>MSDN</magazine>"xmltext = "<magazine>MSDN</magazine>"

SSet xmldom = CreateObject("Microsoft.XMLDOM")et xmldom = CreateObject("Microsoft.XMLDOM")

xmldom.loadXML xmltextxmldom.loadXML xmltext

xmlhttp.send xmldomxmlhttp.send xmldom

Page 16: XML Over The Web Today Dino Esposito Wrox Press 6-313

A XMLHTTP ResponseA XMLHTTP Response

<%<%

set xmldom = Server.CreateObject("Microsoft.XMLDOM")set xmldom = Server.CreateObject("Microsoft.XMLDOM")

xmldom.load(Request)xmldom.load(Request)

set n = xmldom.selectSingleNode("magazine")set n = xmldom.selectSingleNode("magazine")

n.text = “MSDN Magazine"n.text = “MSDN Magazine"

strText = “strText = “New text isNew text is: " & xmldom.xml : " & xmldom.xml

Response.Write strTextResponse.Write strText

%>%>

Page 17: XML Over The Web Today Dino Esposito Wrox Press 6-313

Methods And PropertiesMethods And Properties

Page 18: XML Over The Web Today Dino Esposito Wrox Press 6-313

AgendaAgenda

Present and future of XML and HTTPPresent and future of XML and HTTP XmlHttpRequestXmlHttpRequest Using XmlHttpRequest in Using XmlHttpRequest in

Visual C++ appsVisual C++ apps Architecturally speaking…Architecturally speaking…

Page 19: XML Over The Web Today Dino Esposito Wrox Press 6-313

Example #1Example #1

C++ application that utilizes C++ application that utilizes the componentthe component

XmlHttpRequest

Page 20: XML Over The Web Today Dino Esposito Wrox Press 6-313

Example #2Example #2

MFC application that fills its own UI with MFC application that fills its own UI with XML data taken from an ASP pageXML data taken from an ASP page

XmlHttpRequest

XmlHttpRequest

Page 21: XML Over The Web Today Dino Esposito Wrox Press 6-313

Exchanging XMLDOMExchanging XMLDOM

Use Use sendsend to pass an XMLDOM to pass an XMLDOM Target ASP pages process itTarget ASP pages process it

xml.loadXML(Request)xml.loadXML(Request) ASP page returns XML text ASP page returns XML text

Set ContentType to text/xmlSet ContentType to text/xml Use responseXML to retrieve itUse responseXML to retrieve it

Page 22: XML Over The Web Today Dino Esposito Wrox Press 6-313

AgendaAgenda

Present and future of XML and HTTPPresent and future of XML and HTTP XmlHttpRequestXmlHttpRequest Using XmlHttpRequest in Using XmlHttpRequest in

Visual C++ appsVisual C++ apps Architecturally speaking…Architecturally speaking…

Page 23: XML Over The Web Today Dino Esposito Wrox Press 6-313

Web ServicesWeb Services

Any service available on the WebAny service available on the Web Components, applications, servers, pagesComponents, applications, servers, pages

Platform and language neutrality Platform and language neutrality Web services versus DCOMWeb services versus DCOM

Page 24: XML Over The Web Today Dino Esposito Wrox Press 6-313

New Web AppsNew Web Apps

Web client

Web Server

OperatingSystem

Components

Any platform!Any platform!

DataDataStoreStoreWin32 client

Other platformclient

Page 25: XML Over The Web Today Dino Esposito Wrox Press 6-313