Solved

SetHeaderRequest not being sent

Posted on 2014-03-06
3
357 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
ID: 39924050
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
ID: 39924056
Accepted my own solution.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

777 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