A WCF service is described using a data contract; this describes
the functions exposed by the Web service, such as their names
and parameters. In addition, services will need to referenced by
an endpoint address; this is the URL were the service can be
reached.
CardSpace is
integrated into
Windows
Communication
Foundation
CardSpace and Windows Communication Foundation 253
A WCF service is described with an address, which describes
where the service is available. The address is expressed as a
URI, such as the following:
HTTP://bankingserver:9001/BankServices/GetBalance
The service also requires a contract that describes how to pass
data to the services and which methods are available. The following
listing shows a simple contract for a service that returns
an account balance. A rich client could use the interface de-
?¬?ned in the contract to call a Web service, pass no parameters,
and get back a double that represents the current account
balance.
using System.ServiceModel;
namespace BankServices
{
[ServiceContract]
interface IBalance
{
[OperationContract]
double GetBalance();
}
}
Also required for describing a WCF service is the binding information.
Pages:
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381