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 / November 2005

Tip: Looking for answers? Try searching our database.

Port mapping a web service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ray Johnson - 27 Jan 2004 01:54 GMT
I have a web service running on port 7000 on a farm of web servers.
When we expose it to the outside world, however, we port map map it to
port 80 with a BigIP.  Unfortunantly, the auto-generated WSDL is
incorrect at this point.

At the bottom of the WSDL in the soap:location tag it still references
port 7000.  What is weird is that has the domain name correct (i.e.
it's using the outside domain name not the internal machine name.  It
just doesn't get the port correct.

Has anyone seen this before?  ANyone know of a way to work around
this?

Ray
Dino Chiesa [Microsoft] - 28 Jan 2004 21:21 GMT
Yes:
don't use the dynamically-generated WSDL.

Generate the WSDL, then modify it to specify the proper port, then save it
or publish it or distribute it.

You may also have to tweak or disable the auto help page generator for ASMX.

> I have a web service running on port 7000 on a farm of web servers.
> When we expose it to the outside world, however, we port map map it to
[quoted text clipped - 10 lines]
>
> Ray
Ray Johnson - 04 Feb 2004 23:36 GMT
Not a very good answer.  Makes maintaining the WSDL a very tedious prospect.
That is a lot to give up if all you need is to expose the web service
through a port mapping web farm.  Fortunantly, I found a much better answer
by calling MS support.  I'll share it here since I found no help on the
internet.  Hopefully, it will others who have this kind of problem.

The solution involves creating a Soap Extension Reflector.  Something like
this:

public class WSDLAddress : SoapExtensionReflector
{
 bool bFirstTime = true;

 public override void ReflectMethod()
 {

  if (!bFirstTime) return;
  bFirstTime = false;

  SoapAddressBinding sabAddress =
ReflectionContext.Port.Extensions.Find(typeof(SoapAddressBinding)) as
SoapAddressBinding;

  string sPort = ConfigurationSettings.AppSettings["myPort"];

  UriBuilder uriLocation = new UriBuilder(sabAddress.Location);
   uriLocation.Port = Int32.Parse(sPort);

  sabAddress.Location = uriLocation.Uri.AbsoluteUri;
 }
}

You also need to register the reflector in your web.config with something
like this:
<webServices>
 <soapExtensionReflectorTypes>
  <add type="WSDLPortMapper.WSDLAddress, PortMapperAssembly" />
 </soapExtensionReflectorTypes>
</webServices>

The interesting thing to note here is that when the reflector runs you have
control over many asspects
of the WSDL generation.  So this technique may be used for other tweaks on
the WSDL.

Enjoy!

Ray

> Yes:
> don't use the dynamically-generated WSDL.
[quoted text clipped - 18 lines]
> >
> > Ray
nd - 07 Nov 2005 16:09 GMT
We too have bigIp mapping to another port and I'm having trouble implementing this solution.  Has anyone done this successfully?

Thanks in advance,
-nd

Rate this thread:







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.