File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes SSL WebService using AXIS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "SSL WebService using AXIS" Watch "SSL WebService using AXIS" New topic
Author

SSL WebService using AXIS

Venkata Madhu
Greenhorn

Joined: Mar 09, 2006
Posts: 3
Hi All,

I am trying to invoke a WebSerives using AXIS in Tomcat (SLS Enabled). In the same tomcat i am invoking the WebService from a JSP Page. Which is giving me Error. But if i access the WebService (https://localhost:8443/ctxroot/services/MyWS) from certified browser it is giving me proper message saying

MyWS
Hi there, this is an AXIS service!
Perhaps there will be a form for invoking the service here...

But the same WebSerive invoking from the JSP with below code
Service c = new Service();
Call call = (Call) c.createCall(); call.setTargetEndpointAddress("https://localhost:8443/ctxroot/services/MyWS");
call.setOperation("add");
javax.xml.namespace.QName pointQName = new javax.xml.namespace.QName("http://oracle.com/point","point");
call.addParameter("a",pointQName, ParameterMode.IN);
call.addParameter("b",pointQName, ParameterMode.IN);
call.setReturnClass(test.Point.class);
call.registerTypeMapping(Point.class, pointQName, BeanSerializerFactory.class,BeanDeserializerFactory.class);
Point p = (Point) call.invoke(new Object[]{new Point(1,2),new Point(1,2)});
System.out.println(p.getX()+" : "+p.getY());

It is giving follwing error

org.apache.jasper.JasperException: ; nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:207)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:199)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:994)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1105)
at java.lang.Thread.run(Thread.java:534)


Can i know the reason for this error, Am i missing something while invoking the Client(Call)

Thanks In Adv
Venkata
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you can talk to Tomcat over SSL with a browser, then I'd assume that SSL is properly configured.

I'll move this thread to the webservices forum for you.
Someone there might know if there is something specific you need to do in order to communicate over SSL from an Axis client.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Mohit Goyal
Ranch Hand

Joined: Nov 09, 2003
Posts: 65
Hi Venkata

Sorry i haven't used JSP so i can't help you with this, But i too have developed a webservice using Axis1.3 which I need to deploy over https on Tomcat.

I am getting error while deploying the service.

Can you please tell me the steps which you followed for setting up SSL on Tomcat and generating the keystore and stuff and the steps for deployment.

I am really stuck because of this.

Thanks a lot in advance.
Mohit
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42916
    
  68
@Mohit Goyal:

Making Tomcat SSL-ready is rather well-documented in the Tomcat documentation. With which of the steps are you having problems?

There's also a sample chapter on WS Security (including SSL) in the book "J2EE Security for Servlets, EJB and Web Services". It gives a step-by-step introduction into using SSL with WS.
[ March 14, 2006: Message edited by: Ulf Dittmer ]
Mohit Goyal
Ranch Hand

Joined: Nov 09, 2003
Posts: 65
I have followed the steps but i keep getting the following exception:

>java.net.SocketException: Default SSL context init failed: Invalid keystore format

i am able to c the tomcat page for https on port 443. I created a keystore using the following command:

>keytool -genkey alias tomcat -keypass changeit -keyalg RSA

and i filled the domain name value whn asked for frst and last name.

next i self signed the certificate:

>keytool -selfcert -alias tomcat -keypass changeit

and then i exported the certificate into the cacerts file:

>keytool -export -alias tomcat -file $JAVA_HOME/jre/lib/security/cacerts -keypass changeit

If I m doing something wrong thn please let me know.

and it would be gr8 if ne1, who's has practically generated keystores and certificates and was successful in running the application, can just provide me with th steps they followed.

Thanks
Ludger Pottmeier
Greenhorn

Joined: Mar 24, 2006
Posts: 1
I think you'll need to set the VM Properties
javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword
for the Client VM in which th JSP is executed.

Maybe you can do that in the catalina.bat, or for test in the JSP using System.setProperty(key,value)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SSL WebService using AXIS