You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Karr, David" <da...@wamu.net> on 2006/08/16 23:27:46 UTC

[httpclient] SOAP req with SSL, proxy auth, and basic auth doesn't send basic auth or SOAPAction headers

I have a standalone tool using SAAJ/SOAPConnection that I use to send a
web service request to an external provider, through SSL, with
proxy-auth and basic-auth.  This works fine.  When I use Ethereal to
monitor the protocol, I see the initial HTTP packet sending the
Proxy-Authorization, Authorization, User-Agent, and SOAPAction headers
(the last is set manually in my code), along with some other
miscellaneous headers.

I'm now working on an implementation (sending the same message) using
commons-httpclient-3.0rc3, in WebLogic 8.1.4, with JDK 1.4.2.  What I
find through Ethereal is that the first HTTP packet sends the
User-Agent, followed by a 407 (proxy auth required) response, followed
by an HTTP packet sending the proxy-authorization header.  I never see
it send the Authorization header (basic) or the SOAPAction header
(manually set by my code).

I'm using "client.getState().setProxyCredentials()" and
"client.getState().setCredentials()" to set the auth and proxy-auth
data.  I'm using "postMethod.addRequestHeader()" to add the SOAPAction
header.

What could I do to get more information about what is going wrong, or
fix the problem in the first place?

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


RE: [httpclient] SOAP req with SSL, proxy auth, and basic authdoesn't send basic auth or SOAPAction headers

Posted by "Karr, David" <da...@wamu.net>.
Thinking about this a little more, I can see that setting preemptive
auth fixes my problem, but why did I need to do that? 

> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Sent: Wednesday, August 16, 2006 3:05 PM
> To: Jakarta Commons Users List
> Subject: Re: [httpclient] SOAP req with SSL, proxy auth, and 
> basic authdoesn't send basic auth or SOAPAction headers
> 
> On Wed, 2006-08-16 at 14:27 -0700, Karr, David wrote:
> > I have a standalone tool using SAAJ/SOAPConnection that I 
> use to send 
> > a web service request to an external provider, through SSL, with 
> > proxy-auth and basic-auth.  This works fine.  When I use 
> Ethereal to 
> > monitor the protocol, I see the initial HTTP packet sending the 
> > Proxy-Authorization, Authorization, User-Agent, and 
> SOAPAction headers 
> > (the last is set manually in my code), along with some other 
> > miscellaneous headers.
> > 
> > I'm now working on an implementation (sending the same 
> message) using 
> > commons-httpclient-3.0rc3, in WebLogic 8.1.4, with JDK 
> 1.4.2.  What I 
> > find through Ethereal is that the first HTTP packet sends the 
> > User-Agent, followed by a 407 (proxy auth required) 
> response, followed 
> > by an HTTP packet sending the proxy-authorization header.  
> I never see 
> > it send the Authorization header (basic) or the SOAPAction header 
> > (manually set by my code).
> > 
> > I'm using "client.getState().setProxyCredentials()" and 
> > "client.getState().setCredentials()" to set the auth and proxy-auth 
> > data.  I'm using "postMethod.addRequestHeader()" to add the 
> SOAPAction 
> > header.
> > 
> > What could I do to get more information about what is going 
> wrong, or 
> > fix the problem in the first place?
> > 
> 
> David,
> 
> Please take a look at the HttpClient logging guide [1] and 
> authentication guide [2]. 
> 
> Most likely you might want to enable preemptive 
> authentication in order to make sure HttpClient sends user 
> credentials preemptively before being challenged by the 
> target or proxy servers.
> 
> Oleg
> 
> [1] http://jakarta.apache.org/commons/httpclient/logging.html
> [2] http://jakarta.apache.org/commons/httpclient/authentication.html
> 
> 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> commons-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 

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


RE: [httpclient] SOAP req with SSL, proxy auth, and basic authdoesn't send basic auth or SOAPAction headers

Posted by "Karr, David" <da...@wamu.net>.
Never mind, I was able to read the response properly. 

> -----Original Message-----
> From: Karr, David 
> Sent: Wednesday, August 16, 2006 4:31 PM
> To: Jakarta Commons Users List
> Subject: RE: [httpclient] SOAP req with SSL, proxy auth, and 
> basic authdoesn't send basic auth or SOAPAction headers
> 
> Ok, I think that helped, but I'm now not sure what I'm seeing.
> 
> After I tested it with preemptive auth, instead of getting a 
> 500 back, as I was before, I'm now getting a 200.  However, 
> for some reason the response body is empty.  What's even 
> stranger is that I see the following in the debug output 
> (some strings elided with "xxxxx").  That Envelope string is 
> exactly the response I should be getting.  I'm currently 
> using httpMethod.getResponseBodyAsString().  When I used
> getResponseBodyAsStream() to read it into a string, I found 
> that "available()" was 0.
> 
> 2006/08/16 16:24:11:592 PDT [WARN] HttpMethodBase - -Going to 
> buffer response body of large or unknown size. Using 
> getResponseBodyAsStream instead is recommended.
> 2006/08/16 16:24:11:592 PDT [DEBUG] HttpMethodBase - 
> -Buffering response body
> 2006/08/16 16:24:11:592 PDT [DEBUG] content - -<< "1"
> 2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< "c"
> 2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< "6"
> 2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< "[\r]"
> 2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< "[\n]"
> 2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< 
> "<soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv
:Body><Rep
> ortResponse
> xmlns="http://xxxxx"><ReportUrl>https://xxxxx</ReportUrl><Warn
ings/><Err
> ors/></ReportResponse></soapenv:Body></soapenv:Envelope>"
> 
> > -----Original Message-----
> > From: Oleg Kalnichevski [mailto:olegk@apache.org]
> > Sent: Wednesday, August 16, 2006 3:05 PM
> > To: Jakarta Commons Users List
> > Subject: Re: [httpclient] SOAP req with SSL, proxy auth, and basic 
> > authdoesn't send basic auth or SOAPAction headers
> > 
> > On Wed, 2006-08-16 at 14:27 -0700, Karr, David wrote:
> > > I have a standalone tool using SAAJ/SOAPConnection that I
> > use to send
> > > a web service request to an external provider, through SSL, with 
> > > proxy-auth and basic-auth.  This works fine.  When I use
> > Ethereal to
> > > monitor the protocol, I see the initial HTTP packet sending the 
> > > Proxy-Authorization, Authorization, User-Agent, and
> > SOAPAction headers
> > > (the last is set manually in my code), along with some other 
> > > miscellaneous headers.
> > > 
> > > I'm now working on an implementation (sending the same
> > message) using
> > > commons-httpclient-3.0rc3, in WebLogic 8.1.4, with JDK
> > 1.4.2.  What I
> > > find through Ethereal is that the first HTTP packet sends the 
> > > User-Agent, followed by a 407 (proxy auth required)
> > response, followed
> > > by an HTTP packet sending the proxy-authorization header.  
> > I never see
> > > it send the Authorization header (basic) or the SOAPAction header 
> > > (manually set by my code).
> > > 
> > > I'm using "client.getState().setProxyCredentials()" and 
> > > "client.getState().setCredentials()" to set the auth and 
> proxy-auth 
> > > data.  I'm using "postMethod.addRequestHeader()" to add the
> > SOAPAction
> > > header.
> > > 
> > > What could I do to get more information about what is going
> > wrong, or
> > > fix the problem in the first place?
> > > 
> > 
> > David,
> > 
> > Please take a look at the HttpClient logging guide [1] and 
> > authentication guide [2].
> > 
> > Most likely you might want to enable preemptive authentication in 
> > order to make sure HttpClient sends user credentials preemptively 
> > before being challenged by the target or proxy servers.
> > 
> > Oleg
> > 
> > [1] http://jakarta.apache.org/commons/httpclient/logging.html
> > [2] http://jakarta.apache.org/commons/httpclient/authentication.html
> > 
> > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: 
> commons-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> > commons-user-help@jakarta.apache.org
> > > 
> > > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> commons-user-help@jakarta.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 

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


RE: [httpclient] SOAP req with SSL, proxy auth, and basic authdoesn't send basic auth or SOAPAction headers

Posted by "Karr, David" <da...@wamu.net>.
Ok, I think that helped, but I'm now not sure what I'm seeing.

After I tested it with preemptive auth, instead of getting a 500 back,
as I was before, I'm now getting a 200.  However, for some reason the
response body is empty.  What's even stranger is that I see the
following in the debug output (some strings elided with "xxxxx").  That
Envelope string is exactly the response I should be getting.  I'm
currently using httpMethod.getResponseBodyAsString().  When I used
getResponseBodyAsStream() to read it into a string, I found that
"available()" was 0.

2006/08/16 16:24:11:592 PDT [WARN] HttpMethodBase - -Going to buffer
response body of large or unknown size. Using getResponseBodyAsStream
instead is recommended.
2006/08/16 16:24:11:592 PDT [DEBUG] HttpMethodBase - -Buffering response
body
2006/08/16 16:24:11:592 PDT [DEBUG] content - -<< "1"
2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< "c"
2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< "6"
2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< "[\r]"
2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< "[\n]"
2006/08/16 16:24:11:608 PDT [DEBUG] content - -<< "<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><Rep
ortResponse
xmlns="http://xxxxx"><ReportUrl>https://xxxxx</ReportUrl><Warnings/><Err
ors/></ReportResponse></soapenv:Body></soapenv:Envelope>"

> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Sent: Wednesday, August 16, 2006 3:05 PM
> To: Jakarta Commons Users List
> Subject: Re: [httpclient] SOAP req with SSL, proxy auth, and 
> basic authdoesn't send basic auth or SOAPAction headers
> 
> On Wed, 2006-08-16 at 14:27 -0700, Karr, David wrote:
> > I have a standalone tool using SAAJ/SOAPConnection that I 
> use to send 
> > a web service request to an external provider, through SSL, with 
> > proxy-auth and basic-auth.  This works fine.  When I use 
> Ethereal to 
> > monitor the protocol, I see the initial HTTP packet sending the 
> > Proxy-Authorization, Authorization, User-Agent, and 
> SOAPAction headers 
> > (the last is set manually in my code), along with some other 
> > miscellaneous headers.
> > 
> > I'm now working on an implementation (sending the same 
> message) using 
> > commons-httpclient-3.0rc3, in WebLogic 8.1.4, with JDK 
> 1.4.2.  What I 
> > find through Ethereal is that the first HTTP packet sends the 
> > User-Agent, followed by a 407 (proxy auth required) 
> response, followed 
> > by an HTTP packet sending the proxy-authorization header.  
> I never see 
> > it send the Authorization header (basic) or the SOAPAction header 
> > (manually set by my code).
> > 
> > I'm using "client.getState().setProxyCredentials()" and 
> > "client.getState().setCredentials()" to set the auth and proxy-auth 
> > data.  I'm using "postMethod.addRequestHeader()" to add the 
> SOAPAction 
> > header.
> > 
> > What could I do to get more information about what is going 
> wrong, or 
> > fix the problem in the first place?
> > 
> 
> David,
> 
> Please take a look at the HttpClient logging guide [1] and 
> authentication guide [2]. 
> 
> Most likely you might want to enable preemptive 
> authentication in order to make sure HttpClient sends user 
> credentials preemptively before being challenged by the 
> target or proxy servers.
> 
> Oleg
> 
> [1] http://jakarta.apache.org/commons/httpclient/logging.html
> [2] http://jakarta.apache.org/commons/httpclient/authentication.html
> 
> 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> commons-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 

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


Re: [httpclient] SOAP req with SSL, proxy auth, and basic auth doesn't send basic auth or SOAPAction headers

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2006-08-16 at 14:27 -0700, Karr, David wrote:
> I have a standalone tool using SAAJ/SOAPConnection that I use to send a
> web service request to an external provider, through SSL, with
> proxy-auth and basic-auth.  This works fine.  When I use Ethereal to
> monitor the protocol, I see the initial HTTP packet sending the
> Proxy-Authorization, Authorization, User-Agent, and SOAPAction headers
> (the last is set manually in my code), along with some other
> miscellaneous headers.
> 
> I'm now working on an implementation (sending the same message) using
> commons-httpclient-3.0rc3, in WebLogic 8.1.4, with JDK 1.4.2.  What I
> find through Ethereal is that the first HTTP packet sends the
> User-Agent, followed by a 407 (proxy auth required) response, followed
> by an HTTP packet sending the proxy-authorization header.  I never see
> it send the Authorization header (basic) or the SOAPAction header
> (manually set by my code).
> 
> I'm using "client.getState().setProxyCredentials()" and
> "client.getState().setCredentials()" to set the auth and proxy-auth
> data.  I'm using "postMethod.addRequestHeader()" to add the SOAPAction
> header.
> 
> What could I do to get more information about what is going wrong, or
> fix the problem in the first place?
> 

David,

Please take a look at the HttpClient logging guide [1] and
authentication guide [2]. 

Most likely you might want to enable preemptive authentication in order
to make sure HttpClient sends user credentials preemptively before being
challenged by the target or proxy servers.

Oleg

[1] http://jakarta.apache.org/commons/httpclient/logging.html
[2] http://jakarta.apache.org/commons/httpclient/authentication.html


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


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