Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2005

Tip: Looking for answers? Try searching our database.

Programatically Update WSDL on Consumer Side

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben Crinion - 14 Oct 2005 15:33 GMT
I am creating a web service which will be available on only one of two
servers at a time. Both servers will have exactly the same services running
but one will be a backup which just waits doing nothing. They will both have
WSDL files on with
the only difference being the <soap:address location="" /> value in the
<service> element.

The service consumer (ASP.NET pages) will get the current live server to use
from a function (call it GetServer()) which will return a hostname. I want
to update the Web Reference in the project with the WSDL from the host
returned by GetServer().

I figure my options are:
1. Make the project change the URL of the WSDL file it is using and then
recompile the proxy classes. (I dont yet know how to change the URL of the
reference.)
2. Store the WSDL files on the same web server as the ASP.NET pages and make
a seperate program which opens the WSDL file and physically changes the
value.

The problem is i dont know how to make the project update the web reference?
How can i do this?

Any suggestions would be greatfully received.

Thanks
Ben Crinion
Peter Kelcey - 14 Oct 2005 16:11 GMT
If all you want to do is point your client to the propery "live" server
at runtime, the all you need to use is the URL property of the proxy
class to programatically change point to the live server.

Example

Public Sub Example()

  Dim newUrl as string
  newUrl = GetServer()

  Dim webProxy as new localhost.webservice 'replace this with you
actual proxy declaration
  webProxy.Url = newUrl

  webProxy.MyWebMethod() 'replace this with the call to your actual
web method.
End Sub

You don't need to worry about changing the WSDL.

I'd also suggest that you look at setting up a UDDI server. A UDDI
server would give you the proper tools to manage the locations of you
services. With UDDI you can upload a copy of your WSDL. All clients
that want to consume your service can retrieve this WSDL from the UDDI
server and can develop against it.  Then, you can configure an access
point in the UDDI service that points to the current live location of
the service that matches your WSDL. The client applications can query
the UDDI server for this access point and can use the code I outlined
above to dynamically point to the live service.As an administrator, you
just need to change the access point in the UDDI server to redirect all
clients to the new location.

Hope that helps.

Peter Kelcey
Ben Crinion - 14 Oct 2005 16:50 GMT
Thanks, this is exactly the kind of thing i was looking for.

Do you know the location of any recent documentation on creating and using a
UDDI server?

Thanks
Ben

> If all you want to do is point your client to the propery "live" server
> at runtime, the all you need to use is the URL property of the proxy
[quoted text clipped - 32 lines]
>
> Peter Kelcey
Peter Kelcey - 14 Oct 2005 17:19 GMT
Windows 2003 ships with a UDDI server component that is an optional add
in.

You can check out the FAQ at

http://www.microsoft.com/windowsserver2003/evaluation/overview/dotnet/uddifaq.mspx

and the UDDI developer center at

http://msdn.microsoft.com/nhp/Default.asp?contentid=28001204

Peter Kelcey

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.