ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » need some help on http response

Post new topic  Reply to topic
 need some help on http response « View previous topic :: View next topic » 
Author Message
WBI_user
PostPosted: Wed Oct 12, 2005 11:02 am    Post subject: need some help on http response Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

I am not sure if this is a MB question or I simply do not know enough about http response.

I am running MB V5 with CSD 6.
I am testing the httprequest node (plain http request and response not web servcies).

My flow is like
mqinput - compute1 -httprequest - trece- compute2 - mqouput.

The message domain is blob

compute1 does nothing but just copy entire message
compute2 is to add MQ header back so that the http response can be output to the queue.

the httprequest node has
http://192.168.123.191:58080/
timeout 60
use input message as request (checked)
replace inout message with web service response (checked)
generate default http header (checked)

For this test, I have a simple http server (my own java program) running which listens on port 58080. All it does is build a reply with part of the original request data.

using nettool ( a utility to send and look at http reposne) I can see the reply generated by my http server is when I send a request conatining '123456' (plain text)

HTTP/1.0 200
Content-Type: text/plain

POST / HTTP/1.1
Host: 182.168.123.191
Content-Length: 6
Content-Type: text/xml
Connection: close

I then use MQ explorer to put a messgae (123456) to the input queue, I can see my http server showing data received as

POST / HTTP/1.0
Content-Length: 6
Content-Type: text/xml; charset=utf-8
Host: 192.168.123.191
SOAPAction: ""

This indicates that the httprequest node has sent out the request

But I am not getting any output

Trace node output shows exceptions as follow
:
:
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S500_P\src\WebServices\WSLibrary\ImbWSRFC822HeaderParser.cpp'
(0x03000000):Line = 662
(0x03000000):Function = 'ImbHTTPHeaderParser::parseHttpHeaderLine'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Text = 'An error was found whilst parsing HTTP header data. The data is not a HTTP request or response. Invalid HTTP Header data.'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 3159
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '0'
)
(0x01000000):Insert = (
(0x03000000):Type = 14
(0x03000000):Text = 'HTTP/1.0 200
Content-Type: text/plain

POST / HTTP'
)
)

This means that my http server has returned a reply
" 'HTTP/1.0 200
Content-Type: text/plain

POST / HTTP'..."



Since it says invalid http header, so I did some reading to fnd out what the http response should look like and I came up with the following:

Http reponse
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF

It seems that I am missing the Reason-Phrase

So I change my program to return
HTTP/1.0 200 OK
Content-Type: text/plain

[some data from request]


But I am still not getting the output and now the trace shows a different error
:
:
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S500_P\src\WebServices\WSLibrary\ImbWSRequest.cpp'
(0x03000000):Line = 282
(0x03000000):Function = 'ImbWSRequest::readHTTPHeadersFromSocket'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Text = 'An error occured whilst performing a TCP/IP socket operation. The socket was closed before all expected data was received, as the end of the HTTP headers have not been found. Total data received: &1.'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 3161
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '156'
)
)
)

It seems that it is not even reading the reply properly.
Any help ?
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Oct 12, 2005 11:21 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

Your analysis of your first error is correct, the Request Node expects a well formed HTTP response, and that means including the reason phrase.

Your second error is similar in that the response is not well formed because it did not include the end of the HTTP headers marker. The standard defines the end of headers as CRLFCRLF, that is a single CRLF on a line by itself, after the end of the final header, but before the body of the response (if any). The error message is telling you that this was not found, and the socket was closed before the CRLFCRLF sequence was seen. And a response without the end of headers marker is not a valid response. Add this in and you should be fine.

Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
WBI_user
PostPosted: Wed Oct 12, 2005 1:47 pm    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

This is how I generate the http response
PrintWriter pw = new PrintWriter(new OutputStreamWriter(client.getOutputStream()));
pw.print("HTTP/1.0 200 OK\nContent-Type: text/plain\n\n");

You can see that I already have the required CRLF. Did I miss something ?
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Oct 12, 2005 2:26 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

\n gives you a LF but you also need a preceding \r to give you a CR. So each \n needs to be \r\n, so your final \n\n will end up \r\n\r\n

Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
WBI_user
PostPosted: Wed Oct 12, 2005 3:28 pm    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

Thanks a lot. That works
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » need some help on http response
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.