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 » Http Reply response MIME text/html

Post new topic  Reply to topic
 Http Reply response MIME text/html « View previous topic :: View next topic » 
Author Message
matuwe
PostPosted: Fri Mar 15, 2013 12:01 am    Post subject: Http Reply response MIME text/html Reply with quote

Master

Joined: 05 Dec 2007
Posts: 296

Hi

I am trying to send a response to an HTTP request and the data is wrapped as one long html string, then converted to BLOB and added to OutputRoot.

But the data shows as an XML format
Code:

<html>
   <Body>
       hello
    </Body>
</html>


How can I get my response to be rendered like proper html page. I also tries building my OutputRoot.XMLNSC.HTML.Body

Still get the same

Is there any properties I need...
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Mar 15, 2013 1:30 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
the data is wrapped as one long html string, then converted to BLOB and added to OutputRoot
So why not output it using the BLOB domain?
Back to top
View user's profile Send private message
McueMart
PostPosted: Fri Mar 15, 2013 2:27 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

Do you have:

Code:
<!DOCTYPE html>


As the first line in the HTML document you are returning? Else the browser will render the page as an XML file (i think!).
Back to top
View user's profile Send private message
matuwe
PostPosted: Mon Mar 18, 2013 11:53 pm    Post subject: Reply with quote

Master

Joined: 05 Dec 2007
Posts: 296

It didnt work. I have posted the code.

Code:

CREATE

COMPUTE MODULE testHTML_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
SET OutputLocalEnvironment = InputLocalEnvironment;
-- CALL CopyEntireMessage();
--SET OutputRoot.XMLNSC.html.body.table.tr[1].td ='Dudu';
--SET OutputRoot.XMLNSC.html.body.table.tr[2].td ='Rose';
DECLARE sString CHARACTER '<!DOCTYPE html> <html> <HEAD><TITLE> Monitor</TITLE></HEAD><BODY bgcolor="#FFFFFF" text="#000000" marginheight="0" topmargin="0"> <form> <input type="radio" value="cluster"/></form></BODY></html>';
DECLARE contentType CHAR 'text/html';
SET OutputRoot.Properties.Domain = 'MIME';
SET OutputRoot.HTTPInputHeader."Content-Type" = contentType;
-- create MIME header
SET OutputRoot.MIME."Content-Type" = contentType;
CREATE FIELD OutputRoot.MIME TYPE Name;
DECLARE M REFERENCE TO OutputRoot.MIME;
CREATE LASTCHILD OF M TYPE Name NAME 'Data';
DECLARE newBLOB BLOB;
SET newBLOB = CAST(sString AS BLOB CCSID 1208);
CREATE LASTCHILD OF M.Data DOMAIN('BLOB') NAME 'BLOB';
CREATE LASTCHILD OF M.Data.BLOB NAME 'BLOB' VALUE newBLOB;
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END

MODULE;



Back to top
View user's profile Send private message
McueMart
PostPosted: Tue Mar 19, 2013 1:23 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

Well firstly you didnt tell us what's still not working. Is the browser still just showing the page as if its XML?

Secondly why are you using the MIME domain? You are just trying to send back an HTML response right?

Try creating the payload under OutputRoot.BLOB.BLOB.
Back to top
View user's profile Send private message
matuwe
PostPosted: Tue Mar 19, 2013 4:32 am    Post subject: Reply with quote

Master

Joined: 05 Dec 2007
Posts: 296

Sorry for the incomplete info.. I have changed the code and have just tested
Code:

 
CALL CopyMessageHeaders();
SET OutputLocalEnvironment = InputLocalEnvironment;
DECLARE sString CHARACTER '<!DOCTYPE html> <html> <HEAD><TITLE> Monitor</TITLE></HEAD><BODY bgcolor="#FFFFFF" text="#000000" marginheight="0" topmargin="0"> <form> <input type="radio" value="cluster"/></form></BODY></html>';

DECLARE newBLOB BLOB;
SET newBLOB = CAST(sString AS BLOB CCSID 1208);
SET OUTputRoot.BLOB.BLOB = newBLOB ;
RETURN TRUE;
END;



I have also tried
Code:


SET OutputLocalEnvironment = InputLocalEnvironment;

SET Environment.XMLNSC.html.body.table.tr[1].td ='Dudu';
SET Environment.XMLNSC.html.body.table.tr[2].td ='Rose';

DECLARE newBLOB BLOB;
SET newBLOB = ASBITSTREAM(Environment.XMLNSC BLOB CCSID 1208);
CREATE LASTCHILD OF M.Data DOMAIN('BLOB') NAME 'BLOB';
CREATE LASTCHILD OF M.Data.BLOB NAME 'BLOB' VALUE newBLOB;
RETURN TRUE;



I still get XML back with first line AS <DOCTYPE HTML>


Last edited by matuwe on Tue Mar 19, 2013 6:08 am; edited 1 time in total
Back to top
View user's profile Send private message
McueMart
PostPosted: Tue Mar 19, 2013 5:51 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

Use something like Firebug to ensure that the message you are sending back has the right content type set (in the HTTP headers).

Refer to:

http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/topic/com.ibm.etools.mft.doc/ac00477_.htm?resultof=%22HTTP%22%20%22http%22%20%22Header%22%20%22header%22

Note that by default the HTTPReply node sets 'text/xml' which could be the issue you are seeing!!
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 » Http Reply response MIME text/html
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.