13.07.2015 Views

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

' Get the results as a <strong>XML</strong>DOMSet xmldoc = xmlhttp.responseXml' Extract the <strong>XML</strong>-based image description from the responseimg = xmldoc.text' Store the results <strong>in</strong> a file named RAW_OUTPUT.<strong>XML</strong>Set fso = CreateObject("Script<strong>in</strong>g.FileSystemObject")Set f = fso.CreateTextFile("raw_output.xml")f.Write imgf.Close' Extract the JPEG image from raw outputSet shell = CreateObject("WScript.Shell")shell.Run "jpegextractor.exe raw_output.xml image.jpg"This script first <strong>in</strong>vokes the method and gets the results as an <strong>XML</strong> Document ObjectModel (<strong>XML</strong> DOM) object. The <strong>in</strong>ner text of the document is saved to a local variableand then to a temporary file (raw_output.xml). F<strong>in</strong>ally, a small managed utility(jpegextractor.exe) parses the <strong>XML</strong> stream, extracts and decodes the JPEG bits, andsaves them to a file. The result is a JPEG file represent<strong>in</strong>g the sales report <strong>for</strong> the yearyou specify.NoteThe jpegextractor.exe utility is available as source code <strong>in</strong> thisbook's sample files, along with the Web service, the scripts, and theclient applications discussed <strong>in</strong> this chapter..<strong>NET</strong> Remot<strong>in</strong>g vs. Web ServicesWeb services were designed to overcome a few Web architecture problems—particularly <strong>in</strong> the area of component <strong>in</strong>teroperability. Web services are key tools <strong>for</strong>access<strong>in</strong>g otherwise <strong>in</strong>accessible functionalities exposed over heterogeneous hardwareand software plat<strong>for</strong>ms.If we stopped our analysis here, the conclusion would be rather obvious: Web servicesare the first fundamental software development of the new millennium. Although Webservices will certa<strong>in</strong>ly represent a milestone <strong>in</strong> the history of computer programm<strong>in</strong>g,the more we design them and use them, the more we realize they have seriouslimitations. Subsequently, and perhaps un<strong>for</strong>tunately, us<strong>in</strong>g a Web service isn't alwaysthe best solution.Which Came First?I perceive the .<strong>NET</strong> Framework Web services as a special case of .<strong>NET</strong> Remot<strong>in</strong>g, butone could argue <strong>for</strong> the opposite scenario as well. Putt<strong>in</strong>g Web services at the center ofthe <strong>in</strong>teroperability universe and consider<strong>in</strong>g .<strong>NET</strong> Remot<strong>in</strong>g as a plat<strong>for</strong>m-specific477

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!