Consuming a service to create validation app


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?
Who is Participating?
Vel EousResearch & Development ManagerCommented:
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.
Jasmin01Author Commented:
Thank you.  I have been researching as well and I now have a better understanding.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.