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
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
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