Solved

SetHeaderRequest not being sent

Posted on 2014-03-06
3
353 Views
Last Modified: 2014-03-12
Dear Experts -

I'm on the last leg (i hope) of a project I have been struggling with. The Experts here have held my hand thru much of it with success - I am not experienced in this area and have run into another brick wall.

I have a hashed digital signature that needs to be sent to the customers site (which is a proxy). The code below is giving me an http.status response of 12004. I've found very little documentation on this response, except that it can be found as an http error for 'internal error'.

As an aside - he would like me to set the protocol version of my message.
In C# it's done like:        
<httpwebrequestobject>.setRequestHeader "Protocol", "System.Net.HttpVersion.Version10"

I'm not using webrequests; just MSXML2.XMLHTTP. Is there a way to set the protocol w/ this?

And the final issue - the customer is not receiving my
setheaderrequest = "hash", sdigsig.
He has sent me the headers he is receiving (below code)

Here is the code (VB6)

**** code ****
Dim objXML As New MSXML2.XMLHTTP
Set objXmlHttp = CreateObject("MSXML2.XMLHTTP")
                               
        '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
                
         strPost = "https://feeds.CUSTOMER.com/Feed
                        
         objXmlHttp.Open "POST", strPost, True
         objXmlHttp.setRequestHeader "hash", sDigSig
          objXmlHttp.Send (strXML)

Open in new window

**** end code

Here is what customer is receiving - i should note he is only receiving intermittent messages.

*** Customer feedback ****
Looking at the log, I d not see this message you just sent, but I do see another one sent about an hour ago.

For that message, the message body says "/Feed". It also is not finding an HTTP Header named "hash". Here are the Headers it is receiving:

http.headers={Accept-Language=en-US,
Host=feeds.CUSTOMER.com,
Accept-Encoding=gzip, deflate,
User-Agent=Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E),
Keep-Alive=true,
Connection=true,
Accept=*/*}
*** end of customer feedback

Does anyone have ideas what is failing (error 12004) or why he isn't getting my header request "hash" "

Thank you
0
Comment
Question by:klheitz
  • 2
3 Comments
 

Accepted Solution

by:
klheitz earned 0 total points
Comment Utility
Hi Experts;
I determined the best way to handle this issue was to move the message send code to vb.net and create a .COM exposed component.

In .net I was able to use HTTPWebRequest which gave me much more control and feedback.

.net Code to replace above is below.

 Public Sub SendMessage(strXMLIN As String, sDigSigIN As String, strURLIN As String)

        Dim req As HttpWebRequest = DirectCast(WebRequest.Create(strURLIN), HttpWebRequest)
        Dim encoding As New UTF8Encoding()
        Dim data As Byte() = encoding.GetBytes(strXMLIN)


        req = DirectCast(WebRequest.Create(strURLIN), HttpWebRequest)

        req.Method = "POST"
        req.ContentType = "application/x-www-form-urlencoded"
        req.ContentLength = data.Length
        req.ProtocolVersion = System.Net.HttpVersion.Version10
        req.Connection = False
        req.Headers.Set("hash", sDigSigIN)

        Dim strm As Stream = req.GetRequestStream()

        strm.Write(data, 0, data.Length)
        strm.Close()

        Dim response As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)

        response.Close()

    End Sub

From w/n my VB6 project, I use the .net component this way:

            Dim objSig As New DigitalSignature.ComClass1
            sDigSig = "string hash previously created"
            strXML = "xml string previously created"

            strPost = "https://feeds.CUSTOMER.com/Feed"

            objSig.SendMessage strXML, sDigSig, strPost
            Set objSig = Nothing
0
 

Author Closing Comment

by:klheitz
Comment Utility
Accepted my own solution.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
A few customers have recently asked my thoughts on Password Managers.  As Security is a big part of our industry I was initially very hesitant and sceptical about giving a program all of my secret passwords.  But as I was getting asked about them mo…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 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

14 Experts available now in Live!

Get 1:1 Help Now