Link to home
Start Free TrialLog in
Avatar of Dalexan
DalexanFlag 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
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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.
Avatar of 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
Is strPost are any special characters parsed or escaped is that variable?  Does a single-quote in that variable screw it up?
Avatar of Dalexan

ASKER

No special characters or single quotes in that variable.
Did you try GET instead POST?
Avatar of 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.