WSDL contains local server name URL in soap:address location attribute

I have a Web service which is being accessed by a third party who uses a Java tool to construct SOAP interfaces from the WSDL published automatically by ASP.Net about my service. The location attribute contains the local name of the server, rather than the external domain, eg.:

- <wsdl:service name="MyService">
- <wsdl:port name="MyServiceSoap" binding="tns:MyServiceSoap">
<soap:address location="http://localservername/MyService.asmx" />
</wsdl:port>
- <wsdl:port name="MyServiceSoap12" binding="tns:MyServiceSoap12">
<soap12:address location="http://localservername/MyService.asmx" />
</wsdl:port>
</wsdl:service>

Is there a way I can override this and have it specify the external domain The tool the third party is using is a run-time tool which creates the interfaces on the fly and so they are unable to intercept and edit the WSDL.


Answer this question

WSDL contains local server name URL in soap:address location attribute

  • ippological

    You could implement SoapExtensionReflector. The reflector gets called when WSDL is generated. Your custom reflector has to implement

    public abstract void ReflectMethod();

    and override

    public virtual void ReflectDescription() {

    }

    The ReflectMethod will be called for each operation, you do not need to do anything in the body, and ReflectDescription() will be called when the wsdl is fully generated, so you can access the full set of ServiceDescription documents via ReflectionContext.ServiceDescriptions, and change the soap:address value.

    You have to GAC your SoapExtensionReflector assembly, and register the reflector in config:

    <configuration>

    <system.web>

    <webServices>

    <soapExtensionReflectorTypes>

    <add type=" MyReflector, ReflectorAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=2166367940166ebc, Custom=null"/>

    </soapExtensionReflectorTypes>

    </webServices>

    </system.web>

    </configuration>

    Thanks,

    Elena


  • vimaljonn

    Thanks for the reply. I will look into this.

  • WSDL contains local server name URL in soap:address location attribute