Read an Excerpt
Chapter 1: An Overview of SOAPAt one time in the history of the PC, computing consisted of a single computer using simple applications that relied only on local resources. Eventually, networking changed the way people shared expensive peripherals and data, but the data was still, to an extent, stored locally. As companies grew and became more dependent on the PC, the concept of the Local Area Network (LAN) gave way to the Metro Area Network (MAN) and Wide Area Network (WAN). The client/server architecture of days gone by allowed a limited form of distributed computing. However, there was still a direct connection and all of the data appeared within the confines of one company, so sharing data was still relatively easy.
Today, computing is all about distributed applications running on machines that may not know anything about each other. Data is no longer restricted to one company; business-to-business communication is now the norm. Consequently, these machines may not even have a direct connection or access the network at the same time. Data sharing occurs between individuals who may not ever meet. In short, there isn't a direct connection between the provider and the user of data anymore, which means the rules used in the past don't work well for modern communication needs.
Early computers relied on protocols (predefined rules) that ensured safe data transfer between machines that knew what to expect from each other. These protocols work fine on a LAN, MAN, or WAN because there's a direct connection between machines. A protocol designed for the LAN environment, however, may run into problems when dealing with something like the Internet. For example, the protocol may expect to find another Windows machine when the client really needs to communicate with a Unix server. That's precisely what's happened and why we need a new protocol named Simple Object Access Protocol (SOAP). The fact that you're reading this book means that you already have some idea of why you need SOAP and may even know something about it from a technical perspective.
The first section of this chapter is going to tell you more about SOAP-what it does and how it works. This section isn't going to provide many details, but it will prepare you for the detailed discussion in Chapter 2. I want to present a basic overview of the technology before jumping into the details. SOAP is different from older protocols. It provides some features these older protocols don't have. For example, unlike Distributed Component Object Model (DCOM) and other binary protocols, SOAP won't interfere with the operation of the firewall on your Web server. It uses a plain text transfer method that firewalls readily accept. This means that you can maintain the integrity of your company's Web site, and still get the data you need.
Some of these neat new features come at a cost. You lose some of the features provided by the older protocols. For example, security is an issue that many SOAP developers are trying to address as of this writing. The second section of the chapter provides a brief comparison of SOAP to older protocols, such as DCOM and Common Object Request Broker Architecture (CORBA). You'll learn how SOAP excels and where it provides less than stellar results.
SOAP actually interacts with other Web technologies that you may have used in the past. Although SOAP can theoretically rely on any transport protocol, the current toolkit from Microsoft uses the same Hypertext Transfer Protocol (HTTP) used to move Web pages across the Internet. (Note that you can use any reliable protocol to transfer SOAP messages-HTTP is simply the most straightforward and easily accessible method right now, so developers are using it.) In addition, SOAP relies on the eXtensible Markup Language (XML) to format data before moving it from one point to another. The third section of the chapter discusses the interaction between these three technologies.
As previously mentioned, Microsoft designed SOAP to address specific problems. Technologies such as DCOM just can't make the grade in the distributed computing environment of the Internet. The fourth section of the chapter discusses these problems in detail and explains how SOAP addresses them.
SOAP changes the performance picture-it uses a new technique to transfer data, so differences in performance are expected. In many cases, SOAP is slower than older technologies like DCOM. You can't beat a direct binary connection between client and server that relies on optimized data transfers. However, given the distributed nature of applications today, there are also situations when SOAP is faster than binary technologies. In the fifth section of the chapter, we'll talk about SOAP performance issues. This section also talks about ways of mitigating some of those performance losses by using better coding techniques.
Microsoft designed SOAP to work with the Internet-which means you'll eventually run into a Web server. The sixth section of the chapter discusses how SOAP works with a Web server to handle client requests. We'll talk about some of the mechanics you'll need to know later, like common storage locations for files and some of the implementation details.
The final section of the chapter discusses a topic that many of you will ask about once you see everything required to move to SOAP It's important to know why this move is so important and how you'll benefit from it. SOAP is a great technology with a very important purpose for your company. This section discusses why you need to include SOAP in your programming toolbox.
What Is SOAP?SOAP is a lightweight communication protocol based on the eXtensible Markup Language (XML). It allows applications and components to exchange data. As mentioned in the introduction, SOAP currently relies on HTTP as a transport protocol, but could use any reliable transport protocol to transfer data. In addition, SOAP is useful for many data transfer needs, including LANs, WANs, and MANS-it's not just for the Internet.
Learning XML is an essential part of learning SOAP. You don't have to become an XML guru, but knowing the basics is a requirement. Many XML Web sites offer tutorials and other information about this technology. For example, DevelopMentor (http://www.develop.com/dm/dev_resources.asp) provides good tutorials on this and other distributed application topics from a Microsoft perspective. W3Schools (http://www.w3schools.com/ xml/) provides detailed tutorials in small segments. Another good place to look for XML training is Courses in XML by QTrain (http://www.qtrain.net/). Once you finish the basic XML tutorials, you'll want to visit XSLT.com (http://xslt.com/resources_tutorials.htm) and learn more about data transformation techniques. ZVON.org (http://www.zvon.org/index.php?nav_id=2) includes tutorials on both XML namespaces and the eXtensible Stytesheet Language Transformations (XSLT).Despite what you may have heard, SOAP isn't another conspiracy by Microsoft to take over the worldit's a protocol supported by many vendors. Some of the most notable contributors to SOAP are Ariba, Commerce One, Compaq, DevelopMentor, HP, IBM, IONA, Lotus, SAP, and UserLand. Vendors who support SOAP hope it will eventually gain standards status. The World Wide Web Consortium (W3C) is currently discussing SOAP You can read the W3C comments at http://www.w3.org/Submission/2000/05/Comment and see the initial specification at http://www.w3.org/TR/SOAP/.
Since SOAP is a new protocol that isn't tied to a particular operating system, the vendors working on it are free to add features that make SOAP especially suited to distributed application use. Three of the features that make SOAP attractive are:
- No ties to existing component technologies-SOAP will theoretically work with any platform.
- No ties to a particular programming language; you can use SOAP with any language capable of outputting text. (You can also use a special toolkit to output the formatted text as well, seen in Chapter 4.)
- Easy to learn and simple to extend.
The last point is important as well. SOAP really is easy to learn. It's verbose, which means that some of the code listings you see become quite long and look complicated, but the underlying technology is simple. The complexity that you'll see as we work with SOAP throughout the book comes from the various extensions that Microsoft and other vendors add. These extensions provide additional flexibility and allow you to tailor a SOAP implementation to specific needs.
SOAP is a very hot topic right now because it offers so much. However, getting the latest news can prove difficult because the specifications change so quickly. You can usually rely on news Web sites and newsgroups to provide updated information on a regular basis. For example, the SOAP News Web site at http://soap.weblogs.com/ provides up to the minute information about this new standard. DevelopMentor and other organization! provide fist servers that discuss SOAP. The main public SOAP newsgroups appear on the...