Consuming a service to create validation app

Posted on 2012-09-05
Last Modified: 2012-09-06

I'm trying to figure out how WCF services work, and am trying to follow some work that was half done.

A web service was already written, and I successfully called it into a Windows forms application.  This application should validate banking details.

The code behind the validate button is here:

private void button1_Click(object sender, EventArgs e)
            var proxy =  new bnk.BankingClient("BasicHttpBinding_IBanking");
            var result = new bnk.CDVResult();

            //result = proxy.Validate(0987654, 1, 2000001, "A Person");

            //result = proxy.Validate(0323453, 6, 2000002, "S Smith");
            //Bank details invalid

            result = proxy.Validate(0121245, 1, 200003, "T Mark");
            //Invalid Branch


What do I need to do in order to get the result to actually produce a result on the screen?  What am I missing?
Question by:Jasmin01
    LVL 14

    Accepted Solution

    The return type of proxy.Validate(...); is an instance of the object CDVResult();.  Without knowing the internal structure of this object I cannot say exactly how you should be processing this result.

    However as an example if your proxy.Validate(...); method returned an instance of the following object:
    public class ValidationReturnObject
    	public bool Result { get; set; }
    	public string Message { get; set; }

    Open in new window

    Then you could use the following to display your result message:
    lblResult.Text = result.Message;

    Open in new window

    The above assumes you have a Label control on your form named lblResult.

    What we're doing above is:
    var result = new bnk.CDVResult(); creates a new instance of the CDVResult(); object.  Your service call result = proxy.Validate(...); effectively populates that instance with data returned from your service call.  You now have a local object to work with and can therefore perform actions on it as you would any other local object instance;

    Open in new window


    Open in new window

    I apologise if I have misunderstood your question.

    Author Closing Comment

    Thank you.  I have been researching as well and I now have a better understanding.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now