Author |
Message
|
Esa |
Posted: Tue Jun 05, 2012 4:17 am Post subject: HTTPHeader node creates an invalid header |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Hi,
I added an HTTPRequest header in a message with HTTPHeader node, then put the message in an MQ queue. When I try to read the message with MQget node, I get an exception with BIP 3159: "An error was found whilst parsing HTTP header data. The data is not a HTTP request or response. Invalid HTTP Header data."
V 6.1.0.5 |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 05, 2012 4:31 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So what's the message look like sitting on the queue? |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jun 05, 2012 4:40 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
mqjeff wrote: |
So what's the message look like sitting on the queue? |
Or even before it is put on the Queue? _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Esa |
Posted: Tue Jun 05, 2012 4:42 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
The messages in the queue seem quite OK. MQMD.Format is 'WSREQHDR', but the header contains only the fields I have added myself. I suspect they may be in wrong order or some mandatory fields may be missing. |
|
Back to top |
|
 |
Esa |
Posted: Tue Jun 05, 2012 6:09 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
I did another test with HTTPReqestHeader containing only the Authorization field. I still got the same expection, but Insert 2 contained:
Authorization: Basic XXXXXXXXXX==
<SOAP_Domain_
So I guess WSREQHDR parser does not regognize two <CR><LF> sequences as the terminator of the header? |
|
Back to top |
|
 |
Esa |
Posted: Thu Jun 07, 2012 3:59 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
For anybody struggling with this problem later:
The first field in the http header must be X-Original-Http-Command. That contains HTTP method and version:
Code: |
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN('HTTPInputHeader') NAME 'HTTPInputHeader';
SET OutputRoot.HTTPInputHeader."X-Original-HTTP-Command" = 'POST http://dummy HTTP/1.1'; |
That field will be serialized correctly, without the field name and the colon, which is the tag-data separator of all the other header fields.
I chose to put the message in the queue with an HTTPInputHeader, but I suppose this applies to HTTPRequestHeader, too. You must add the field yourself, HTTPHeader node does not add it (probably because it does not know the actual endpoint URL). So you will have to add the header yourself, too, and then you don't actually need the HTTPHeader node for anything.
I was hoping HTTPHeader node would do the same thing that MQHeader node does: assign the correct parser and ensure that all required fields are present an in the correct order. But it seems the only thing it does is to assign the parser (and add the fields you configure it to add, in the order you added them to the node) |
|
Back to top |
|
 |
|