Home > Articles > Web Services > XML

What Are XML Web Services and How Do They Fit into the .NET Framework?

This chapter explores the basic concepts of XML Web Services and how developers should proceed in leveraging this technology. It further illustrates the new Microsoft .NET framework and how it comes into play when creating your own XML Web Services using the Visual Studio.Net tools.

See all Sams Teach Yourself on InformIT Web Development Tutorials.

XML Web Services represent an exciting new method for distributing application functionality. The Web Services model allows applications to make calls to centralized functionality through the use of standard internet protocols such as HTTP and SOAP. This centralized functionality, the XML Web Services themselves, then return data to the calling application in the form of XML documents.

Perhaps the most exciting benefit of utilizing XML Web Service is that the standard protocols utilized in communicating with Web Services means that cross-platform interoperability is easily achieved. An application written in VB.Net and running on Windows 98 can make use of services written in C++ or Perl and running on Unix as easily as they can call services written in C# and running on NT.

The chapters presented here on InformIT define the very basic steps of creating your own XML Web Services. After reading these examples you should be able to create and test your own XML Web Services using Visual Studio.NET. When you are finished, you will be ready to move on and create more complex services and utilize the advanced techniques outlined in "Sams Teach Yourself .NET XML Web Services in 24 Hours."

— Mark Augustyniak

This chapter is from the book

Welcome to Teach Yourself XML Web Services with .NET in 24 Hours. XML Web services represent an exciting new tool in software creation, and this first hour will introduce you to the technologies and tools behind it. You will become familiar with the protocols used in the XML Web services model, and you will also learn about the .NET framework and how XML Web services fit into it.

In this chapter we will discuss the following:

  • What XML Web services really are

  • Where to apply XML Web services technology

  • The infrastructure behind .NET and XML Web services

  • The programming model used in creating Web services

What Are XML Web Services?

An XML Web service is simply a unit of programming functionality that is exposed to client applications via the Internet. At its simplest, an XML Web service is any programming component or object that makes information available via standard Internet protocols such as HTTP.

Distributed Computing

In the past, developers started to move away from the "all in one" style of development, in which all of an application's functionality was contained in one code module. Developers began to move code into objects, called components, which existed outside of the initial project. These components could be updated independently of each other and the main program, thus making for smaller and more efficient tasks.

With code now being developed from these component building blocks, it became easier to build a project in teams and to reuse code. Components from one project could be combined with new components to form different applications. It wasn't long before third-party companies began selling components to software developers for use in their own projects.

With the rise of networking and technologies such as DCOM, developers also began to move these components onto different machines across the network. This gave users access to great processing power, via the distribution of tasks to varying machines, and it gave developers the ability to change one component and simultaneously affect all users.

NOTE

DCOM, or Distributed Component Object Model, is Microsoft's network communication protocol that allows components to be accessed over a network.

Now, with XML Web services, you have the ability to distribute your application across not only a network but also the Internet. Components can be built and hosted anywhere in the world and consumed by other components. Third-party companies no longer just create and sell components; they host them as well.

For a small example, think of a DLL or function library that contains spell-checking software. If you were writing several applications to handle your company's word processing and e-mail capabilities, you would want to add this component into all of your applications.

Now, if someone created this spell-checking component as a Web service, you could simply use that component in all of your applications. If the component were ever to be updated—say an expanded word list were added—none of your applications would be impacted at all. They would all simultaneously have access to the expanded word list.

Achieving Platform Independence with XML Web Services

One of the most important factors in the future of XML Web services technology is its role in creating platform-neutral systems. By "platform-neutral" we mean that XML Web services built and running on one platform, say Unix, can be called on by applications built on and running on a completely unrelated platform—for example, Mac OS 7.0. This is true even for systems that are not running the .NET platform. In Hour 9, you will see some examples of clients that are built on non-.NET platforms. However, XML Web services built on .NET platforms will not be covered in this book.

XML Web services help create platform-neutral systems by using the same set of standards as the Internet. Today, many applications— such as Web browsers, e-mail clients, and FTP programs— are able to utilize Web protocols such as HTML, SMTP, and FTP to trade information seamlessly, without ever being aware of the platform where the information originated.

Using the HTTP protocol, requests are sent from client applications, in an XML standard format, to XML Web services for processing. When the request is processed, another XML document is generated, this one containing any requested data, and sent back to the client application.

Leading up to .NET

The road to XML Web services has been a long one. Probably the first major step in the development of the distributed model seen in XML Web services was the creation of object technologies such as COM and CORBA. The introduction of these object design technologies allowed developers to build programs in smaller components and allowed these components to be reused in other programs.

From COM sprang DCOM and other, similar technologies that allowed these components to be moved off the user's machine and onto servers. This allowed components to be simultaneously used by multiple users and multiple applications.

The rise of the Internet and Internet-enabled applications took the concept of distributing applications one step further by allowing components to be called by Web applications written in ASP or CGI and being used all over the world. Since the rise of the Internet, developers have searched for better ways to expose functionality and services to their user community.

ASP, briefly mentioned above, was another big step in the move toward more distributed applications. ASP allowed developers to write applications using a stripped-down version of the Visual Basic programming language known as VBScript. Previous to ASP, Web programming was done primarily with CGI, or Common Gateway Interface, written in languages such as Perl and C++. ASP provided a much easier method of development, used a commonly known language, and also provided a rich set of built-in objects to help developers quickly put together applications.

The last piece to fall into place in the creation of XML Web services was XML itself. Finally, developers had a standard way in which to describe data and services. From there it was not long before someone, actually several someones, began to write applications that communicated with each other by passing XML documents. These were the first Web services.

XML Messaging Between Systems with SOAP

As you were reading about XML Web services' role in creating platform-independent applications and their use of HTTP protocols to communicate with other applications, you probably noticed the need for a standard format in which clients can actually send requested data, such as method calls with parameters, and receive Web service data, such as strings, arrays, and record sets. Well, that formatting issue was solved with XML.

An XML subset called SOAP, or Simple Object Access Protocol, which you will learn about in Hour 4, is used as the medium by which XML Web services accept and transmit information to the rest of the world. SOAP documents are simply a way of marking up a call to an XML Web service method or function, including all of its required arguments. SOAP is also used to mark up all of the returned results so that the client can understand what is being sent back to it.

A simple SOAP document can be sent to the URL of an XML Web service and, if formatted properly, will cause the service to run a method and send back its results in another SOAP document.

Data is marked up with XML tags denoting the type of data being sent back, such as string or long, and the variable name to which the data was sent, in the case of parameters. This helps XML Web services and their client applications maintain type safety even across differing platforms.

The Basic Components of an XML Web Service

When you develop an XML Web service, you will generate more than just the code that provides the functionality you wish to expose. You will also be creating a host of files, and in the case of UDDI, entries in existing files that will help support your service and describe it to the intended user community. Some of the files that you will create or edit when working with Web services are

  • ASMX. ASMX files are ASP.NET application files. These are files that are created either by you using a simple text editor or, if you are using Visual Studios .NET, from the code that you develop within the IDE.

  • ASAX. This is the global file of your XML Web services. This file handles application-level events such as requests and sessions, both of which you will learn more about as you progress through this book.

  • Disco. XML is also used to help prospective users find a given Web service. Disco files, short for discovery files, are created and exposed to the Internet as the primary way of advertising a service. Disco files contain links that point to the service and the service's WSDL files. Hour 5 covers the syntax and usage of Disco files.

  • UDDI. UDDI, which stands for Universal Description, Discovery, and Integration, is a registry for developers to register their Web services. This repository allows developers looking to consume Web services to search for functionality that matches their needs and to contact the Web service owner about its use. In Hour 5, you will see how to use UDDI for both finding and publishing XML Web services.

  • WSDL. WSDL documents list the exposed methods of a service and any parameters and return types that those methods expose. The contract is a promise that the listed methods will exist in the format described by the WSDL document. The WSDL can be used either by developers or, as is more likely the case, by tools such as Visual Studios to create consumers (client applications) for the service and guarantee that requested services both exist and function in the manner that the client developer expects them to. You will learn more about WSDL in Hour 3.

Using a Component Model

Another key feature of the XML Web services framework is that they are built as components. What that means is that XML Web services are not built as complete, stand-alone programs, but rather as small building blocks to be used in the creation of other programs. Many such blocks can be used from all over the Internet, an intranet, or both in order to create a single application. In fact, an XML Web service itself may make use of several other Web services in providing its functionality.

Suppose you wished to develop an application that allowed users to track sports scores. You build your application and utilize a Web service that provides updated listings of game scores for several major sports.

Next, you decide that you also wish to provide player statistics for every player in each of the major American sports. You search around and find one that provides such statistics for football and baseball, and you decide to use it in your application. Later, you discover two additional services, one that provides basketball statistics and another that provides statistics for NHL games. You decide to use these as well.

Using this type of component model means that the developer of an application need not worry about every facet of its design. The developer need only worry about what a component does and the data that it returns; he or she does not need to bother with the inner workings of the component. This eliminates the need to duplicate the development efforts of others and greatly reduces the time required to create new applications.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020