How to call a WCF service

  • Thread starter Thread starter Andy B
  • Start date Start date
A

Andy B

I have a WCF service project in my solution. I need to call one of the
services from a web application from inside the same solution. How do I do
something like this? I can't seem to find the class that has the methods I
need in it. This is after I added the web reference.
 
I have a WCF service project in my solution. I need to call one of the
services from a web application from inside the same solution. How do I do
something like this? I can't seem to find the class that has the methods I
need in it. This is after I added the web reference.

Hi

Right click on you project and select "Add service reference"...
A wizard will popup...
Click on discover...
Services on your solution will be populated...
Select a service and then add

and in your page... user the proxy name space...

ServiceReference1.Service1Client myClient = new
WebApp.ServiceReference1.Service1Client();
myClient.GetData(4);

Best of luck

Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com
 
Hi. I don't have IIS on my dev computer. I have to ftp the website to the
live server. I noticed that in the service reference, I have the URL set to
something like http://localhost:8892/Contracts/ContractTemplates.svc. How
would I make it work on the 2 servers without having to always change the
references all the time?


I have a WCF service project in my solution. I need to call one of the
services from a web application from inside the same solution. How do I do
something like this? I can't seem to find the class that has the methods I
need in it. This is after I added the web reference.

Hi

Right click on you project and select "Add service reference"...
A wizard will popup...
Click on discover...
Services on your solution will be populated...
Select a service and then add

and in your page... user the proxy name space...

ServiceReference1.Service1Client myClient = new
WebApp.ServiceReference1.Service1Client();
myClient.GetData(4);

Best of luck

Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com
 
Hi Andy,
In Visual Studio 2005, the Web Reference URL's URL Behaviour property by
default is dynamic. The moment you add a web reference to your application, a
Key value pair is added under the App Key Settings of your web.config.
Needless to mention, the key is nothing but the
WebReferenceName.WebServiceName and the value is the URL for the Web Service.

I hope it helps.

regards,
Joy
 
Back
Top