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

Post on 30-Jan-2016

221 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

XML Over The XML Over The Web TodayWeb Today

Dino EspositoDino EspositoWrox PressWrox Press

6-3136-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…

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

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

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

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

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

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®®!!

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

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…

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?)

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

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

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

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

%>%>

Methods And PropertiesMethods And Properties

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…

Example #1Example #1

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

XmlHttpRequest

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

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

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…

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

New Web AppsNew Web Apps

Web client

Web Server

OperatingSystem

Components

Any platform!Any platform!

DataDataStoreStoreWin32 client

Other platformclient

top related