Avatar of Dalexan
Dalexan
Flag for Afghanistan asked on

xmlHTTP Post gets Error 53 response

When posting data to a web server, I get an Error 53 more often than not.  Problem is, I don't have a way to tell if the data was posted but the response was lost, or if the post itself never made it to the server.  Can anyone clarify with certainty just what this error tells me?  If the data did not make it, I want to try again...if it did, I really do not want duplicate entries, but how do I know?
The code I use is in vb.net 2010 and looks like this:

            xmlHTTP = New MSXML2.XMLHTTP
            xmlHTTP.open("POST", strURL, False)
            xmlHTTP.setRequestHeader("Content-Type", strContentType)
            orderForm.lblStatus.Text = "Checking Info >>>"
            System.Windows.Forms.Application.DoEvents()
            xmlHTTP.send(strPost)
            strResponse = xmlHTTP.responseText
XMLVisual Basic.NETProgrammingWeb Languages and Standards

Avatar of undefined
Last Comment
Dalexan

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dalexan

ASKER
This example states that MSXML is not supported in .net, then proceeds to use MSXML2 in the solution...I am already using MSXML2, not MSXML...

In my code (shown above) I get the Error 53 on the xmlHTTP.send(strPost) line.
Dalexan

ASKER
Here is the full code we are using to post transactions:

    Public Function SendAuthString(ByRef strURL As String, ByRef strPost As String, ByRef strContentType As String) As String
        On Error GoTo ErrorTrap
        Push("frmOrderPoint:SendAuthString(" & strURL & "," & strPost & "," & strContentType & ")")
        LogFileEntry(Peek(), 5)
        Dim iErr As Int16 = 0
        Dim xmlHTTP As MSXML2.XMLHTTP
        Dim strResponse As String = String.Empty
        Dim strAddHead As String = String.Empty
        Dim aURL() As String

        If strContentType = "xCharge" Then
               'commented out section
        ElseIf strContentType = "Base64" Then
            aURL = Split(strURL, "|")
            xmlHTTP = New MSXML2.XMLHTTP
            xmlHTTP.open("POST", aURL(0), False)
            xmlHTTP.setRequestHeader("Authorization", "Basic " & EncodeBase64(aURL(1) & ":" & aURL(2)))
            orderForm.lblStatus.Text = "Checking Info >>>"
            System.Windows.Forms.Application.DoEvents()
            xmlHTTP.send(strPost)
            strResponse = xmlHTTP.responseText
            xmlHTTP = Nothing
        Else
            If strContentType = "" Then
                strContentType = "application/x-www-form-urlencoded"
            End If
            xmlHTTP = New MSXML2.XMLHTTP
            xmlHTTP.open("POST", strURL, False)
            xmlHTTP.setRequestHeader("Content-Type", strContentType)
            orderForm.lblStatus.Text = "Checking Info >>>"
            System.Windows.Forms.Application.DoEvents()
            xmlHTTP.send(strPost)
            strResponse = xmlHTTP.responseText
            xmlHTTP = Nothing
        End If
        SendAuthString = strResponse
ExitFunc:
        Pop()
        Exit Function
ErrorTrap:
        iErr += 1
        If Err.Number = 53 Then
            If iErr < 3 Then
                Pause(2)
                Resume
            End If
        End If
        GStr_f_end_method = Peek()
        GLng_f_end_number = Err.Number
        GStr_f_end_desc = Err.Description
        ErrHandler_OP(frmOrderPoint)
        SendAuthString = ""
        Resume ExitFunc
    End Function
CtrlAltDl

Is strPost are any special characters parsed or escaped is that variable?  Does a single-quote in that variable screw it up?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Dalexan

ASKER
No special characters or single quotes in that variable.
leakim971

Did you try GET instead POST?
Dalexan

ASKER
Instead of troubleshooting this issue we decided to change our code to use the .dll instead of passing the parameters to the customers webservice. We will go forward under the assumption that not supporting msxml is a step in the wrong direction for our application and will pursue a more open source alternative.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.