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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13: <strong>XML</strong> Web ServicesOverviewThe term Web service is relatively new, but the idea beh<strong>in</strong>d Web services has beenaround <strong>for</strong> a while. A Web service is an <strong>in</strong>terface-less Web site designed <strong>for</strong>programmatic access. This means that <strong>in</strong>stead of <strong>in</strong>vok<strong>in</strong>g URLs represent<strong>in</strong>g Webpages, you <strong>in</strong>voke URLs that represent methods on remote objects. Similarly, <strong>in</strong>steadof gett<strong>in</strong>g back colorful and animated HTML code, you get back <strong>XML</strong> Schema Def<strong>in</strong>ition(XSD) data types packed <strong>in</strong> <strong>XML</strong> messages. Aside from these higher-level differences,the underly<strong>in</strong>g models <strong>for</strong> a Web site and a Web service are the same. In addition, anysecurity measure you can implement on a Web site can be duplicated <strong>in</strong> a Web service.To summarize, the Web service model is just another programm<strong>in</strong>g model runn<strong>in</strong>g ontop of HTTP.A Web service is a software application that can be accessed over the Web by othersoftware. Web services are applicable <strong>in</strong> any type of Web environment, be it Internet,<strong>in</strong>tranet, or extranet. All you need to locate and access a Web service is a URL. Intheory, a number of Internet-friendly protocols might be work<strong>in</strong>g through that URL. Inpractice, the protocol <strong>for</strong> everyday use of Web services is always HTTP.How is a Web service different from a remote procedure call (RPC) implementation ofdistributed <strong>in</strong>terfaces? For the most part, a Web service is an RPC mechanism thatuses the Simple Object Access Protocol (SOAP) to support data <strong>in</strong>terchange. Thisgeneral def<strong>in</strong>ition represents the gist of a Web service, but it focuses only on the corebehavior. A Web service is more than just a bus<strong>in</strong>ess object available over an HTTPaccessiblenetwork. A number of evolv<strong>in</strong>g <strong>in</strong>dustry standards are supported today,<strong>in</strong>clud<strong>in</strong>g the Universal Description, Discovery, and Integration (UDDI) standard and theWeb Services Description Language (WSDL); others, such as the Web ServicesSecurity (WS-Security) and the Global <strong>XML</strong> Web Services Architecture (GXA), will besupported soon. These <strong>in</strong>dustry standards contribute to sett<strong>in</strong>g up a full and powerfulenvironment <strong>for</strong> remote object-oriented access and programm<strong>in</strong>g.In this chapter, we'll look at implement<strong>in</strong>g and programm<strong>in</strong>g Web services <strong>in</strong> the<strong>Microsoft</strong> .<strong>NET</strong> Framework. We'll also take a look at the Web <strong>in</strong>frastructure that makesthese services available and at the functionalities you can obta<strong>in</strong> and publish. Todemonstrate the breakthrough that Web services represent <strong>in</strong> the software <strong>in</strong>dustry,we'll rewrite the .<strong>NET</strong> Remot<strong>in</strong>g code example from Chapter 12 to make it work as aWeb service. In do<strong>in</strong>g so, we'll also be able to exam<strong>in</strong>e the differences between the.<strong>NET</strong> Remot<strong>in</strong>g and Web service architectures and determ<strong>in</strong>e <strong>in</strong> which scenarios eacharchitecture is suitable.The .<strong>NET</strong> Framework Infrastructure <strong>for</strong> Web ServicesAlthough Web services and the .<strong>NET</strong> Framework were <strong>in</strong>troduced at roughly the sametime, there is no strict dependency between the two, and the presence of one does notnecessarily imply the presence of the other. The .<strong>NET</strong> Framework is simply one of theplat<strong>for</strong>ms that support Web services and that provide effective tools and system classesto create and consume Web services. No one person <strong>in</strong>vented Web services, but all thebig players <strong>in</strong> the IT arena are rapidly adopt<strong>in</strong>g and trans<strong>for</strong>m<strong>in</strong>g the raw idea of"software callable by other software" <strong>in</strong>to someth<strong>in</strong>g that fits their respectivedevelopment plat<strong>for</strong>ms.Regardless of how a Web service is created—and whether it is vendor-specific orplat<strong>for</strong>m-specific—the way <strong>in</strong> which a Web service is exposed to the public is the same.454

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

Saved successfully!

Ooh no, something went wrong!