RE: Web service test page uses internal port
- From: Ben M <BenM@xxxxxxxxxxxxxxxx>
- Date: Mon, 12 Nov 2007 11:46:01 -0800
Thank you Steven! Using the links you provided I was able to fix most, but
not all, of my problems. Now that I understand the situation better I have
identified 3 issues, two of which I have resolved (documented below for
reference) and one that has not been resolved which I still need your help
with.
#1 - Port in test page
-------------------------------
I was able to fix this issue by copying the DefaultWsdlHelpGenerator.aspx
file from the current framework config sub directory to my website and adding
1 line of code to remove the port from the test page when it was posted to
our live server. I left it alone if the location was localhost so that I
could still develop using custom port numbers. Here is the line of code I
added:
if (!httpAddress.Location.StartsWith("http://localhost"))
{httpAddress.Location = httpAddress.Location.Replace("8000",
"80").ToString();}
I also had to add the following to the web config file in order to use the
custom test page:
<webServices>
<wsdlHelpGenerator href="DefaultWsdlHelpGenerator.aspx"/>
</webServices>
#2 - Port in the WSDL for Soap
---------------------------------------------
I was able to fix this by adding a custom class to the App_Code directory:
Imports System
Imports System.Web.Services.Description
Public Class CustomSoapExtensionReflector
Inherits SoapExtensionReflector
Public Overloads Overrides Sub ReflectMethod()
'no-op
End Sub
Public Overloads Overrides Sub ReflectDescription()
Dim description As ServiceDescription =
ReflectionContext.ServiceDescription
For Each service As Service In description.Services
For Each port As Port In service.Ports
For Each extension As ServiceDescriptionFormatExtension In
port.Extensions
Dim binding As SoapAddressBinding = TryCast(extension,
SoapAddressBinding)
If binding IsNot Nothing Then
If Not
binding.Location.StartsWith("http://localhost") Then
binding.Location =
binding.Location.Replace(":8000", "")
End If
End If
Next
Next
Next
End Sub
End Class
And also modifying the web.config to point to the new class:
<webServices>
<soapExtensionReflectorTypes>
<add type="CustomSoapExtensionReflector, App_Code"/>
</soapExtensionReflectorTypes>
</webServices>
#2 - Port in the WSDL for Http
--------------------------------------------
This issue has NOT been resolved. Although the solution to issue #2 solved
the first two items in the WSDL (see Soap & Soap12 below) it did not solve
the third item, HttpPost (see the port 8000 still in the WSDL file below). I
still need help figuring out how to change that one along with the others.
<wsdl:service name="MyWebServices">
<wsdl:port name="MyWebServicesSoap" binding="tns:MyWebServicesSoap">
<soap:address location="http://www.mydomain.com/MyWebServices.asmx" />
</wsdl:port>
<wsdl:port name="MyWebServicesSoap12" binding="tns:MyWebServicesSoap12">
<soap12:address location="http://www.mydomain.com/MyWebServices.asmx" />
</wsdl:port>
<wsdl:port name="MyWebServicesHttpPost" binding="tns:MyWebServicesHttpPost">
<http:address location="http://www.mydomain.com:8000/MyWebServices.asmx"
/>
</wsdl:port>
</wsdl:service>
Thanks in advance for any additional help!
.
- Follow-Ups:
- RE: Web service test page uses internal port
- From: Steven Cheng[MSFT]
- RE: Web service test page uses internal port
- References:
- Web service test page uses internal port
- From: Ben M
- RE: Web service test page uses internal port
- From: Steven Cheng[MSFT]
- Web service test page uses internal port
- Prev by Date: RE: Web service test page uses internal port
- Next by Date: Re: Passing an array of images to a Web Service. Can this be done?
- Previous by thread: RE: Web service test page uses internal port
- Next by thread: RE: Web service test page uses internal port
- Index(es):
Relevant Pages
|