BlueMoon
BlueMoon

Reputation: 51

Get wcf result from Console Application

I would like to get the values from WCF service (which exposes DB views) and insert the data into my DB from console application.

I got the result when I am trying to access the WSDL in browser.

I added the wcf service reference in my console application. After that what I need to do.?

Any help will be appreciated. Thanks

Upvotes: 0

Views: 56

Answers (2)

Gun
Gun

Reputation: 1411

Adding service reference to your console project means you have created proxy. Next you are supposed to create an instance for your proxy and call the methods reside in service.

How to create an instance for proxy

The proxy class created by appending "Client" to your service name for example your interface name in the service is IService then your proxy class name will be IServiceClient.

Note the name of namespace while adding your service to your project.You can verify the namespace in solution explorer under Service References folder for example if your namespace is ServiceReference1 then the below code explain the rest

ServiceReference1.IServiceClient obj = new ServiceReference1.IServiceClient();
Console.WriteLine(obj.yourServiceMethod());

Upvotes: 1

Rahul Patel
Rahul Patel

Reputation: 500

Create a Proxy Class Object and call your methods using . operator

Upvotes: 0

Related Questions