Solved

SetHeaderRequest not being sent

Posted on 2014-03-06
3
368 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:k heiutz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Accepted Solution

by:
k heiutz 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:k heiutz
ID: 39924056
Accepted my own solution.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

732 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