Skip to Content
Windows Developer Power Tools
book

Windows Developer Power Tools

by James Avery, Jim Holmes
December 2006
Intermediate to advanced
1312 pages
35h 17m
English
O'Reilly Media, Inc.
Content preview from Windows Developer Power Tools

5.3 Writing Your Web Services Contract First with WSCF

Visual Studio makes it very simple to create and expose web services, as long as you follow its rules. Simply create a method, just like any other method in your application, and then decorate it with the [WebMethod] attribute. That’s all that’s required; you have written a web service. The only issue is that you don’t really know what is being exposed to your clients, because Visual Studio automatically generates the web service contract for you. The contract contains the service names, the domain model, and the formats of the messages that the services expect as input and return as responses.

Because Visual Studio generates your contracts, you can’t easily control what is exposed to the consumers of your web services. You may end up with tightly coupled RPC-style services that unintentionally expose the inner workings of your application, thus defeating the purpose of your service layer. This technique is often called code-first, since you are writing the code before creating the contract, and it’s helpful to know that there are other options.

Developing interfaces before components has long been a best practice. Before writing your service, you should spend some time thinking about the interface and contract that your web service will expose and how it can be made as loosely coupled as possible.

Most web service contracts are defined using the Web Service Description Language (WSDL), an XML format used to define a service’s ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Windows Terminal Tips, Tricks, and Productivity Hacks

Windows Terminal Tips, Tricks, and Productivity Hacks

Will Fuqua
Visual Basic 2015 Unleashed

Visual Basic 2015 Unleashed

Alessandro Del Sole

Publisher Resources

ISBN: 0596527543Errata PagePurchase book