Thursday, January 20, 2011

Restful webservice with SSL

On Glassfish server create a Restful Hello Webservice- this service is avaliable from the samples - Install Glassfish 6.9 then from plugins install Restful. In it you will get restful webservice.

Test the Webservice http://localhost:4848 and in go to Network listeners enable 8443 port and put the certificate alias and keystore which was generated in the previous step using keytool...if dont know google for generating the certificate.


Go to netbeans again open web.xml go to security and click on add constraint.

Put in the url which you go from testwebservice webpage it would be something linke this http://localhost:8080/HelloWorld/resources/helloworld


Now put in this url in security contraint and change it to https://localhost:8443.....
Now right click on the project go to properties and run and remove resources/helloworld

Now go to source and open the helloworld.java you will find Path("/helloworld")
remove helloworld

Now your webservice is https://localhost:8443 and we have removed all the traling spaces..








No comments:

Post a Comment