views:

564

answers:

2

I have a ASP.NET Web Service on IIS, that is working on port 8080. On port 80 I have Apache, that is redirecting some web sites to IIS.

On this case, I can access the Web Service page (http://xxx.com/service/), which gives me all the methods available. However, when I try to invoke a method, it goes to a web page like this one: http://xxx.com:8080/service/Service1.asmx/Method. Of course that a public access can not see any result, the port 8080 is blocked and can not be opened.

Internally, the Web Service works on port 8080, but the public request need to be done to the port 80.

Anyone knows how can I solve my problem?

P.S.: Using IIS 7 and Apache 2.2 under Windows Server 2008

+2  A: 

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

http://xxx.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://xxx.com:8080/service/service1.asmxx" /> 
    </wsdl:port> 
    <wsdl:port name="Service1Soap12" binding="tns:Service1Soap12"> 
        <soap12:address location="http://xxx.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)

Kev
I've already implemented the SoapExtensionReflector solution. It could work if you consume the WSDL, but on this example I'm using the client generated from ASP.NET, which tries to consume the service on port 8080 but don't has permissions to make it!
ukrania
What url are you using to get the WSDL on the client?
Kev
Right now, consuming the Web Service using the WSDL file works fine, because I changed the port on the WSDL. However, the web Interface that ASP.NET generated don't work because it stills using the wrong port (8080).
ukrania
A: 

Any ideas on how to get that to work? Kinda needed it (web interface.......)

Rick
There is an accepted answer, which should really tell you that. If you have a similar problem (but that doesn't help), I suggest you start a **new** question (see "Ask Question"), explain the scenario and the problem, and where this existing answer fails...
Marc Gravell