473,413 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

How to call a WCF service

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.
Jun 27 '08 #1
3 5180
On Jun 25, 4:06*am, "Andy B" <a_bo...@sbcglobal.netwrote:
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
Jun 27 '08 #2
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" <mu******@gmail.comwrote in message
news:05**********************************@d1g2000h sg.googlegroups.com...
On Jun 25, 4:06 am, "Andy B" <a_bo...@sbcglobal.netwrote:
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

Jun 27 '08 #3
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" <mu******@gmail.comwrote in message
news:05**********************************@d1g2000h sg.googlegroups.com...
On Jun 25, 4:06 am, "Andy B" <a_bo...@sbcglobal.netwrote:
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

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Barb | last post by:
Hello, I have a (C#) web service being consumed by a high volume "asp classic" site. It worked perfectly until I tried consuming a second web service from the first web service. Both services...
1
by: kkao77 | last post by:
Someone help me please. I've tried to write an asynchronous method, but it didn't call my web service, do I need to do something in my webservice project to make it work? or if there is...
3
by: Marshall | last post by:
Hello, I am wondering if it is possible to call a remote web service using ATLAS and if so, how. I have read several docs which show how to call a web service that is within the same project as...
0
by: Griff | last post by:
Overview When the first call to our Web Service causes an exception, the Web Service caches that user's credentials for its life time. Details We have a Web Service which uses Windows...
6
by: alho | last post by:
The web service is called by a program running on pocket pc. When to call the web service, the first call is still ok, but for the second or later calls, it will throw "403 Forbidden" WebException....
3
by: =?Utf-8?B?Y2hlbmRyaWNrcw==?= | last post by:
I have a C# winforms application that makes periodic web service calls in background thread to my web service server. These calls work fine almost all the time but on rare occassions the web...
6
by: plork | last post by:
hi all i'm calling a web service method and can get it's results just fine however i want to grab the repsonse message from the call is anyone able to tell me how i do this? results =...
2
by: jojoba | last post by:
Hello to all! I have a fairly simple webservice running in asp.net ajax under c# (vs 2008). I built the service and it runs just dandy when i test it by itself in visual studio. However, to...
1
by: y2ktan | last post by:
hi guys, I am building my web page using AJAX in ASP.Net, now I want to make a cross-domain call from my web application to my web service that both of them are hosted at different machine. I...
2
by: =?Utf-8?B?SmltIE93ZW4=?= | last post by:
Hi John, Hopefully this post will find its way back to you - or perhaps be answered by someone else. As I mentioned in my last post on the earlier portion of this thread, changing the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.