Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HTTP Response - Eliminating Whitespace

5 views
Skip to first unread message

SimonDev

unread,
Aug 27, 2006, 9:36:01 PM8/27/06
to
Hi

I've got an unusual problem I'm hoping someone could advise me on, regarding
the formatting of the body of an HTTP response from a web service.

We are using HTTP POST rather than SOAP for calling web methods to save
network traffic over a cellular network. Each web method returns an
XmlDocument with a <resp> root element. Most web methods simply return a
single value as the content of the <resp> element (integer or string).
However one returns multiple XML elements within the <resp> root. This is
the one we are having problems with.

Checking the output of the web method using Etherreal I found that the text
of XML document in the HTTP response is being formatted with added white
spaces. In the body of the HTTP response each XML tag is followed by a
carriage return-line feed and prefixed by a varying number of spaces to
indent it (number of spaces depends on the tag's level in the XML hierarchy).

Debugging the web method code I put a break point on the line that returns
the XML document and converted the XML document to a character array. The
character array showed none of the carriage return - line feeds nor the
indenting spaces. From this I assume the formatting is being applied in one
of three places:
1) In the web service, under the hood where I'm not aware of what's going on;
2) By the IIS server the web service is running on;
3) Due to the settings in the HTTP headers in either the POST or the response.

Has anyone any idea of what might be adding the white space formatting to
the XML document in the HTTP response and what I might do to get rid of it?

The web service is written in ASP.NET 2.0 (C#) running on an IIS 6.0 web
server on Windows Server 2003.

The HTTP Header of the request is (as captured by Etherreal):
POST /mrcourier/Config/ConfigWS.asmx/GetBCMs HTTP/1.1\r\n
Content-Type: application/x-www-form-urlencoded\r\n
Host: <server name>\r\n
Content-Length: 27\r\n
Expect: 100-continue\r\n
Connection: Keep-Alive\r\n
\r\n

the HTTP header of the response is:
HTTP/1.1 200 OK\r\n
Date: Sun, 27 Aug 2006 23:37:49 GMT\r\n
Server: Microsoft-IIS/6.0\r\n
X-AspNet-Version: 2.0.50727\r\n
Cache-Control: private, max-age=0\r\n
Content-Type: text/xml; charset=utf-8\r\n
Content-Length: 351\r\n
\r\n

Cheers
Simon

--
Si

0 new messages