from my web application, i have to post some data to a remote third party web service on https. the users of the web application have been provided with individual certificates to connect to web service. The web application will work as an intermediary between the end users and the web service as the application has all th开发者_Go百科e data to be posted. how can this be achieved? An Applet or Java Web Start that can be launched from the web app. Can you guys throw some light. Waiting for your ideas, suggestions.
Thankyou
Does the web service provider run on a different machine than the web application?
If not, you can directly teach the web application to expose the web services you need to handle the user requests. You can use one of the WS-Security protocol to mutually authenticate client and server.
If yes, does the web service provider run on a private network that can be seen by the web application?
If yes, you can consume the web service directly from your web application, after the user has been mutually authenticated in SSL to the web application, and send the consumed data to the user.
If not, mutually authenticate the user on the web application with SSL; from the web application, use a server certificate to mutually autenthicate to the web service provider with one of the WS-Security protocol.
EDIT
To work with self signed certificates, let the applet import that certificate in a keystore, either in the JRE default keystore, or a custom keystore loaded at runtime (more precisely, a keystore used to trust certificates is called TrustStore).
You can create a keystore with the keytool executable offered by Oracle. Once you teach your applet to use that keystore, your applet will trust that self-signed server certificate.
Set the application TrustStore with:
System.setProperty("javax.net.ssl.trustStore","path/to/clientTrustStore.key");
System.setProperty("javax.net.ssl.trustStorePassword","keystore-password-if-any");
Read this link for further information about the javax.net.ssl.trustStore property.
精彩评论