Author |
Message
|
Krayvyn |
Posted: Thu Aug 23, 2007 10:38 am Post subject: MIME Parser (I want HTTP Response to appear in browser) |
|
|
Novice
Joined: 08 Jun 2005 Posts: 12
|
Can someone give me some direction?
I am trying to use the HTTP nodes to query a database and return the data in an HTML format so it can be viewed directly from the Web Page that submitted the request.
I was able to get it to show up as XML; however, I want it to show up as HTML. I created an XSLT that creates the HTML structure for me, I added an XML Transformation node and ran it through. Again in the browser the response shows up as an XML structure, if I grab the page source, save it, and open that in a browser I get exactly what I want.
I read on this forum that I should be using the MIME parser to get it to show as HTML automatically.
I have been testing to get the format correct on the MIME parser and have been unsuccessful.
I have tried a multipart MIME with Parts, and also a MIME with only Data (along with anything else I can think of trying).
When I try MIME with only Data per the information I read from http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac30080_.htm
Special cases of multipart MIME
The MIME parser is intended primarily for use with multipart MIME messages. However, the parser also handles some special cases:
* Single-part MIME. For single-part MIME, the logical tree has no Parts child. The last child of the MIME tree is the Data element. The Data element is the parent of the BLOB that contains the message data.
I get the following error :
Trace :
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2007-08-23 18:07:47.340'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'multipart/related; boundary=myBoundary'
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://localhost:7080/viewDB/Dev/ HTTP/1.1'
(0x03000000):Host = 'localhost:7080'
(0x03000000):User-Agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6'
(0x03000000):Accept = 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
(0x03000000):Accept-Language = 'en-us,en;q=0.5'
(0x03000000):Accept-Encoding = 'gzip,deflate'
(0x03000000):Accept-Charset = 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
(0x03000000):Keep-Alive = '300'
(0x03000000):Connection = 'keep-alive'
(0x03000000):Content-Type = 'application/x-www-form-urlencoded'
(0x03000000):Content-Length = '46'
)
(0x01000000):MIME = (
(0x03000000):Content-Type = 'multipart/related; boundary=myBoundary'
(0x01000000):Data = (
(0x01000000):BLOB = (
(0x03000000):BLOB = X'3c68746d6c203e3c6(I truncated the blob)'
)
)
)
The exception I get is :
(
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S000_P\src\DataFlowEngine\PluginInterface\ImbJniNode.cpp'
(0x03000000):Line = 922
(0x03000000):Function = 'ImbJniNode::evaluate'
(0x03000000):Type = 'ComIbmJniNode'
(0x03000000):Name = 'Log_Display#FCMComposite_1_12'
(0x03000000):Label = 'Log_Display.ServiceInfoXSL'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 2230
(0x03000000):Text = 'Caught exception and rethrowing'
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S000_P\src\WebServices\WSLibrary\ImbWSReplyNode.cpp'
(0x03000000):Line = 763
(0x03000000):Function = 'ImbWSReplyNode::evaluate'
(0x03000000):Type = 'ComIbmWSReplyNode'
(0x03000000):Name = 'Log_Display#FCMComposite_1_7'
(0x03000000):Label = 'Log_Display.HTTP Reply'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 2230
(0x03000000):Text = 'Caught exception and rethrowing'
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S000_P\src\MTI\MTIforBroker\MIMEParser\MIMEwriter.cpp'
(0x03000000):Line = 219
(0x03000000):Function = 'MIMEWriter::write()'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 5664
(0x03000000):Text = 'Last child of Data not owned by BLOB parser'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'Data'
)
)
)
)
)
Should I be using a single-part MIME? If not what should I be using?
I am using v5.6, on AIX. I am sure I am missing something stupid at this point.
Any help would be appreciated. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Aug 23, 2007 10:40 am Post subject: Re: MIME Parser (I want HTTP Response to appear in browser) |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Krayvyn wrote: |
(0x03000000):Text = 'Last child of Data not owned by BLOB parser' |
Also, I don't think you are using anything with a version number of "5.6". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Krayvyn |
Posted: Thu Aug 23, 2007 10:49 am Post subject: |
|
|
Novice
Joined: 08 Jun 2005 Posts: 12
|
Oops, 5.0.6.
From IBM link my structure should be :
Root.MIME.Data.BLOB.BLOB
The Data element is the parent of the BLOB that contains the message data.
So I don't understand why I get that error, obviously my structure is incorrect, any idea on what my structure should look like? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Aug 23, 2007 11:12 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You didn't create that child using the BLOB parser. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Krayvyn |
Posted: Thu Aug 23, 2007 11:21 am Post subject: |
|
|
Novice
Joined: 08 Jun 2005 Posts: 12
|
Awesome, thanks Jeff. I think the light just went on.
I will try some other options. |
|
Back to top |
|
 |
Krayvyn |
Posted: Wed Aug 29, 2007 9:21 am Post subject: |
|
|
Novice
Joined: 08 Jun 2005 Posts: 12
|
I created the MIME.Data.BLOB.BLOB element with the BLOB Parser. I am not getting any errors.
It is successfully returning the message; however, it is still not showing up in the html format automatically.
Any ideas on how I can get the response to return in html? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 29, 2007 9:23 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Is the part of content-type "text/html"? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Krayvyn |
Posted: Wed Aug 29, 2007 11:52 am Post subject: |
|
|
Novice
Joined: 08 Jun 2005 Posts: 12
|
I don't have any parts.
I read for single part MIME :
For single-part MIME, the logical tree has no Parts child. The last child of the MIME tree is the Data element. The Data element is the parent of the BLOB that contains the message data.
Should I not be using a single part MIME?
It may be that I am in the wrong forest.  |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 29, 2007 12:04 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The main content-type, then, needs to be "text/html". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Krayvyn |
Posted: Thu Aug 30, 2007 3:42 am Post subject: |
|
|
Novice
Joined: 08 Jun 2005 Posts: 12
|
Here is my trace :
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2007-08-30 11:35:24.034'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'text/html'
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://localhost:7080/viewDB/Dev/ HTTP/1.1'
(0x03000000):Host = 'localhost:7080'
(0x03000000):User-Agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6'
(0x03000000):Accept = 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
(0x03000000):Accept-Language = 'en-us,en;q=0.5'
(0x03000000):Accept-Encoding = 'gzip,deflate'
(0x03000000):Accept-Charset = 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
(0x03000000):Keep-Alive = '300'
(0x03000000):Connection = 'keep-alive'
(0x03000000):Content-Type = 'application/x-www-form-urlencoded'
(0x03000000):Content-Length = '46'
)
(0x01000000):MIME = (
(0x03000000):Content-Type = 'text/html'
(0x01000000):Data = (
(0x01000000):BLOB = (
(0x03000000):BLOB = X'3c68746d6c203(I removed remaining BLOB)
)
)
Thanks again for your help. |
|
Back to top |
|
 |
Krayvyn |
Posted: Tue Sep 04, 2007 8:23 am Post subject: Working |
|
|
Novice
Joined: 08 Jun 2005 Posts: 12
|
I was able to get it working :
Here is my ESQL if anyone is stuck with a similiar issue :
-- Creating MIME message
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';
SET newBLOB = CAST(BLOBCHAR AS BLOB CCSID InputRoot.Properties.CodedCharSetId);
CREATE LASTCHILD OF M.Data DOMAIN('BLOB') NAME 'BLOB';
CREATE LASTCHILD OF M.Data.BLOB NAME 'BLOB' VALUE newBLOB;
I also had to check the "Generate default HTTP headers from input or response". (Which I had inadvertantly removed on one of my test permutations.) |
|
Back to top |
|
 |
|