Headline

A web service based on .NET's WCF

Motivation

The Technology:WCF technology supports the development of applications based on service-oriented architecture. Our implementation illustrates a stateful web service created with WCF. It also introduces the use of SOAP over Technology:HTTP. That necessitates the use of DTOs to wrap the domain model into leightweight serializable containers and pass it to the client.

Illustration

Technology:WCF uses contracts to generate Language:WSDL definitions for the web service. The contract is provided by a Language:CSharp interface. It contains all necessary methods for retreiving the company data and invoking the method cut on every entity within the company:

Invalid Language supplied

The class

Invalid Language supplied
is the concrete contract implementation. The implementation uses the basic Contribution:csharp for data generation and manipulation. Our contract class invokes the methods of the implementation and creates DTOs out of the retrieved entities. The example shows the implementation of the method
Invalid Language supplied
. The method returns all necessary data for the company view encapsulated into a DTO:

Invalid Language supplied
>

The DTO classes

Invalid Language supplied
,
Invalid Language supplied
, and
Invalid Language supplied
provide the serializability for view informations. The following example illustrates the DTO of the company, which contains fields for identifier, name, subdepartments and Feature:Total.

Invalid Language supplied

Architecture

The base folder contains the contract definition this!!ICompanyService.cs and the contract implementation ComanyService.svc.cs. The file this!!CompanyService.svc links to the concrete implementation. DTO definitions are located in the dto folder. Both files, this!!clientaccesspolicy.xml and this!!crossdomain.xml, solve possible cross-domain issues. The .config files in the base folder are generated.

Usage

Requirements:

  • You need Microsoft Windows (preferably Vista or 7) running in combination with Technology:.NET 4.0.
  • Install Technology:IIS (Internet Information Services) 7 or 7.5 using the installation tutorials on IIS or MSDN. Make sure, that you have installed the "static content" feature as well.
  • Download the wcf implementation from github.
Build: Create web site:
  • Go to the "Computer Management" dialog.
  • Open the "Services and Applications" root and select the "Internet Information Services (IIS) Manager".
  • On the right, there is a panel "Connections". Create a new web site by right click on "web sites".
  • Use wcf as "sitename" and link to the physical folder of the wcf implementation. Use port 1212.
Make sure that http://localhost:1212/CompanyService.svc shows that you have created a service. After the web service is running, continue with your client side application, for example Contribution:silverlight.

We also used:

to create the implementation.

Attention: When creating a service anywhere other than on the web server, that hosts your Silverlight application, cross-domain issues can arise. Cross-domain calls between Silverlight applications and services present a security vulnerability and must be specifically enabled by an appropriate cross-domain policy. For procedures that describe how to implement such a policy, see "Making a Service Available Across Domain Boundaries" <cite>MSDN2012CD</cite>.


There are no revisions for this page.

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.