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 Xinjun Chen <xj...@gmail.com> on 2006/04/17 08:20:57 UTC

Axis client with SSL

I am trying to invoke a web service (TraderService) deployed in web
logic server 8.1 using Axis client. It works fine whether I use stub
or dynamic invocation. Then I try to invoke the service using HTTPS. I
have already configured web logic server to enable HTTPS.
I tried the stub client using HTTPS, it works. But it failed when I
use dynamic invocation.
In both the stub client and dynamic invocation client, I have inserted
the following code snippet to by pass the cert validation.

// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
       public java.security.cert.X509Certificate[] getAcceptedIssuers() {
               return null;
       }

       public void checkClientTrusted(
       java.security.cert.X509Certificate[] certs, String authType)
               { }
       public void checkServerTrusted(                                
java.security.cert.X509Certificate[]
certs, String authType) {               }
} };
// Install the all-trusting trust manager
try {
       SSLContext sc = SSLContext.getInstance("SSL");
       sc.init(null, trustAllCerts, new java.security.SecureRandom());
       HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (Exception e) {
       e.printStackTrace();
}


The above code is supposed to by pass the cert validation, yet it only
succeeds in the stub client, and failed in the stubless client. In the
stubless client, I get the following error message,

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: No trusted certificate
found
 faultActor:
 faultNode:
 faultDetail:
       {http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: No trusted certificate
found
       at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA12275)
       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
       at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
       at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
       at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA12275)
       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA12275)
       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA12275)
       at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186)
       at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
       at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
       at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
       at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)


Could anyone tell me what else I need to do to by pass the cert
validation? The client code uses Axis 1.2.1.


Regards,

Xinjun

Re: https ...but how?

Posted by Carmine Gargiulo <ka...@email.it>.
ehm..sorry for my english. I'm italian.

I hope in your answers. Thanx

Carmine Gargiulo has wrote:
> Hi guys,
>
> i fave 3 actors:
> 1) user that from his house go in my web-site
> 2) web-site that pick user's requests (client of a local net)
> 3) server-web with web-services (with Axis 1.3 over Tomcat 5)
>
> I have a local net with 1 computer with the web-site (user from home 
> on his browser go to the ip of this computer)
> External accesses are possibile only to this computer and not directly 
> to web-server with web-services.
>
> The web-services send to client of this local net (the web-site where 
> user is with his browser) a xml-file with datas.
> Client, with jsp page, get datas into xml file and create a new html 
> page into local temp folder. Then client force a page-forward to this 
> new page.
> My problem is that these data are very reserved and important. Then I 
> MUST guarantee the security.
> I know that i can do it with https connection but i don't understand how.
> I have uncommented the https rows of the tomcat configuration 
> file........but other?
>
> please help me, is a work very urgent :(
>
> Thanx in advance
 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Telefonare all'estero risparmiando fino all'80%? Con Email.it Phone Card puoi, clicca e scopri tutti i vantaggi
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2683&d=17-4

https ...but how?

Posted by Carmine Gargiulo <ka...@email.it>.
Hi guys,

i fave 3 actors:
1) user that from his house go in my web-site
2) web-site that pick user's requests (client of a local net)
3) server-web with web-services (with Axis 1.3 over Tomcat 5)

I have a local net with 1 computer with the web-site (user from home on 
his browser go to the ip of this computer)
External accesses are possibile only to this computer and not directly 
to web-server with web-services.

The web-services send to client of this local net (the web-site where 
user is with his browser) a xml-file with datas.
Client, with jsp page, get datas into xml file and create a new html 
page into local temp folder. Then client force a page-forward to this 
new page.
My problem is that these data are very reserved and important. Then I 
MUST guarantee the security.
I know that i can do it with https connection but i don't understand how.
I have uncommented the https rows of the tomcat configuration 
file........but other?

please help me, is a work very urgent :(

Thanx in advance

 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Le speciali Offerte di Benvenuto di Cassine di Pietra:
* scopra il gusto ed i vantaggi delle tradizioni contadine
* 
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3924&d=17-4

Re: Axis client with SSL

Posted by Cyrille Le Clerc <cy...@pobox.com>.
   Hello Xinjun,

   Did you look at the wiki ?
http://wiki.apache.org/ws/FrontPage/Axis/AxisClientConfiguration/Ssl

   Did you try to use the
org.apache.axis.components.net.SunFakeTrustSocketFactory ?

   Cyrille

--
Cyrille Le Clerc
cyrille.leclerc@pobox.com
cyrille.leclerc@fr.ibm.com

On 4/17/06, Xinjun Chen <xj...@gmail.com> wrote:
>
>
> Could anyone help me with that.
> I found that the stub client in fact does not work with HTTPS either. The SSLHandshakeException happens in the stub client too.
>
>
> Regards,
>
> Xinjun
>
>
>
> On 4/17/06, Xinjun Chen <xj...@gmail.com> wrote:
> > I am trying to invoke a web service (TraderService) deployed in web
> > logic server 8.1 using Axis client. It works fine whether I use stub
> > or dynamic invocation. Then I try to invoke the service using HTTPS. I
> > have already configured web logic server to enable HTTPS.
> > I tried the stub client using HTTPS, it works. But it failed when I
> > use dynamic invocation.
> > In both the stub client and dynamic invocation client, I have inserted
> > the following code snippet to by pass the cert validation.
> >
> > // Create a trust manager that does not validate certificate chains
> > TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
> >       public java.security.cert.X509Certificate[] getAcceptedIssuers() {
> >               return null;
> >       }
> >
> >       public void checkClientTrusted(
> >       java.security.cert.X509Certificate[] certs, String authType)
> >               { }
> >       public void checkServerTrusted(
> > java.security.cert.X509Certificate[]
> > certs, String authType) {               }
> > } };
> > // Install the all-trusting trust manager
> > try {
> >       SSLContext sc =  SSLContext.getInstance("SSL");
> >       sc.init(null, trustAllCerts, new java.security.SecureRandom());
> >       HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
> > } catch (Exception e) {
> >        e.printStackTrace();
> > }
> >
> >
> > The above code is supposed to by pass the cert validation, yet it only
> > succeeds in the stub client, and failed in the stubless client. In the
> > stubless client, I get the following error message,
> >
> > AxisFault
> > faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> > faultSubcode:
> > faultString: javax.net.ssl.SSLHandshakeException :
> > sun.security.validator.ValidatorException: No trusted certificate
> > found
> > faultActor:
> > faultNode:
> > faultDetail:
> >       {http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLHandshakeException :
> > sun.security.validator.ValidatorException: No trusted certificate
> > found
> >       at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA12275)
> >       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
> >       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
> >       at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
> >       at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
> >       at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a (DashoA12275)
> >       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
> >       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
> >       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA12275)
> >       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA12275)
> >       at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186)
> >       at org.apache.axis.transport.http.HTTPSender.getSocket (HTTPSender.java:191)
> >       at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
> >       at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
> >       at org.apache.axis.strategies.InvocationStrategy.visit (InvocationStrategy.java:32)
> >
> >
> > Could anyone tell me what else I need to do to by pass the cert
> > validation? The client code uses Axis 1.2.1.
> >
> >
> > Regards,
> >
> > Xinjun

Re: Axis client with SSL

Posted by Xinjun Chen <xj...@gmail.com>.
Could anyone help me with that.
I found that the stub client in fact does not work with HTTPS either.
The SSLHandshakeException happens in the stub client too.


Regards,
Xinjun


On 4/17/06, Xinjun Chen <xj...@gmail.com> wrote:
>
> I am trying to invoke a web service (TraderService) deployed in web
> logic server 8.1 using Axis client. It works fine whether I use stub
> or dynamic invocation. Then I try to invoke the service using HTTPS. I
> have already configured web logic server to enable HTTPS.
> I tried the stub client using HTTPS, it works. But it failed when I
> use dynamic invocation.
> In both the stub client and dynamic invocation client, I have inserted
> the following code snippet to by pass the cert validation.
>
> // Create a trust manager that does not validate certificate chains
> TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager()
> {
>       public java.security.cert.X509Certificate[] getAcceptedIssuers() {
>               return null;
>       }
>
>       public void checkClientTrusted(
>       java.security.cert.X509Certificate[] certs, String authType)
>               { }
>       public void checkServerTrusted(
> java.security.cert.X509Certificate[]
> certs, String authType) {               }
> } };
> // Install the all-trusting trust manager
> try {
>       SSLContext sc = SSLContext.getInstance("SSL");
>       sc.init(null, trustAllCerts, new java.security.SecureRandom());
>       HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory
> ());
> } catch (Exception e) {
>       e.printStackTrace();
> }
>
>
> The above code is supposed to by pass the cert validation, yet it only
> succeeds in the stub client, and failed in the stubless client. In the
> stubless client, I get the following error message,
>
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: javax.net.ssl.SSLHandshakeException:
> sun.security.validator.ValidatorException: No trusted certificate
> found
> faultActor:
> faultNode:
> faultDetail:
>       {
> http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLHandshakeException
> :
> sun.security.validator.ValidatorException: No trusted certificate
> found
>       at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA12275)
>       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
>       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
>       at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
>       at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
>       at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA12275)
>       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
>       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
>       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA12275)
>       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake
> (DashoA12275)
>       at org.apache.axis.components.net.JSSESocketFactory.create(
> JSSESocketFactory.java:186)
>       at org.apache.axis.transport.http.HTTPSender.getSocket(
> HTTPSender.java:191)
>       at org.apache.axis.transport.http.HTTPSender.writeToSocket(
> HTTPSender.java:404)
>       at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java
> :138)
>       at org.apache.axis.strategies.InvocationStrategy.visit(
> InvocationStrategy.java:32)
>
>
> Could anyone tell me what else I need to do to by pass the cert
> validation? The client code uses Axis 1.2.1.
>
>
> Regards,
>
> Xinjun
>