NETWORK WORLD NEWSLETTER: MARK GIBBS ON WEB APPLICATIONS
08/25/04
Today's focus:  HTTP POSTs, XML and problems

Dear [EMAIL PROTECTED],

In this issue:

* A really geeky topic 
* Links related to Web Applications
* Featured reader resource
_______________________________________________________________
This newsletter is sponsored by Alterpoint 

Read the latest analyst report on Network Change and 
Configuration Management (NCCM) written by EMA's Dennis 
Drogseth.  This report discusses the latest developments in the 
NCCM market, including an in-depth look at DeviceAuthority 
Suite, a comprehensive solution for configuring, changing, and 
controlling today's complex, multi-vendor IT network 
infrastructures.   Download the report today to learn how you 
can leverage NCCM to reduce the cost and complexity of managing 
network change. 
http://www.fattail.com/redir/redirect.asp?CID=73313
_______________________________________________________________
CONTEMPLATING A CAREER MOVE? 

For many of us, it is time to contemplate a change. You're great 
at managing networks, but what about your career? Get 
information and advice for managing and developing your career 
and guiding your staff's career choices at NW Fusion's Career 
Research Center. Click here: 
http://www.fattail.com/redir/redirect.asp?CID=73204
_______________________________________________________________

Today's focus:  HTTP POSTs, XML and problems

By Mark Gibbs

Today I have a really geeky topic for you: a problem that you 
may run into with applications that send XML data as POST 
requests but do so incorrectly.

This is an important topic, and if you are trying to do a 
client/server interfacing job what I'm going to tell you may 
save you a few hours of head scratching.

Now, in case you have forgotten, the payload of a POST request 
follows the header. It looks something like this:

POST /test.asp HTTP/1.1 
Host: www.somehost.com 
User-Agent: Mozilla/4.0 
Content-Length: 27 
Content-Type: application/x-www-form-urlencoded

userid=bob&password=fish

The payload is everything that comes after the blank line that 
follows the header. The format of the POST payload should be 
"variable=value" pairs separated by ampersands. This format is 
expected by the Web server because the original design for the 
POST interface was based on a data stream generated by a form in 
a browser. The form's data consisted of fields and their values.

So, when you create a script (ASP, JSP, VBScript, etc.) to 
handle a POST request the data is parsed by the Web server on 
receipt from the client and then passed to your script.

Consider what this looks like using Active Server Pages (ASP) 
code: When you retrieve form data, you access the browser's POST 
request through the Request object's Form collection - in 
VBScript it looks like this:

mydata = Request.Form("userid")

>From the POST request I detailed above, this code would set 
mydata equal to "bob" (quotes not included) - the same result 
would be gained using:

mydata = Request.Form(1).

If your application sends an XML data stream to a Web server, it 
may well look something like the following:

<data> 
<variable name="Some Stuff"> 
<row> 
<column>A A A</column> 
<column>B B B</column> 
<column>C C C</column> 
</row> 
<row> 
<column>D</column> 
<column>E</column> 
<column>F</column> 
</row> 
</variable> 
</data>

This is actually the format of a three column, two-row 
table-type format generated by an application I was working 
with. When that data is received and processed by a Web server 
through the Form collection using the code above, the contents 
of mydata will be:

"SomeStuff"><row><column>AAA</column><column>BBB</column> 
<column>CCC</column></row><row><column>D</column><column> 
E</column><column>F</column></row></variable></data>

What has happened is that the built-in parsing of POST requests 
by the Web server assumed that the characters "<data><variable 
name" is the name of the variable (demarcated by the "=" that 
gets thrown away) and that everything else following (except for 
the disposed of "=") was the value of that field.

But wait! There's more!

You might have noticed something missing! You're right if you 
spotted the missing white space ... not the white space that was 
between the XML tags (that is not relevant) but the missing 
spaces in the data in tags. This is because it is the 
responsibility of the sender to "URL encode" all characters per 
RFC 1738, the "Uniform Resource Locators (URL)" specification, 
before sending them to the server. In the case of white space, 
the Web server simply ignores them. If other un-encoded 
characters were present, such as ampersands and equal signs, 
they would cause the server to make further assumptions and 
complicate matters even more!

A significant part of the problem I faced was due to the 
application I was working with which, it turns out, performs URL 
encoding incompletely. Consider the following characters:

$&+,/:;=?@ "'<>#%{}|\^~`

If this was URL encoded to RFC 1738, the character sequence sent 
to the server should be:

%24&%2B%2C/:;[EMAIL PROTECTED]'%3C%3E#%25%7B%7D%7C%5C%5E%7E%60

But the application generated the following:

$&amp;+,/:;=?@ &quot;&apos;&lt;&gt;#%{}|\^~`

The result of the application POSTing XML data without 
conforming to the data format the Web server expects and not 
performing complete URL encoding cost me about six hours before 
I figured out what was going on. I just hope you read this 
before you suffer the same fate.

After all that, I need a drink. Cheers.

RELATED EDITORIAL LINKS

RFC 1738
http://www.w3.org/Addressing/rfc1738.txt

Discussion of URL encoding
http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

New Microsoft server tightens integration
Network World, 08/23/04
http://www.nwfusion.com/news/2004/082304mshost.html?nl2
_______________________________________________________________
To contact: Mark Gibbs

Mark Gibbs is a consultant, author, journalist, and columnist 
and he writes the weekly Backspin and Gearhead columns in 
Network World. We'll spare you the rest of the bio but if you 
want to know more, go to <http://www.gibbs.com/mgbio>. Contact 
him at <mailto:[EMAIL PROTECTED]> 
_______________________________________________________________
This newsletter is sponsored by Alterpoint 

Read the latest analyst report on Network Change and 
Configuration Management (NCCM) written by EMA's Dennis 
Drogseth.  This report discusses the latest developments in the 
NCCM market, including an in-depth look at DeviceAuthority 
Suite, a comprehensive solution for configuring, changing, and 
controlling today's complex, multi-vendor IT network 
infrastructures.   Download the report today to learn how you 
can leverage NCCM to reduce the cost and complexity of managing 
network change. 
http://www.fattail.com/redir/redirect.asp?CID=73312
_______________________________________________________________
ARCHIVE LINKS

Archive of the Web Applications newsletter:
http://www.nwfusion.com/newsletters/web/index.html
_______________________________________________________________
FEATURED READER RESOURCE
WONDERING IF YOUR PAY IS UP TO SNUFF?

Check out Network World's 2004 Salary Calculator to see if 
you're getting paid what you're worth. Using data collected in 
the 2004 Network World Salary Survey, we've programmed this 
calculator with several categories that could affect your pay. 
Answer the questions and find out what the average salary is for 
your job category. Click here:
<http://www.nwfusion.com/salary/2004/calculator.html>
_______________________________________________________________
May We Send You a Free Print Subscription? 
You've got the technology snapshot of your choice delivered 
at your fingertips each day. Now, extend your knowledge by 
receiving 51 FREE issues to our print publication. Apply 
today at http://www.subscribenw.com/nl2

International subscribers click here: 
http://nww1.com/go/circ_promo.html
_______________________________________________________________
SUBSCRIPTION SERVICES

To subscribe or unsubscribe to any Network World e-mail 
newsletters, go to: 
<http://www.nwwsubscribe.com/Changes.aspx> 

To unsubscribe from promotional e-mail go to: 
<http://www.nwwsubscribe.com/Preferences.aspx> 

To change your e-mail address, go to: 
<http://www.nwwsubscribe.com/ChangeMail.aspx> 

Subscription questions? Contact Customer Service by replying to 
this message.

This message was sent to: [EMAIL PROTECTED] 
Please use this address when modifying your subscription. 
_______________________________________________________________

Have editorial comments? Write Jeff Caruso, Newsletter Editor, 
at: <mailto:[EMAIL PROTECTED]> 

Inquiries to: NL Customer Service, Network World, Inc., 118 
Turnpike Road, Southborough, MA 01772

For advertising information, write Kevin Normandeau, V.P. of 
Online Development, at: <mailto:[EMAIL PROTECTED]> 

Copyright Network World, Inc., 2004

------------------------
This message was sent to:  [EMAIL PROTECTED]


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to