I'm writing a client (C#) for an ASP.NET 2.0 Web Service. From within the client, with its web reference to the Web Service, how do I get the Web Service address as a string? Since the address must be known to the client, I guess there must be a simple way to do it.
Gustaf 5 1422
"Gustaf" <gu*****@algonet.sewrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
I'm writing a client (C#) for an ASP.NET 2.0 Web Service. From within the
client, with its web reference to the Web Service, how do I get the Web
Service address as a string? Since the address must be known to the
client, I guess there must be a simple way to do it.
The address is in the Url property of your proxy object.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
John Saunders [MVP] wrote:
>I'm writing a client (C#) for an ASP.NET 2.0 Web Service. From within the client, with its web reference to the Web Service, how do I get the Web Service address as a string? Since the address must be known to the client, I guess there must be a simple way to do it.
The address is in the Url property of your proxy object.
Thank you! Another related question: is it possible to change the Url property at run-time, so that you can build a client that can switch between a test and deployment server?
Gustaf
On Sep 14, 8:58 pm, Gustaf <gust...@algonet.sewrote:
John Saunders [MVP] wrote:
I'm writing a client (C#) for an ASP.NET 2.0 Web Service. From within
the client, with its web reference to the Web Service, how do I get
the Web Service address as a string? Since the address must be known
to the client, I guess there must be a simple way to do it.
The address is in the Url property of your proxy object.
Thank you! Another related question: is it possible to change the Url property at run-time, so that you can build a client that can switch between a test and deployment server?
Gustaf
yes, just do MyWebService.URL = "http://www.mypage.com/service.asmx"
densial wrote:
>Thank you! Another related question: is it possible to change the Url property at run-time, so that you can build a client that can switch between a test and deployment server?
yes, just do MyWebService.URL = "http://www.mypage.com/service.asmx"
Sounds good. What I worry about is that this will clash with the automatic settings that comes from adding a Web Reference. I suppose when you create a flexible client like this, the way to go is to use wsdl.exe and import the generated classes manually, rather than using the Web Reference wizard. That's what I tried to do now.
Unfortunately, the imported proxy class doesn't expose any Uri method to set, so I added some code for this:
public MyWebService()
{
this.Url = null;
}
public new string Url
{
get { return this.Url; }
set { this.Url = value; }
}
The new keyword is there to clarify that I hide the inherited member 'System.Web.Services.Protocols.WebClientProtocol.U rl'. But I'm not sure if that's really what I want to do. What do you think?
Gustaf
I wrote:
Sounds good. What I worry about is that this will clash with the
automatic settings that comes from adding a Web Reference. I suppose
when you create a flexible client like this, the way to go is to use
wsdl.exe and import the generated classes manually, rather than using
the Web Reference wizard. That's what I tried to do now.
Nevermind this comment. I got it working. now. :-)
Gustaf This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Joe |
last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located.
When trying to add a web reference to a C# project I get an error message
'There was an error downloading...
|
by: Roland Riess |
last post by:
Hi all,
as an absolute beginner with all web matters I'm sure there are still
many things that I do net understand yet - so please point me to the
right direction whereever you feel that I'm...
|
by: pwilliams |
last post by:
NCOALink Change of Address Verification
Each year over 40 million Americans change their mailing addresses.
This change is equivalent to every person in California deciding to
change addresses...
|
by: Richard Collette |
last post by:
Hi,
I have a service, that runs perfectly when executed outside of the web
service environment. When called as a web service I get the exception
listed below sporadically. A call to the web...
|
by: mivey4 |
last post by:
Hi,
First off, I am aware that this is a very heavily documented error and I have done my homework for throughly researching probable causes before deciding to post my problem here. At this point,...
|
by: dmjpro |
last post by:
plz send me a good link which can clearify me how the J2EE framework works
i want the details information .... plz help
thanx
|
by: =?Utf-8?B?QWRyaWFuIENvbGU=?= |
last post by:
I have written a simple WCF service hosted in a Windows console application
and a simple WCF client console application that connects successfully to
that service and retrieves data. I then ported...
|
by: Dylan |
last post by:
Hello,
I was trying to do a WCF tutorial (http://wcf.netfx3.com/content/
BuildingHelloWorld.aspx). I need to get the meta data from my service
usin svcutil.exe why is not working? Please see...
|
by: =?Utf-8?B?S2F1c2hhbCBNZWh0YQ==?= |
last post by:
Hi,
Could you let me know what exactly happens when web service provider
receives request from the client (from system perspective, like threading and
all) ?
Also, how does the web service...
|
by: kkao77 |
last post by:
can you show me in more detail? I have same problem where on the page
it's https://service.premilance.com/Company.svc, but the svcutil tells
me to get it from https://pserver1/Company.svc?wsdl...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |