You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Fahad cv <fa...@gmail.com> on 2011/09/23 13:44:55 UTC

407 Error: Proxy Authentication Required

Dears

I need to access a web service located outside our company.

Therefore I must use our proxy. But it does not seem to work. Each time I
get a

Transport error: 407 Error: Proxy Authentication Required



I tried following in the code


 HttpTransportProperties.ProxyProperties HTTPProxyProperties = new
HttpTransportProperties.ProxyProperties();

      HTTPProxyProperties.setProxyName("our proxy");

      HTTPProxyProperties.setProxyPort(8080);

      HTTPProxyProperties.setUserName("my user id");

      HTTPProxyProperties.setPassWord(("my password"));

    HTTPProxyProperties.setDomain(("our proxy"));



      Options options = client.getOptions();


 options.setProperty(MessageContextConstants.HTTP_PROTOCOL_VERSION,HTTPConstants.HEADER_PROTOCOL_10);

      options.setProperty(HTTPConstants.PROXY,HTTPProxyProperties);


I tried below one as well which was worked for one of the user as per this
mailing group, but no luck for me !

      options.setProperty(HTTPConstants.CHUNKED,false);


Following are the Stack trace



Exception in thread "main" org.apache.axis2.AxisFault: Transport error: 407
Error: Proxy Authentication Required

      at org.apache.axis2.transport.http.HTTPSender.handleResponse(*
HTTPSender.java:296*)

      at org.apache.axis2.transport.http.HTTPSender.sendViaPost(*
HTTPSender.java:190*)

      at org.apache.axis2.transport.http.HTTPSender.send(*HTTPSender.java:75
*)

      at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(
*CommonsHTTPTransportSender.java:371*)

      at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(*
CommonsHTTPTransportSender.java:209*)

      at org.apache.axis2.engine.AxisEngine.send(*AxisEngine.java:448*)

      at org.apache.axis2.description.OutInAxisOperationClient.send(*
OutInAxisOperation.java:401*)

      at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(*
OutInAxisOperation.java:228*)

      at org.apache.axis2.client.OperationClient.execute(*
OperationClient.java:163*)

      at
org.csapi.www.wsdl.parlayx.sms.send.v2_2.service.SendSmsServiceStub.sendSms(
*SendSmsServiceStub.java:1304*)

      at org.csapi.www.wsdl.parlayx.sms.send.v2_2.service.SPSendClient.main(
*SPSendClient.java:132*)



Thanks in advance
*Fahad*

Re: 407 Error: Proxy Authentication Required

Posted by Fahad cv <fa...@gmail.com>.
Thanks Josef, for your detailed response.


It was a bug in axis2, please refer
https://issues.apache.org/jira/browse/AXIS2-3839
Fixing it got worked,

Thanks again
Fahad.

On Mon, Sep 26, 2011 at 2:38 PM, Stadelmann Josef <
josef.stadelmann@axa-winterthur.ch> wrote:

> Fahad,****
>
> ** **
>
> We have similar issues with ANT, with the JDK 6.0 or JDK 1.5.0 from
> ORACLE/HP up on which ANT runs.****
>
> ** **
>
> ** **
>
> *QUESTION: what authentication schemas are your proxy server supporting or
> requesting?*
>
> ** **
>
> ** **
>
> Given your Client can only deal with Basic authentication, but your Proxy
> Server likes ****
>
> to negotiate and your client cannot negotiate but just wants Basic
> authentication but ****
>
> your proxy server wants NTLM, then Authentication will fail.****
>
> ** **
>
> Because the underlying JAVA SW does either nothing for proper negotiation
> or does ****
>
> it wrong, or the documentation is wrong, or both. ****
>
> So it might be good to deliver to the proxy server at least a hint ****
>
> ** **
>
> *http.auth.preference=Basic*
>
> This is of equal or more importance then passing a domain.****
>
> ** **
>
> ** **
>
> ** **
>
>
> http://download.oracle.com/javase/6/docs/technotes/guides/net/http-auth.html
> ****
>
> from ORACLE/SUN gives you an idea.****
>
> ** **
>
> If you read:****
>
> *Http Authentication*
>
> *Overview*
>
> *The HTTP protocol handler implements a number of authentication schemes.
> *
>
> *Sun's implementation of Java SE Version 6 supports the following*: ****
>
>    - HTTP Basic authentication (RFC2617) ****
>    - HTTP Digest authentication (RFC2617) ****
>    - NTLM (defined by Microsoft) ****
>    - Http SPNEGO Negotiate (defined by Microsoft), with the following
>    underlying mechanisms: ****
>
> **[image: *]   **Kerberos ****
>
> **[image: *]   **NTLM ****
>
> ** **
>
> Have you read and clearly understood:****
>
> ORCALE/SUN claims that their implementation supports . . .****
>
> ** **
>
> ** **
>
> BUT Who in fact engages this HTTP protocol?  Would you consider that your
> application, your JAVA code must deal with authentication ****
>
> to pass a Firewall / Proxy Server when you read the above at ORACLE/SUN ?
> NO ****
>
> So the JVM should invoke a protocol handler which deals with such issues
> because ethe –Dhttp.proxySWITCHES we pass are an information for the JVM at
> first, but OK can be used by JAVA code as well.. ****
>
> ** **
>
> So we think the JVM does not engage a protocol handler properly. ****
>
> ** **
>
> We come to this conclusion after just a few weeks of troubleshooting ****
>
> because ANT cannot use the <get operation unless we add the username and
> password and more to the task OR we change ANT to establishes an
> Authenticator.****
>
> ** **
>
> But why should ANT code or build procedures deal with BUG's belonging to
> ORACLE/SUN JAVA?****
>
> ** **
>
> A friend of mine, Philippe Vouters writes****
>
> ** **
>
> Josef,****
>
> ** **
>
> This Oracle statement at this URL link I sent you in this mail and which is
> reproduced below suffers according to me from absolutely no
> misinterpretation.****
>
> <QUOTE>****
>
> Normally, applications do not care which scheme is used to and the
> implementation automatically chooses the strongest (most secure) protocol
> transparently.****
>
> </QUOTE>****
>
> As this does NOT match Oracle's Java behavior in Oracle's documented
> conditions, the bug is in either this Oracle's statement or in Oracle's Java
> code. No more no less. The rest is absolutely NOT my concern.****
>
> ** **
>
> Philippe****
>
> ** **
>
> Le 22/09/2011 19:02, Philippe Vouters a écrit :****
>
> > Josef,****
>
> > ****
>
> > The Oracle document at****
>
> >
> http://download.oracle.com/javase/6/docs/technotes/guides/net/http-auth.html
> ****
>
> ** **
>
> ** **
>
> ** **
>
> Now Fahad, – I know this is basics not axis2, ****
>
> but it might help to understand your problem. ****
>
> ** **
>
> *BTW: you may need to watch this using a Wireshark protocol analyzer to
> see what is going on.*
>
> ** **
>
> And it is worth reading the articles from ym friend Philippe Vouters:****
>
> http://vouters.dyndns.org/tima/All-OS-ANT-ANT_and_URLs_authentication.html
> ****
>
>
> http://vouters.dyndns.org/tima/All-OS-Oracle-Java-Problem_attempting_to_go_through_Basic_authentication_required_company_Web_server_proxy.html
> ****
>
> ** **
>
> hope this helps. Also what helps and gives you more info thereafter :
> debugging axis2 transport sender on such issues.****
>
> Josef****
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> *Von:* Fahad cv [mailto:fahadcv@gmail.com]
> *Gesendet:* Freitag, 23. September 2011 13:45
> *An:* java-user@axis.apache.org
> *Betreff:* 407 Error: Proxy Authentication Required****
>
> ** **
>
> Dears****
>
> ** **
>
> I need to access a web service located outside our company. ****
>
> Therefore I must use our proxy. But it does not seem to work. Each time I
> get a ****
>
> Transport error: 407 Error: Proxy Authentication Required****
>
>  ****
>
> I tried following in the code****
>
> ** **
>
>  HttpTransportProperties.ProxyProperties HTTPProxyProperties = new
> HttpTransportProperties.ProxyProperties();****
>
>      HTTPProxyProperties.setProxyName("our proxy");****
>
>      HTTPProxyProperties.setProxyPort(8080);****
>
>      HTTPProxyProperties.setUserName("my user id");****
>
>      HTTPProxyProperties.setPassWord(("my password"));****
>
>    HTTPProxyProperties.setDomain(("our proxy"));****
>
>  ****
>
>      Options options = client.getOptions();****
>
>
>  options.setProperty(MessageContextConstants.HTTP_PROTOCOL_VERSION,HTTPConstants.HEADER_PROTOCOL_10);
> ****
>
>      options.setProperty(HTTPConstants.PROXY,HTTPProxyProperties);****
>
> ** **
>
> I tried below one as well which was worked for one of the user as per this
> mailing group, but no luck for me !****
>
>      options.setProperty(HTTPConstants.CHUNKED,false);****
>
> ** **
>
> Following are the Stack trace****
>
>  ****
>
> Exception in thread "main" org.apache.axis2.AxisFault: Transport error: 407
> Error: Proxy Authentication Required****
>
>       at org.apache.axis2.transport.http.HTTPSender.handleResponse(*
> HTTPSender.java:296*)****
>
>       at org.apache.axis2.transport.http.HTTPSender.sendViaPost(*
> HTTPSender.java:190*)****
>
>       at org.apache.axis2.transport.http.HTTPSender.send(*
> HTTPSender.java:75*)****
>
>       at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(
> *CommonsHTTPTransportSender.java:371*)****
>
>       at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
> *CommonsHTTPTransportSender.java:209*)****
>
>       at org.apache.axis2.engine.AxisEngine.send(*AxisEngine.java:448*)***
> *
>
>       at org.apache.axis2.description.OutInAxisOperationClient.send(*
> OutInAxisOperation.java:401*)****
>
>       at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
> *OutInAxisOperation.java:228*)****
>
>       at org.apache.axis2.client.OperationClient.execute(*
> OperationClient.java:163*)****
>
>       at
> org.csapi.www.wsdl.parlayx.sms.send.v2_2.service.SendSmsServiceStub.sendSms(
> *SendSmsServiceStub.java:1304*)****
>
>       at
> org.csapi.www.wsdl.parlayx.sms.send.v2_2.service.SPSendClient.main(*
> SPSendClient.java:132*)****
>
>  ****
>
> Thanks in advance****
>
> *Fahad*****
>
> ** **
>

AW: 407 Error: Proxy Authentication Required

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Fahad,

 

We have similar issues with ANT, with the JDK 6.0 or JDK 1.5.0 from  ORACLE/HP up on which ANT runs.

 

 

QUESTION: what authentication schemas are your proxy server supporting or requesting?

 

 

Given your Client can only deal with Basic authentication, but your Proxy Server likes 

to negotiate and your client cannot negotiate but just wants Basic authentication but 

your proxy server wants NTLM, then Authentication will fail.

 

Because the underlying JAVA SW does either nothing for proper negotiation or does 

it wrong, or the documentation is wrong, or both. 

So it might be good to deliver to the proxy server at least a hint 

 

http.auth.preference=Basic

This is of equal or more importance then passing a domain.

 

 

 

http://download.oracle.com/javase/6/docs/technotes/guides/net/http-auth.html

from ORACLE/SUN gives you an idea.

 

If you read:

Http Authentication

						

Overview

The HTTP protocol handler implements a number of authentication schemes. 

Sun's implementation of Java SE Version 6 supports the following: 

*	HTTP Basic authentication (RFC2617) 
*	HTTP Digest authentication (RFC2617) 
*	NTLM (defined by Microsoft) 
*	Http SPNEGO Negotiate (defined by Microsoft), with the following underlying mechanisms: 

*   Kerberos 

*   NTLM 

 

Have you read and clearly understood:

ORCALE/SUN claims that their implementation supports . . .

 

 

BUT Who in fact engages this HTTP protocol?  Would you consider that your application, your JAVA code must deal with authentication 

to pass a Firewall / Proxy Server when you read the above at ORACLE/SUN ? NO 

So the JVM should invoke a protocol handler which deals with such issues because ethe -Dhttp.proxySWITCHES we pass are an information for the JVM at first, but OK can be used by JAVA code as well.. 

 

So we think the JVM does not engage a protocol handler properly. 

 

We come to this conclusion after just a few weeks of troubleshooting 

because ANT cannot use the <get operation unless we add the username and password and more to the task OR we change ANT to establishes an Authenticator.

 

But why should ANT code or build procedures deal with BUG's belonging to ORACLE/SUN JAVA?

 

A friend of mine, Philippe Vouters writes

 

Josef,

 

This Oracle statement at this URL link I sent you in this mail and which is reproduced below suffers according to me from absolutely no misinterpretation.

<QUOTE>

Normally, applications do not care which scheme is used to and the implementation automatically chooses the strongest (most secure) protocol transparently.

</QUOTE>

As this does NOT match Oracle's Java behavior in Oracle's documented conditions, the bug is in either this Oracle's statement or in Oracle's Java code. No more no less. The rest is absolutely NOT my concern.

 

Philippe

 

Le 22/09/2011 19:02, Philippe Vouters a écrit :

> Josef,

> 

> The Oracle document at

> http://download.oracle.com/javase/6/docs/technotes/guides/net/http-auth.html

 

 

 

Now Fahad, - I know this is basics not axis2, 

but it might help to understand your problem. 

 

BTW: you may need to watch this using a Wireshark protocol analyzer to see what is going on.

 

And it is worth reading the articles from ym friend Philippe Vouters:

http://vouters.dyndns.org/tima/All-OS-ANT-ANT_and_URLs_authentication.html <http://vouters.dyndns.org/tima/All-OS-ANT-ANT_and_URLs_authentication.html> 

http://vouters.dyndns.org/tima/All-OS-Oracle-Java-Problem_attempting_to_go_through_Basic_authentication_required_company_Web_server_proxy.html <http://vouters.dyndns.org/tima/All-OS-Oracle-Java-Problem_attempting_to_go_through_Basic_authentication_required_company_Web_server_proxy.html> 

 

hope this helps. Also what helps and gives you more info thereafter : debugging axis2 transport sender on such issues.

Josef

 

 

 

 

 

Von: Fahad cv [mailto:fahadcv@gmail.com] 
Gesendet: Freitag, 23. September 2011 13:45
An: java-user@axis.apache.org
Betreff: 407 Error: Proxy Authentication Required

 

Dears

 

I need to access a web service located outside our company. 

Therefore I must use our proxy. But it does not seem to work. Each time I get a 

Transport error: 407 Error: Proxy Authentication Required

 

I tried following in the code

 

 HttpTransportProperties.ProxyProperties HTTPProxyProperties = new HttpTransportProperties.ProxyProperties();

     HTTPProxyProperties.setProxyName("our proxy");

     HTTPProxyProperties.setProxyPort(8080);

     HTTPProxyProperties.setUserName("my user id");

     HTTPProxyProperties.setPassWord(("my password"));

   HTTPProxyProperties.setDomain(("our proxy"));

 

     Options options = client.getOptions();

     options.setProperty(MessageContextConstants.HTTP_PROTOCOL_VERSION,HTTPConstants.HEADER_PROTOCOL_10);

     options.setProperty(HTTPConstants.PROXY,HTTPProxyProperties);

 

I tried below one as well which was worked for one of the user as per this mailing group, but no luck for me !

     options.setProperty(HTTPConstants.CHUNKED,false);

 

Following are the Stack trace

 

Exception in thread "main" org.apache.axis2.AxisFault: Transport error: 407 Error: Proxy Authentication Required

      at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:296)

      at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:190)

      at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)

      at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)

      at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)

      at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

      at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)

      at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)

      at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)

      at org.csapi.www.wsdl.parlayx.sms.send.v2_2.service.SendSmsServiceStub.sendSms(SendSmsServiceStub.java:1304)

      at org.csapi.www.wsdl.parlayx.sms.send.v2_2.service.SPSendClient.main(SPSendClient.java:132)

 

Thanks in advance

Fahad