Its a bit complicated, but I do this everyday, for a couple of years.
First, put your processing and the header assign in its own results
page in your taf, here is the assign header I use, that has worked
flawlessly for some time:
<@assign local$httpHeader "HTTP/1.1 200 OK<@crlf>Server: WiTango
5.5.009<@crlf>MIME-Version: 1.0<@crlf>Content-Type: text/
xml;charset=utf-8<@crlf>Content-length: <@var local$cLen><@crlf>X-
Timer: <@timer> ms<@CRLF><@CRLF>">
You can remove the xtimer, this is a custom header I add to monitor
time taken, removed it is like this:
<@assign local$httpHeader "HTTP/1.1 200 OK<@crlf>Server: WiTango
5.5.009<@crlf>MIME-Version: 1.0<@crlf>Content-Type: text/
xml;charset=utf-8<@crlf>Content-length: <@var local
$cLen><@CRLF><@CRLF>">
You must have content length in, or many browsers will blow, so lets
say you have a var that is the xml you are returning like <@var local
$myxmltext> then do this:
<@assign local$cLen <@length "<@var local$myxmltext>">> //<--note,
this is a text var, not a dom var.
<@assign local$httpHeader "HTTP/1.1 200 OK<@crlf>Server: WiTango
5.5.009<@crlf>MIME-Version: 1.0<@crlf>Content-Type: text/
xml;charset=utf-8<@crlf>Content-length: <@var local
$cLen><@CRLF><@CRLF>">
Now, you have to return your xml to the browser, here is the most
important thing to NOT mess up the header. Start a NEW results page
in your taf after the one above at the VERY top, so there is NO chars
or lines before, do this:
<@purgeresults><@var local$myxmltext> //<--make sure your cursor ends
after this variable, and there is NO more chars are lines after the
last ">" here, or it can mess up in some browsers.
The key is to not add any chars into what you are returning, so that
your content-length matches the content exactly, and also, to use
purgeresults directly before, in its OWN results page.
<@purgeresults> will only purge resultsHTML from previous results
pages, not the current, which is why you have to put at VERY top.
None of this is documented, so you have to take my word for it. ;-) I
serve millions of these a day.
--
Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/
On Jul 31, 2007, at 8:13 AM, Mike Scally wrote:
Hi Scott,
Thanks for the response. When I remove the "HTTP/1.1" part of the
header, I receive an error (500). Further investigation shows me
that <@HTTPSTATUSCODE> <@HTTPREASONPHRASE> does not contain this
information, even though I'm using version 5.5?
However, the interesting thing is when I use fiddler, it also
displays the extra carriage return character after the header and
will not display the response as XML either. I have shown the first
few lines of the response from fiddler below and it shows the extra
carriage return. Not sure were it is coming from.
Thanks,
Mike.
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Tue, 31 Jul 2007 15:08:11 GMT
X-Powered-By: ASP.NET
Connection: close
Server: Witango 5.5.003 Liquorice (Win32)
Content-Type: text/xml
<!-- XML response started here.......notice 2 carriage returns
above...
-----Original Message-----
From: Scott Cadillac [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 31, 2007 2:34 PM
To: [email protected]
Subject: RE: Witango-Talk: Using assign with reqest$httpHeader
Hi Mike,
Try removing the "HTTP/1.1 " at the begining of your assignment.
The next two metatags are already providing that information (in
eariler versions you had to do this, but not 5.5).
Also, "MIME-Version: 1.0<@crlf>" is not necessary.
A great tool for debugging this stuff is here http://
www.fiddlertool.com/fiddler/. Install it, run it (no configuration
required), then open IE and run your webpages and see the HTTP
headers in action. Fiddle will even help point out the parts that
are broken.
Hope this helps.
Scott,
On Tue, July 31, 2007 7:31 am, Mike Scally <[EMAIL PROTECTED]> said:
Hi,
I am working on Witango Server 5.5 and I have come across an issue
with IE7. Maybe
someone has either experienced this before or can point me in the
right direction
here. I am using the window.XMLHttpRequest object in the browser
to retrieve XML
content from the server.
When retrieving the XML (pasted below) from the server the
XMLRequest objects
responseXML is empty in IE7 (i.e. it cannot load the XML thinking
its not valid).
However, on IE6 it gets populated with the XML as expected. It
appears the problem
is with using assign and request$httpHeader.
I use
<@ASSIGN request$httpHeader "HTTP/1.1 <@HTTPSTATUSCODE>
<@HTTPREASONPHRASE>
<@crlf>Server: Witango <@version><@crlf>MIME-Version:
1.0<@crlf>Content-Type:
text/xml<@crlf><@SETCOOKIES><@crlf><@crlf>">.
When I check the XML received in the browser there is an extra
return character
(or some other similar character) at the start of the XML.
When I remove the last <@crlf> from the assign and leave as follows :
<@ASSIGN request$httpHeader "HTTP/1.1 <@HTTPSTATUSCODE>
<@HTTPREASONPHRASE>
<@crlf>Server: Witango <@version><@crlf>MIME-Version:
1.0<@crlf>Content-Type:
text/xml<@crlf><@SETCOOKIES><@crlf>"> there is no return character
at the start of
the XML and the XML gets loaded in IE7.
Would anyone have experienced this before? Obviously removing the
second<@crlf>
from the assign will solve the problem but is this creating an
invalid HttpHeader
despite the fact that IE doesn't complain?
Thanks for any help,
Mike.
XML :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<response>
<method>reloadTabContents</method>
<result>
<scripthead>Test12345432</scripthead>
<bodyresult>Test</bodyresult>
</result>
</response>
_____________________________________________________________________
___
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
______________________________________________________________________
__
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
______________________________________________________________________
__TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf