Map the SOAP definition of the WSDL
If for any reason you do not like the return of the WSDL that a Web Service provides us, don’t worry, everything can be modified. Thanks to an article by Christian Weyer, you can alter, as in this case, the URL that returns the label <soap:address location=http://www.tuURL.com /> or <soap12:address location="http://www.tuURL.com" />. Real cases in which the IIS answers through port 80 and the ports are mapped in the firewall, there are redirects,…..
We create a SoapAddressReflector.cs file within the App_Code
using System.Configuration; using System.Web.Services.Description;
namespace SymbiaIT.Tools.Web.Services.Metadata {
publicclassSoapAddressReflector : SoapExtensionReflector
{
publicoverridevoid ReflectMethod()
{
ServiceDescription sd = ReflectionContext.ServiceDescription;
ServiceCollection myServiceCollection = sd.Services;
foreach (Port port in myServiceCollection[0].Ports)
{
foreach (ServiceDescriptionFormatExtension extension in port.Extensions)
{
if (extension isSoapAddressBinding)
{
SoapAddressBinding address = (SoapAddressBinding)extension;
address.Location = ConfigurationManager.AppSettings[“SoapAddress”];
}
}
}
}
}
}
In the relevant sections of the web.config
<configuration>
<appSettings>
<addkey=“SoapAddress"value=“http://scorm.cuadernia.educa.jccm.es/cuadernia/service.asmx"/>
</appSettings>
<system.web>
<webServices>
<soapExtensionReflectorTypes>
<addtype=“SymbiaIT.Tools.Web.Services.Metadata.SoapAddressReflector, App_code”/>
</soapExtensionReflectorTypes>
</webServices>
</system.web>
</configuration>