HTTPS Post from VB 6

Posted on 2009-02-20
Last Modified: 2013-11-15
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

Question by:lalitha_sabesan
    LVL 38

    Expert Comment

    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.


    Author Comment

    What kind of impact  would that have to my VB application? How do I use  MS WinHTTP Services 5.1 within my application?
    LVL 38

    Accepted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
    I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
    Video by: Tony
    This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
    The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now