473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Sending compressed Web Service requests to Apache server

We have a .NET 1.1 client which is sending a gzipped soap request using
HttpWebRequest to an Apache server. The Apache server is using a the
'mod_deflate' server to decompress the incoming message, and to also compress
the response (GZIP).

The mod_deflate filter requires the 'Content-Length' header contained within
the incoming request to specify the number of UNCOMPRESSED bytes being sent
and not the actual bytes of the body of the compressed HTTP request itself.
The problem we have is .NET requires that you specify the number of actual
bytes written to the request stream as specified in the Content-Length header
of the request message. The exception we receive when attempting to close
the stream to send the request is:

[System.IO.IOException]: {System.IO.IOException}
HelpLink: Nothing
InnerException: Nothing
Message: "Cannot close stream until all bytes are written."
Source: "System"
StackTrace: " at System.Net.ConnectStream.CloseInternal(Boolean
internalCall, Boolean ignoreShutDownCheck)"
TargetSite: {System.Reflection.RuntimeMethodInfo}

Is there any way around this issue?

Jul 21 '05 #1
5 3191
Hi Perry,

Thanks for your posting. From your description, you're using the
HttpWebREquest component in .net to send a certain compressed package
(GZIP) to a service hosted on a apache web server. That service will
decompress the package and send back a compressed response. The problem is
that that service module need to get the actual length of the uncompressed
package stream rather than the compressed length of the Content-Length in
the httpwebrequest's request message, yes?

As for the HttpWebRequest's ContentLength, i'm afraid this is a fixed
behavior that we must set the value as the actual length of the binary
stream in the Request stream rather than any other value. And this is
defined by the standard http message. Are you sending the compressed
package using the multi-part/form-data contenttype? If so, we can add some
additional name/value fields into the http message body to represent the
uncompressed package's size (or some other custom http headers) , but it
all depend on the serverside's service module which may need to change the
way it retrieve the package's actual size( not use the content-length of
the http message).

Please feel free to post here if you have any other ideas or concerns
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 21 '05 #2


"Steven Cheng[MSFT]" wrote:
Hi Perry,

Thanks for your posting. From your description, you're using the
HttpWebREquest component in .net to send a certain compressed package
(GZIP) to a service hosted on a apache web server. That service will
decompress the package and send back a compressed response. The problem is
that that service module need to get the actual length of the uncompressed
package stream rather than the compressed length of the Content-Length in
the httpwebrequest's request message, yes?

As for the HttpWebRequest's ContentLength, i'm afraid this is a fixed
behavior that we must set the value as the actual length of the binary
stream in the Request stream rather than any other value. And this is
defined by the standard http message. Are you sending the compressed
package using the multi-part/form-data contenttype? If so, we can add some
additional name/value fields into the http message body to represent the
uncompressed package's size (or some other custom http headers) , but it
all depend on the serverside's service module which may need to change the
way it retrieve the package's actual size( not use the content-length of
the http message).

Please feel free to post here if you have any other ideas or concerns
.Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Your description of what we're trying to accomplish is correct.

As to your suggestion to send custom headers, that currently isn't an
option.

We did try experiementing with sending a chunked request since with chunked
requests, no content-length header needs to be specified. I'm able to send a
chunked request, the server receives it, but is not receiving the correct
'end transmission' marker/character from the .net client (sorry not sure what
the correct terminology is). It could be a compatiblity issue between .NET
and Apache, not sure. Any ideas on that one?
Jul 21 '05 #3
Hi Perry,

Thanks for your followup.
Fortunately, I've just found a certain tech article on making a custom
FileUploader (via HttpWebRequest) on the c-sharpcorner.com ,

#MultipartForm Uploader
http://www.c-sharpcorner.com/Code/20...DotNetBugs.asp

And the author has provided a encapsulated class to do the work(upload file
and other post datas). Also, that article was originally started from the
author's certain project (which need to upload data to a Apache server
rather than IIS). I've also tested the code and that worked well.
You may also have a look. Hope helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Jul 21 '05 #4
Thanks Steve. We'll take a look at the code and see if that'll do the trick.

Perry

"Steven Cheng[MSFT]" wrote:
Hi Perry,

Thanks for your followup.
Fortunately, I've just found a certain tech article on making a custom
FileUploader (via HttpWebRequest) on the c-sharpcorner.com ,

#MultipartForm Uploader
http://www.c-sharpcorner.com/Code/20...DotNetBugs.asp

And the author has provided a encapsulated class to do the work(upload file
and other post datas). Also, that article was originally started from the
author's certain project (which need to upload data to a Apache server
rather than IIS). I've also tested the code and that worked well.
You may also have a look. Hope helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 21 '05 #5
Ok. Looking forward to your good news. Good Luck.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Norman Barker | last post by:
Hi, I have spent most of the day on this so any help would be appreciated. I have set up mod_deflate in Apache so that any input marked content-type gzip from the client is automatically...
1
by: PerryG | last post by:
We have a .NET 1.1 client which is sending a gzipped soap request using HttpWebRequest to an Apache server. The Apache server is using a the 'mod_deflate' server to decompress the incoming...
18
by: jabailo | last post by:
I wrote a program that loops through a file of records. It parses each line in the file and sends them to a web service that inserts them into an AS400DB2 database using Asynch calls. This is...
6
by: ad | last post by:
I have a compressed file in client. How could we send this compressed file (.zip) to server by web service?
5
by: PerryG | last post by:
We have a .NET 1.1 client which is sending a gzipped soap request using HttpWebRequest to an Apache server. The Apache server is using a the 'mod_deflate' server to decompress the incoming...
0
by: Google Groups | last post by:
Hi, I have the following configuraiton: Server side: Apache 2.x with deflate module configured for cotet-stream. Client Side: IE 6.0.2 SP2 dot net framework v1.1.4322
5
by: vthakur | last post by:
Hello: I have a Axis Web Service that sets the sessionid in the SOAP header for persisting the session. The client is a .Net client that processes the header as an Unknown Header. It sets the...
7
by: D. Patrick | last post by:
I need to duplicate the functionality of a java applet, and how it connects to a remote server. But, I don't have the protocol information or the java source code which was written years ago. ...
2
by: ksheerasagar17 | last post by:
Hello All, Scenario: Sending an image through webservice as byte array to an Java webservice. The Problem1: The webservice method image property expects (data type) SByte rather than Byte...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.