How to call a WCF service

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.
 
M

Munna

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
 
A

Andy B

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
 
J

Joy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top