65.9K
CodeProject is changing. Read more.
Home

Consume Online WCF Service

Jan 2, 2014

CPOL

1 min read

viewsIcon

17524

downloadIcon

413

This tip gives information about tools and consumption of WCF Services.

Introduction

This tip gives information about a list of tools to test web / WCF service, and also gives information about consumption of online WCF Services in the client applications.

Background

After learning WCF services, I created and deployed services in local, but didn't get a chance to consume online WCF services. After knowing about the availability of online WCF services, I want to share information with everyone so that everyone can consume those WCF services for learning and testing.

The following tools are used to test services:

  1. WcfTestClient.exe -> Go to Visual Studio command prompt -> type wcftestclient.exe, this tool is used while implementing service
  2. SoapUI
  3. WcfStrom -> Useful to know metrics of the services

Using the Code

In this tip, I will show you consumption of WCF services in client applications.

I found IfscCodeWcfService which is running online. I tried to consume that live service in two client applications.

I created two projects:

  1. Web Client Application
  2. Desktop Client Application

Each application consists of 2 forms / pages:

  1. Displaying all banks list:
    IfscCodeServiceRef.IifscCodeServiceClient serviceclient;
    private void DisplayAllBanks_Load(object sender, EventArgs e)
    {
        serviceclient = new IfscCodeServiceRef.IifscCodeServiceClient();
        dataGridView1.DataSource = serviceclient.GetAllBanks().ToList();
    }
  2. Displaying ifsccodes list of selected bank:
    IfscCodeServiceRef.IifscCodeServiceClient serviceclient;
    
    private void IfscCodesByBankId_Load(object sender, EventArgs e)
    {
        serviceclient = new IfscCodeServiceRef.IifscCodeServiceClient();
        dataGridView1.DataSource = serviceclient.FindIfscCodesByBankId(1).ToList();
    }

For two applications, I implemented the same code that is the advantage of services.

Points of Interest

I understood the advantages of services while consuming heterogeneous applications and platforms, learned about end points, wsdl, tools of WCF services.

I tried to consume services from the site WcfSpro.

Consumed service for demo is Ifsc Code Service.