Hello all,

This code works fine on my Win XP machine, but not on Win2k. I have tried overriding the webrequest function in Reference.vb with

Protected Overrides Function GetWebRequest(ByVal uri As Uri) As System.Net.WebRequest
            Dim webRequest As System.Net.HttpWebRequest

            webRequest = CType(MyBase.GetWebRequest(uri), System.Net.HttpWebRequest)
            'Setting KeepAlive to false
            webRequest.KeepAlive = False
            GetWebRequest = webRequest
        End Function

but that has had no effect. This is the function that works/doesn't work depending on OS.

Private Function GetRequest(ByVal dataToSend As String)

        Dim myXMLResult As XmlElement
        log.Source = "AIMService Repeater"

        Try
            Dim myService As AIMWebService.AIMWebService = New AIMWebService.AIMWebService

            Dim myCert As X509Certificate = X509Certificate.CreateFromCertFile("C:\AIMCert.der")
            myService.ClientCertificates.Add(myCert)
            myService.Timeout = 30000

            Dim xmlDoc As XmlDocument = New XmlDocument
            xmlDoc.LoadXml(dataToSend)

            log.WriteEntry("Received: " & dataToSend, EventLogEntryType.Information)

            Dim myXMLSend As XmlElement = xmlDoc.DocumentElement
            myXMLResult = myService.serviceProcessor(myXMLSend)

            log.WriteEntry("Response: " & myXMLResult.OuterXml.ToString(), EventLogEntryType.Information)

        Catch ex As SoapException

            Dim exception As String = "SoapException: " & ex.ToString()
            log.WriteEntry(exception, EventLogEntryType.Error)
            Return exception

        Catch ex As SoapHeaderException

            Dim exception As String = "SoapHeaderException: " & ex.ToString()
            log.WriteEntry(exception, EventLogEntryType.Error)
            Return exception

        Catch ex As WebException

            Dim exception As String = "WebException: " & ex.ToString()
            log.WriteEntry(exception, EventLogEntryType.Error)
            Return exception

        Catch ex As System.Exception

            Dim exception As String = "Exception: " & ex.ToString()
            log.WriteEntry(exception, EventLogEntryType.Error)
            Return exception

        Finally
        End Try

        If Not myXMLResult Is Nothing Then
            Return myXMLResult.OuterXml.ToString()
        End If

    End Function

And here is the error


System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at AIMServiceRepeater.AIMWebService.AIMWebService.serviceProcessor(XmlElement serviceProcessorElement) in C:\VSS\Not in Sourcesafe\AIMServiceRepeater\AIMServiceRepeater\Web References\AIMWebService\Reference.vb:line 42
at AIMServiceRepeater.AIMServiceRepeater.GetRequest(String dataToSend) in C:\VSS\Not in Sourcesafe\AIMServiceRepeater\AIMServiceRepeater\Service.vb:line 135

It might be a configuration/security issue with Win2k, it might be something I need to program around. I've spent the morning googling this but no one seems to have the issue depending on OS environment.

Many thanks in advance.

Russ

Seems to be a problem with the certificate, it was not installed on my host machine. Even adding the cert to my request it was still required to be installed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.