Hello,
I have a web service deployed on a machine that is attending requests on 2 different domains. One internal (intranet) and another one external (internet). So I can make requests like this:
[internaldomain]/myservice.asmx
or
[externaldomain]/myservice.asmx
the external domain works because another machine is resending the requests to the one that hosts the service.
The problem is that when I request something from Internet, the web service response contains de internal url, so I can´t access that response as I´m not allowed to reach that address.
I´ve been searching solutions to this and I found some answers that could be ok using SoapExtensionReflector.
First, I have to create a class derived from SoapExtensionReflector like this:
namespace myNamespace { public class MyReflector : SoapExtensionReflector {
public override void ReflectMethod()
{
ServiceDescription sd = ReflectionContext.ServiceDescription;
ServiceCollection myServiceCollection = sd.Services;
foreach (Port port in myServiceCollection[0].Ports)
{
foreach (ServiceDescriptionFormatExtension extension in port.Extensions)
{
if (extension is SoapAddressBinding)
{
SoapAddressBinding address = (SoapAddressBinding)extension;
address.Location = /*desired address*/;
}
}
}
}
}
}
and then add something to web.config:
<webServices>
<soapExtensionReflectorTypes>
<add type="myNamespace.MyReflector, MyAssembly"/>
</soapExtensionReflectorTypes>
</webServices>
I wonder how can I rewrite the correct domain address for each web service response, I mean. If I want to access that service from 3 different domains, how can I rewrite the correct address programatically at MyReflector class?
Thank you in advance.
Dani.