Link to home
Start Free TrialLog in
Avatar of k heitz
k heitz

asked on

Including hashed signature in HTTP header VB6

Hi Experts -
I have VB6 code that I use to send an XML string to customer URL.
Recently, the customer asked us to include a digital signature in the header.
I've created the signature successfully and it is returned below as sDigSig.

I am not confident of the way I include the signature in HTTP header.
I've been all over the internet and have failed to find how this should be coded.

Please see the line below:
    objXmlHttp.setRequestHeader sDigSig, objDom.xml
below.

I think i need it to say something like:
    objXmlHttp.setRequestHeader  "Content-Type", "hash", sDigSig
but as i mentioned - i am coming up empty w/ the way I'm searching.

Also - we prefer to send this transmission asynchronously (timing is a premium).
Is this still possible to do when using .setRequestHeader ?

Thank you
klheitz

        Set objDom = CreateObject("MSXML2.DOMDocument")
        Set objXmlHttp = CreateObject("MSXML2.XMLHTTP")
       
        objDom.async = True    '07.26.13 change back to true

        '02.20.14 - digital sig to embed in http header...
        Dim sDigSig As String
        Dim objSig As New DigitalSignature.ComClass1
       
       
        sDigSig = objSig.GetSignature(strXML)
        Set objSig = Nothing        
       
        objDom.loadXML

            strPost = CUSTOMER_URL
                                   
            objXmlHttp.Open "POST", strPost, False
           
           
'***** // commented out
'     XMLHTTP.Open "POST", pstrURL, False ' False - syncronous mode
'
'    XMLHTTP.setRequestHeader "Content-Type", "text/xml"
'
'    XMLHTTP.setRequestHeader "X-Username", strUserName
'
'**** end comments

    objXmlHttp.setRequestHeader sDigSig, objDom.xml
                       
    objXmlHttp.Send objDom.xml
           
     strRet = objXmlHttp.responseText
ASKER CERTIFIED SOLUTION
Avatar of zc2
zc2
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 k heitz
k heitz

ASKER

Thank you! Exactly what I needed.
You're welcome.