Sometimes, when you're testing a web service stored procedure that returns an HTML page to the browser, you run into strange symptoms.
For example: Internet Explorer 8 displays an empty page, and whenThat's when you really want to see what's going on at the boundary between the SQL Anywhere and the browser; i.e., you want to look at the actual HTTP traffic.
you click on "View Page Source" all you see is <HTML></HTML>.
SQL Anywhere lets you record the HTTP traffic in a text file, and it gives you four options to set it up:
- LogFile (LOG) protocol option
- LogMaxSize (LSIZE) protocol option
- LogOptions (LOPT) protocol option
- LogFormat (LF) protocol option
That's what this blog post is for...
...to show an actual working example, complete with the "double quotes" around the LogFormat (lf) option the Help doesn't talk about:"%SQLANY12%\%BIN%\dbspawn.exe"^ -f^ "%SQLANY12%\%BIN%\dbsrv12.exe"^ -c 25p^ -ch 50p^ -cr-^ -gk all^ -gn 120^ -gna 0^ -n foxhound2^ -o foxhound2_debug.txt^ -oe foxhound2_debug_startup.txt^ -on 1M^ -qn^ -sb 0^ -x tcpip^ -xd^ -xs http(port=80;maxsize=0;to=600;kto=600;lopt=ALL,HEADERS;lf="@T - @I - @U - @R - @L - @W - @E";lsize=1M;log=foxhound2_http_log.txt)^ foxhound2.db^ -n fHere's a snippet from foxhound2_http_log.txt:
07/01 15:46:47.986 - 127.0.0.1 - /foxhound - 200 OK - 594 - 0.756 - --> Keep-Alive: 115 --> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 (.NET CLR 3.5.30729) --> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 --> @HttpMethod: GET --> Host: localhost --> Connection: keep-alive --> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 --> Accept-Language: en-us,en;q=0.5 --> @HttpVersion: HTTP/1.1 --> Accept-Encoding: gzip,deflate --> @HttpURI: /foxhound <-- Date: Sun, 01 Jul 2012 19:46:47 GMT <-- Transfer-Encoding: chunked <-- Connection: Keep-Alive <-- Expires: Sun, 01 Jul 2012 19:46:47 GMT <-- Content-Type: text/html <-- Server: SQLAnywhere/12.0.1.3298 07/01 15:46:48.062 - 127.0.0.1 - /rroad_help_frame?f=foxhound_menu - 200 OK - 18543 - 0.048 - --> Keep-Alive: 115 --> @HttpQueryString: f=foxhound_menu --> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 (.NET CLR 3.5.30729) --> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 --> @HttpMethod: GET --> Host: localhost --> Connection: keep-alive --> Referer: http://localhost/foxhound --> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 --> Accept-Language: en-us,en;q=0.5 --> @HttpVersion: HTTP/1.1 --> Accept-Encoding: gzip,deflate --> @HttpURI: /rroad_help_frame?f=foxhound_menu <-- Date: Sun, 01 Jul 2012 19:46:48 GMT <-- Transfer-Encoding: chunked <-- Connection: Keep-Alive <-- Expires: Sun, 01 Jul 2012 19:46:48 GMT <-- Content-Type: text/html <-- Server: SQLAnywhere/12.0.1.3298 ...In my case (not shown here) it was a METHOD="POST" request that was mistakenly sent via METHOD="GET", and the resulting giant-fat-bloated-URL was too long for Internet Explorer 8.
Not too long for Chrome or Firefox or IE9, though, which was driving me craaaaazy :)...
...without the HTTP trace I never would have figured it out; I was this close to saying "Foxhound does not support IE8."
No comments:
Post a Comment