• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 524
  • Last Modified:

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
        '.setTimeouts
        .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
        Else
            Err.Raise 10000, "Ping", .Status & "  " & .statusText
        End If
    End With
    Set objXMLHttp = Nothing
    Exit Function
    
sendXMLErr:
    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

0
lalitha_sabesan
Asked:
lalitha_sabesan
  • 2
1 Solution
 
PaulHewsCommented:
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.

0
 
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?
0
 
PaulHewsCommented:
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
http://msdn2.microsoft.com/en-us/library/aa384076.aspx
SetClientCertificate
http://msdn2.microsoft.com/en-us/library/aa384055.aspx


0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now