ASP.NET Web Service changes port on Invoke

陌路散爱 提交于 2019-12-04 09:26:50
Kev

The most likely reason for this is that your web service generated WSDL will define the service endpoint address as:

http://example.com:8080/service/service1.asmx

You could provide a separate static WSDL definition and modify the following section to use port 80:

<wsdl:service name="Service1"> 
    <wsdl:port name="Service1Soap" binding="tns:Service1Soap"> 
        <soap:address location="http://example.com:8080/service/service1.asmxx" /> 
    </wsdl:port> 
    <wsdl:port name="Service1Soap12" binding="tns:Service1Soap12"> 
        <soap12:address location="http://example.com:8080/service/service1.asmx" /> 
    </wsdl:port> 
</wsdl:service>

This should cause the client to consume the WSDL and generate stub code to bind to the correct port (which is the Apache server acting as a proxy).

Another alternative method to force the correct address to appear in the generated WDSL is to use a SoapExtensionReflector to modify the address location on the fly:

Modify a Web Service's WSDL Using a SoapExtensionReflector

I have used the above method successfully in the past.

Alternatively, you could, if the client is .NET based, override the base URL for the service:

WebClientProtocol.Url Property (MSDN Library)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!