RE: Web service test page uses internal port



Thanks for your reply Ben,

Yes, the 3rd question is also what I have mentioned in last reply.
Currently it seems ASP.NET webservice handler has done the http GET/POST
test page rendering itself and doesn't provide any means to customize it.
I've met some one encountering the same problem before. So far what we can
get is using a custom test page to invoke the webservice via http GET/POST.
You will also need to replace the test page link in the WSDL document
display page.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.





-------------------->
References: <BE87A28A-CA22-4DDC-84E6-247A81B068EE@xxxxxxxxxxxxx>
<5KbSaoOJIHA.4200@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: Web service test page uses internal port
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!


.



Relevant Pages

  • RE: Web service test page uses internal port
    ... I was able to fix this issue by copying the DefaultWsdlHelpGenerator.aspx ... line of code to remove the port from the test page when it was posted to ... could still develop using custom port numbers. ... Public Overloads Overrides Sub ReflectDescription() ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Custom Serializable Objects
    ... I'm looking for a WebService solution. ... We have looked into Remoting but it ... custom object "Acme.BizObjects.Contract oContract". ... Acme.BizObjects.WS.Contract created by WSDL. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Communicating with a serial port using a web service
    ... reading from its COM port as it always has. ... COM1 to COM2 in order to get the legacy system to see the webservice data. ... > The only interface to the legacy system is a GUI and the serial port. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: DataSets V Custom Objects
    ... By sending a DS over a webservice, ... e) There are better devised serialization mechanisms devised over the years, ... I had written a custom remoting formatter once to compress all ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to overcome the Microsoft bug in datagrid?
    ... In essence, I call a webservice, then create a custom table style ... WITHOUT the custom table style. ... Dim tblStyle As New DataGridTableStyle ... Dim tbc22 As New DataGridTextBoxColumn ...
    (microsoft.public.dotnet.framework.compactframework)

Quantcast