You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Chris Ashurst <ca...@thig.com> on 2005/09/13 17:01:24 UTC

Ensuring Data Integrity with POST

In my continuing saga of making HttpClient talk to an ISS5 server 
through SSL and Basic authentication, I have come across an interesting 
bit of information.

Reading through the archives, I noticed a post for a piece of software 
called Ethereal for packet logging. I installed it and logged the IO and 
received a nasty surprise. I seem to be getting an error along the lines 
of [Unreassembled Packet [Incorrect TCP checksum]], which I'm guessing 
(since Ethereal doesn't seem to want to decode the packet into something 
human-readable) is my SOAP envelope somehow being malformed during the 
transport process.

What I would like to know is if there's a way to see *specfically* how 
HttpClient is sending my RequestEntity, and if it is in fact sending the 
correct content-length and so on.

I know now that the SOAP package I'm trying to send is valid, as I sent 
it to the people running the remote server and it processes fine, so the 
only place I can see now where the problem is lying would be that 
HttpClient is malforming the package.

I'm using the following to send the SOAP/XML file:

~~~
File input = new File("testCreate.xml");

client.getParams().setAuthenticationPreemptive(true); 
client.getParams().setVersion(HttpVersion.HTTP_1_1);
client.getParams().setBooleanParameter("http.protocol.expect-continue", 
true);
post.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
post.setRequestHeader("SOAPAction","http://remote.server.com/ProcessXml");
post.setRequestEntity(new InputStreamRequestEntity(new 
FileInputStream(input), input.length()));

int status = client.executeMethod(post);
~~~

In the debug/wire log, all it tells me is that "EntityEnclosingMethod - 
Request body sent", and I know that if I just tried to output the 
contents of the file, it wouldn't be the same as what was being 
transported to the remote server.

(Alternatively, if someone can tell me if there's a way to decode the 
output from Ethereal, that would work just as well. I know this isn't 
the Ethereal support list, but I figure someone must know ;) )

Many thanks,


~Chris


-- 
~Chris Ashurst
~~Tower Hill Insurance
~cashurst@thig.com

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Ensuring Data Integrity with POST

Posted by Chris Ashurst <ca...@thig.com>.
Aha! Yeah, the I was just getting the headers before. Now I can see that 
it is happily sending the file properly... Now it's just barfing on an 
invalid XML node, which it shouldn't, but oh well.

Thanks for the help!


~Chris

Oleg Kalnichevski wrote:
> On Tue, Sep 13, 2005 at 11:01:24AM -0400, Chris Ashurst wrote:
> 
>>In my continuing saga of making HttpClient talk to an ISS5 server 
>>through SSL and Basic authentication, I have come across an interesting 
>>bit of information.
>>
>>Reading through the archives, I noticed a post for a piece of software 
>>called Ethereal for packet logging. I installed it and logged the IO and 
>>received a nasty surprise. I seem to be getting an error along the lines 
>>of [Unreassembled Packet [Incorrect TCP checksum]], which I'm guessing 
>>(since Ethereal doesn't seem to want to decode the packet into something 
>>human-readable) is my SOAP envelope somehow being malformed during the 
>>transport process.
>>
> 
> 
> Chris,
> 
> I seriously doubt HttpClient can cause IP packet corruption. HTTP sits
> on top of TCP/IP and simply does not have means to manipulate lower
> level structures.
> 
> 
> 
>>What I would like to know is if there's a way to see *specfically* how 
>>HttpClient is sending my RequestEntity, and if it is in fact sending the 
>>correct content-length and so on.
> 
> 
> Enable content + header wire logging. For details see the HttpClient
> logging guide:
> 
> http://jakarta.apache.org/commons/httpclient/logging.html
> 
> Hope this helps
> 
> Oleg
> 
> 
> 
>>I know now that the SOAP package I'm trying to send is valid, as I sent 
>>it to the people running the remote server and it processes fine, so the 
>>only place I can see now where the problem is lying would be that 
>>HttpClient is malforming the package.
>>
>>I'm using the following to send the SOAP/XML file:
>>
>>~~~
>>File input = new File("testCreate.xml");
>>
>>client.getParams().setAuthenticationPreemptive(true); 
>>client.getParams().setVersion(HttpVersion.HTTP_1_1);
>>client.getParams().setBooleanParameter("http.protocol.expect-continue", 
>>true);
>>post.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
>>post.setRequestHeader("SOAPAction","http://remote.server.com/ProcessXml");
>>post.setRequestEntity(new InputStreamRequestEntity(new 
>>FileInputStream(input), input.length()));
>>
>>int status = client.executeMethod(post);
>>~~~
>>
>>In the debug/wire log, all it tells me is that "EntityEnclosingMethod - 
>>Request body sent", and I know that if I just tried to output the 
>>contents of the file, it wouldn't be the same as what was being 
>>transported to the remote server.
>>
>>(Alternatively, if someone can tell me if there's a way to decode the 
>>output from Ethereal, that would work just as well. I know this isn't 
>>the Ethereal support list, but I figure someone must know ;) )
>>
>>Many thanks,
>>
>>
>>~Chris
>>
>>
>>-- 
>>~Chris Ashurst
>>~~Tower Hill Insurance
>>~cashurst@thig.com
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

-- 
~Chris Ashurst
~~Tower Hill Insurance
~cashurst@thig.com

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Ensuring Data Integrity with POST

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, Sep 13, 2005 at 11:01:24AM -0400, Chris Ashurst wrote:
> In my continuing saga of making HttpClient talk to an ISS5 server 
> through SSL and Basic authentication, I have come across an interesting 
> bit of information.
> 
> Reading through the archives, I noticed a post for a piece of software 
> called Ethereal for packet logging. I installed it and logged the IO and 
> received a nasty surprise. I seem to be getting an error along the lines 
> of [Unreassembled Packet [Incorrect TCP checksum]], which I'm guessing 
> (since Ethereal doesn't seem to want to decode the packet into something 
> human-readable) is my SOAP envelope somehow being malformed during the 
> transport process.
> 

Chris,

I seriously doubt HttpClient can cause IP packet corruption. HTTP sits
on top of TCP/IP and simply does not have means to manipulate lower
level structures.


> What I would like to know is if there's a way to see *specfically* how 
> HttpClient is sending my RequestEntity, and if it is in fact sending the 
> correct content-length and so on.

Enable content + header wire logging. For details see the HttpClient
logging guide:

http://jakarta.apache.org/commons/httpclient/logging.html

Hope this helps

Oleg


> 
> I know now that the SOAP package I'm trying to send is valid, as I sent 
> it to the people running the remote server and it processes fine, so the 
> only place I can see now where the problem is lying would be that 
> HttpClient is malforming the package.
> 
> I'm using the following to send the SOAP/XML file:
> 
> ~~~
> File input = new File("testCreate.xml");
> 
> client.getParams().setAuthenticationPreemptive(true); 
> client.getParams().setVersion(HttpVersion.HTTP_1_1);
> client.getParams().setBooleanParameter("http.protocol.expect-continue", 
> true);
> post.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
> post.setRequestHeader("SOAPAction","http://remote.server.com/ProcessXml");
> post.setRequestEntity(new InputStreamRequestEntity(new 
> FileInputStream(input), input.length()));
> 
> int status = client.executeMethod(post);
> ~~~
> 
> In the debug/wire log, all it tells me is that "EntityEnclosingMethod - 
> Request body sent", and I know that if I just tried to output the 
> contents of the file, it wouldn't be the same as what was being 
> transported to the remote server.
> 
> (Alternatively, if someone can tell me if there's a way to decode the 
> output from Ethereal, that would work just as well. I know this isn't 
> the Ethereal support list, but I figure someone must know ;) )
> 
> Many thanks,
> 
> 
> ~Chris
> 
> 
> -- 
> ~Chris Ashurst
> ~~Tower Hill Insurance
> ~cashurst@thig.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org