Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to call a WCF service

Reply
Thread Tools

How to call a WCF service

 
 
Andy B
Guest
Posts: n/a
 
      06-24-2008
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.


 
Reply With Quote
 
 
 
 
Munna
Guest
Posts: n/a
 
      06-25-2008
On Jun 25, 4:06*am, "Andy B" <(E-Mail Removed)> wrote:
> 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


 
Reply With Quote
 
 
 
 
Andy B
Guest
Posts: n/a
 
      06-25-2008
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?


"Munna" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Jun 25, 4:06 am, "Andy B" <(E-Mail Removed)> wrote:
> 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



 
Reply With Quote
 
Joy
Guest
Posts: n/a
 
      06-25-2008
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

"Andy B" wrote:

> 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?
>
>
> "Munna" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> On Jun 25, 4:06 am, "Andy B" <(E-Mail Removed)> wrote:
> > 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
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Difference between Ajax Enabled WCF service and regular WCF? Cindy Lee ASP .Net 1 03-19-2010 05:59 PM
WCF service call - problem when behind ISA Server proxy SESDev ASP .Net Web Services 6 10-29-2009 08:41 AM
AJAX enabled WCF Service Vs Standard WCF Service Simon ASP .Net 0 10-13-2009 09:13 AM
Ajax calls web service in wcf(windows service) Billy Zhang ASP .Net 7 07-31-2008 07:37 AM



Advertisments