HTTPS Post from VB 6

I have a VB application that posts to a server using ServerXMLHTTP40. Currently it is using  "HTTP" post. But our clients want to use "HTTPS" to post the XML to the server. After the post we get a response back from server as a XML document.
 I am not sure whether the clients are using any Client Certificates or not. But I want to know either way with and without the Client Certificates what kind of changes that are needed in my code or any other configurations.
I did not develop this application and support it and need to advice the client how to do this successfully after makeing any appropriate code changes.
Private Function sendXML() As String
    Dim outXML As String, responseXML As String
    Dim objXMLHttp As ServerXMLHTTP40 ' msxml2.ServerXMLHTTP40
    On Error GoTo sendXMLErr
    If mudtprops.Error Then Exit Function
    mudtprops.PingDate = Now
    outXML = GenerateXML
    mudtprops.PingDate2 = Now
'send XML
    mSendXML = outXML
    If mudtprops.Error Then Exit Function
    Set objXMLHttp = New ServerXMLHTTP40 'MSXML2.ServerXMLHTTP40
    mtime1 = Now
    Err = 0
    With objXMLHttp
        .Open "POST", Trim$(mudtprops.SAPURL), False
        .setTimeouts timeout1, timeout2, timeout3, timeout4       
        .send outXML
        mudtprops.PingDate2 = Now
        If .Status = 200 Then
            sendXML = .responseText
            mReceivedXML = .responseText
            VarifyReceivedXML mReceivedXML
            Err.Raise 10000, "Ping", .Status & "  " & .statusText
        End If
    End With
    Set objXMLHttp = Nothing
    Exit Function
    mudtprops.Error = True
    mudtprops.Status = "Error: Source " + Err.Source + ":sendXML, Description " + Err.Description
    If Not objXMLHttp Is Nothing Then Set objXMLHttp = Nothing
End Function

Open in new window

Who is Participating?
Add a reference to Microsoft WinHTTP Service 5.1

The object structure is not dissimilar to the ServerXMLHTTP object so most of your code will be the same.  You will need to call SetClientCertificate with the correct information.

SSL in winhttp

You will not be able to use client certificates if they are required.  ServerXMLHTTP does not support them, so you would have to go with Microsoft WinHTTP Services 5.1 instead, if that's what they are looking for.

If they do not require them, then all you need to change is the https of the URL to support a server only SSL configuration.  ServerXMLHTTP does that just fine.

lalitha_sabesanAuthor Commented:
What kind of impact  would that have to my VB application? How do I use  MS WinHTTP Services 5.1 within my application?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.