Home > Store

Creating and Consuming Web Services in Visual Basic

Register your product to gain access to bonus material or receive a coupon.

Creating and Consuming Web Services in Visual Basic

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2002
  • Edition: 1st
  • Premium Website
  • ISBN-10: 0-672-32156-4
  • ISBN-13: 978-0-672-32156-6

Get on the fast track of what is becoming a required skill for software developers--the ability to create Web Services and clients that consume them. Web Services leverage standards such as XML, XSD, SOAP, and WSDL to enable interoperability across programming languages and platforms. They work well to integrate applications on an intranet and on the Internet. Visual Basic .NET, coupled with the .NET Framework, is an attractive environment for Web Services architecture because it provides for rapid development and easy maintenance.

This book explains each of the standard protocols needed for Web Service interaction on the client or server. These protocols include SOAP, Web Services Description Language (WSDL), and Universal Description Discovery and Integration (UDDI).

Creating and Consuming Web Services in Visual Basic® also includes

  • Information on how to shape SOAP messages and the data they contain
  • Explanations of how to create applications that consume Web Services
  • Detailed case studies that explore how to use Web Services to help solve real-world B2B and B2C problems
  • Thorough coverage of development concerns such as security and availability
  • Instructions for how to create and consume Web services in earlier versions of VB and convert legacy applications to a Web Services platform



Source Code

Click to download the Source Code related to this title.

Sample Content

Online Sample Chapter

Security Issues with Web Services

Table of Contents

(NOTE: Each chapter concludes with Summary.)


Applications of Web Services.

What You Will Need.

Who Is This Book For?


1. Creating Your First Web Service.

The “Hello World” Operation.

Other Files in the Project.

Passing Complex Types.

Returning Arrays of Simple Types.

Returning Arrays of Structures.

2. Consuming Your Web Service.

Attaching a Web Reference.

Command-Line Interface Applications.

Graphical User Interface (GUI) Applications.

Web Applications.

Web Services Calling Other Web Services.

3. SOAP, WSDL, and UDDI Explained








Document Parts.

Supported Message Patterns.

SOAP Extensibility Elements.



Registering with UDDI.

Query Patterns.

4. Shaping the WSDL, XML, and SOAP Message.

Shaping the WSDL File.



message, portType, and binding.


Using SOAP Headers.

Changing the Location of WSDL Elements.

Creating a Custom SOAP Extension.

Custom SOAP Extension Basics.

An Example SOAP Extension.

Creating a Server Based on a WSDL File.

Using Visual Studio to Register Your SOAP Endpoint in UDDI.

5. Troubleshooting Web Services/Consumers.

Viewing SOAP Message Exchanges.

Debugging a Web Service at the Server.

Debugging a Web Service Remotely.

Debugging Web Services Under Load.

Items to Include in Your Test Plan.

A Simple Example.


6. Security Issues with Web Services.

Equipment Deployment.

Authenticating Users.

Application Level Authorization.

HTTP Basic and Digest Authentication.

X509 Client Certificates.

Guarding Data.

Tracking User Activity.

7. Looking at the “Abilities”.


Clustered Servers.

Multiple Deployment Locations.


Administrator Communication.


Stateless Web Service and Using a Web Farm.

Scalable Components.


Performance Monitor.

Deployment Packages.



I/O Bound.

Computation Intensive.

Memory Hog.

Long-Lived Web Method Calls.

8. Asynchronous Web Services.

Synchronous Versus Asynchronous Calls.

Design Pattern for Asynchronous Method Calls.

Calling a Web Service Asynchronously.

Using the Callback Function.

Using the WaitHandle Methods.

Handling Web Pages That Make Asynchronous Calls to WebMethods.

Server to Server Asynchronous Communications.

Server Web Service.

Client Web Service.

Console Application.

WinForm Application.

9. Stateful Services.

Benefits of Maintaining State: Performance and Scalability.

Improving Performance.

Enhancing Scalability.

Facilitating Web Farms.

Maintaining State with the Session Object.

ASP.NET Session State.

In-Process Session State.

Out-of-Process Session State.

Maintaining State with the Application Object.

Maintaining State with the Cache Object.

Custom State Management.

Managing State as a Web Service.

10. Microsoft SOAP SDK.

Using the SOAP Toolkit on the Server.

Generating the WSDL and WSML files.

Common Edits to the WSDL and WSML Files.

Deploying Your SOAP Web Service.

Using the SOAP Toolkit on the Client.

Using the High-Level Interface.

Using the Low-Level Interface.

11. Converting Legacy Applications to Web Services.

Adding Web Service Support to COM+ Applications.

Reusing an Existing COM Object Within a Web Service.

Migrating from Visual Basic 6 to Visual Basic .NET.


12. Business to Business XML Web Services.

Choosing the Right Technology.

Read-Only Access to Data.

Write-Only Access to Data.

Read/Write Access to Data.

Designing the Web Service.

Building the JLD Database.

Creating the Database Class.

Creating the SecurityToken Class.

Building the Web Service.

Building Elise's Emporium.

Creating the Database.

Building the Product List Page.

Determining Product Availability.

13. Business to Customer XML Web Services.

Designing the Database.

Designing the Application.

Referencing the External Web Service.

Creating the List Window.

Adding the List Window Code.

Designing the Stock Editing Window.

14. Platform Integration.

Assembling the Tools.

Building the Web Services.

Adding the Database Class.

Creating the Products Service.

Creating the Customers Service.

Creating the Orders Service.

Building the Mobile Application.

Creating the Main Menu.

Creating the Customer Viewer.

Creating the Order Viewer.

Creating the Product Catalog.

15. Portals.

Designing the Database.

Configuring the Application.

Adding the Business Objects.

Creating the Web User Controls.

Building the Web Pages.

Creating the Login Page.

Creating the Profile Editor.

Writing the Portal Page.

Building the Log Out Page.

16. Profiting From Your Web Services.

Creating Services that Fill a Need.

Decreasing Business Costs.

Revenue Models.

Flat-Fee Access.

Volume-Based Access Fee.

Creative Use of the Advertising Model.

A Middleman Model.

Marketing the Web Service.


Appendix A. Additional Resources.

XML General.

General .NET Information.

General Web Service Information.

SOAP/XML Protocol.








Sample Web Service.

Appendix B. Installing Visual InterDev.

Installing the Client Components.

Installing the Microsoft Visual InterDev Client.

Installing the Image Composer.

Installing the Music Producer.

Appendix C. Visual InterDev Architecture Components Overview.

Development Architecture.

Testing Architecture.

Deployment Architecture.

Index. 0672321564T06072002


One of the more confusing items about Web Services regards defining exactly what and why they are. Let's begin with why they exist.

Web Services exist to make it easier to integrate applications. Existing technologies include Java RMI, CORBA, and DCOM. All of these technologies work over networked environments and allow for application integration. This application integration is possible if all the components are reachable over a LAN. However, when going out to the public Internet, these networked applications start to break down. Another problem is that none of these technologies work well for cross platform, cross language integration. Often, working with one of these technologies ties you to a particular language, operating system, or toolkit that must be uniform across the solution. In today's world, the odds of having all systems being written in the same language or using the same operating system and interconnection libraries is fairly small. Add to this a desire to connect these applications across large distances using the Internet and you will find that almost all of these technologies come up short. The necessity of addressing these shortcomings gave birth to Web Services. So, what are they?

A Web Service is a programmatic interface that is accessible via the Internet. As such, it must rely on standardized protocols. You may be aware of the various technologies surrounding Web Services. SOAP (an abbreviation that does not really mean anything anymore), Web Services Description Language (WSDL), and Universal Description Discovery and Integration (UDDI) are just a few of the technologies that are a part of Web Services. To make Internet accessibility a reality, SOAP v1.1 and v1.2 rely on existing, widely deployed technologies. The de facto minimum requirements for Web Service interaction state that the platform, whether client or server, must understand the following standards:

  • Hypertext Transfer Protocol (HTTP)
  • Transmission Control Protocol/Internet Protocol (TCP/IP)
  • eXtensible Markup Language (XML)
  • XML Schema Definition (XSD)

Due to the wide adoption of the Internet and XML, it is extremely difficult to find an operating system or programming language that does not have some support for these standards. Because the interest in Web Services is building to a fever pitch, vendors and individuals are rallying to make additional Web Service-specific tools available. While not a silver bullet for interoperability woes, talking to other languages and platforms just got a lot easier to do.

For many people, the promise of interoperability drew them into learning more about Web Services. As a Visual Basic developer, this promise may have caused you to buy this book. One question probably remains: How real is this promise of interoperability? For any two implementations to work together, they typically have to agree on two items: what the WSDL for a particular interface looks like and how to represent the SOAP message for any given operation in XML. To this end, the many serious development teams and individuals are working together to make sure they all agree.

At XMethods, http://www.xmethods.com/ilab, you can see a list of all the participants. This page also describes what it means to pass or fail the set of tests, as well as the tests themselves. If an implementation is not a part of this effort, you should steer clear of it. Yes, the Microsoft implementations are active in this process.

Applications of Web Services

Before going too far into this book, you should understand some of the reasons for using a Web Service:

  • Interface between languages where a binary interface does not exist or is inappropriate to use--For example, you may want a Perl script to be able to talk to a Visual Basic interface.
  • Interface in between systems--For example, you may want to make a business application on a mainframe accessible to boxes scattered throughout the business.
  • You need to allow a wide, unknown array of clients to access your application--This is a common requirement in larger applications assembled using "best of breed" components.
  • You are exposing the functionality as a service for a fee--In this case, instead of inventing your own protocol, use what Web Services provide to you. Examples include stock trading services and access to research databases, among other things.

When creating a Web Service, make sure that the various APIs are stateless. If you must maintain a pseudo-state, that state information should be obtainable from data passed in the SOAP messages. For example, a Web Service may require that users be validated. To do so, they log in and receive an authentication token. Other Web Service calls will require that the token appear somewhere within the SOAP message. With this, you have state (the user is "logged in") and this state is maintained over transient connections. Maintaining state this way helps with scalability and will be covered in Chapter 6, "Security Issues with Web Services."

What You Will Need

While you could run most of these examples using the free Microsoft .NET Framework SDK, you will get the greatest benefit and productivity by using Visual Studio .NET. This book assumes that the reader has Visual Studio .NET installed. This book will still be valuable to users with only the SDK, but many things will be harder to do.

You should also have a copy of the Microsoft SOAP Toolkit v2 installed on your machine. Yes, install this even if all you do is program .NET applications. The toolkit comes with an application called MSSOAPT.EXE. This application allows you to review the SOAP messages going between the SOAP endpoints.

The machine that you are developing on must have Internet Information Server (IIS) installed. Without it, you will not be able to run the examples in the book or develop Web Services on your local machine. This is only available on Windows NT 4.0, Windows 2000, and Windows XP. The good news is that all versions of these operating systems can host IIS. On the Professional versions of XP and 2000, you need to explicitly install IIS. You can do this through the Add/Remove Programs Control Panel applet. Refer to your Windows documentation for instructions. NT 4.0 Workstation can host IIS 4.0. This is available through the Windows NT 4.0 Option Pack.

Finally, it would help to have a good book on Visual Basic .NET handy. Learn Visual Basic .NET in 21 Days by Kent Sharkey and Duncan MacKenzie is one text that would work nicely. Their book serves as an overview of the language.

Who Is This Book For?

Because Web Service development with Visual Basic will attract Internet-savvy developers, Visual Basic application developers, and hobbyists, a wide range of people will be picking up this text and reading it. You do not necessarily need a lot of experience with the latest version of Visual Basic. That said, you should know that the language has changed a bit and has become more flexible. If you have not made yourself familiar with the changes, you should plan on updating your knowledge on Visual Basic .NET specifics along with this book.

You probably bought this book for one of two reasons:

  • You want to learn how to write code that uses Web Services just to keep up to date.
  • You just found out that you need to expose your application to outside applications and you need to learn this stuff as fast as possible.

With these goals in mind, this book is organized into the following parts:

  • Part I: The Basics--Part I gets you programming right away. Almost everyone should, at a minimum, skim all of Part I before proceeding through other chapters.
    Keep in mind that the examples presented in Chapters 1, "Create Your First Web Service," and 2, "Consuming Your First Web Service," are appropriate for only one reason--they teach the concepts without burying you in special techniques. You would never offer these to internal applications or external partners, but they are very useful for getting you started learning the basics of Web Services. In subsequent chapters, you will tackle practical and realistic examples.
  • Part II: Going Deeper--Part II covers some of the more advanced Web Service topics. In it, we examine securing a Web Service and tradeoffs you can make to maximize the scalability, reliability, and manageability of a Web Service. With some of the Web Services, you will have a need to maintain some kind of state in between Web Service calls. Different techniques for maintaining that state are useful depending on the circumstances. This section closes out with a look at Web Service enabling existing applications written using Visual Studio 6.0 and the Microsoft Web Services Toolkit.
  • Part III: Solving Real-World Problems--Part III examines the uses of Web Services in real world situations. Web Services can be used to enable integration between business partners and customers. Within your own business, you can use Web Services to tie your heterogeneous computing environment together. The section closes out with a look at how this investment in Web Services can help improve your business's bottom line.

Now, let's jump right in and learn how to write Web Services!


Click below to download the Index file related to this title:


Submit Errata

More Information

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.


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.


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.


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.


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


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


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.


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.


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