Solved

SetHeaderRequest not being sent

Posted on 2014-03-06
3
362 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
what is %x80-FF means 4 107
vb6 connector to mongodb 2 123
Can we place a tooltip on the actual vb6 form 5 48
vbModal 12 57
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

808 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