java - How to call a web security with message security and client certificate authentication? -
i need call web service java client. service authenticates clients through certificates @ message level (ws-security, not ssl).
it should possible since, can generate web services jax-ws mutual certificate security in this dialog.
but don't manage create client. has idea ?
i did not tried myself, http://download.oracle.com/docs/cd/e17802_01/webservices/webservices/docs/2.0/tutorial/doc/ :
configuring message security using xwss
the application server contains of jar files necessary use xws-security securing jax-ws applications, however, in order view sample applications, must download , install standalone java wsdp bundle. can download java wsdp http://java.sun.com/webservices/downloads/webservicespack.html.
to add message security existing jax-ws application using xwss, follow these steps on client side:
create client security configuration. client security configuration file specifies order , type of message security operations used client application. example, simple security configuration perform digital signature operation looks this:
<xwss:sign id="s" includetimestamp="true"> <xwss:x509token encodingtype="http://docs.oasis- open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#base64binary" valuetype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss- x509-token-profile-1.0#x509subjectkeyidentifier" certificatealias="xws-security-client" keyreferencetype="identifier"/> </xwss:sign> </xwss:securityconfiguration> </xwss:service> <xwss:securityenvironmenthandler> simple.client.securityenvironmenthandler </xwss:securityenvironmenthandler>
for more information on writing , understanding security configurations , setting securityenvironmenthandlers, please see java web services developer pack 1.6 tutorial @ http://java.sun.com/webservices/docs/1.6/tutorial/doc/index.html.
in client code, create xwssecurityconfiguration object initialized security configuration generated. here example of code use in client file. example of complete file uses code, @ example client in \jaxws2.0\simple-doclit\src\simple\client\ directory.
fileinputstream f = new fileinputstream("./etc/client_security_config.xml"); xwssecurityconfiguration config = securityconfigurationfactory.newxwssecurityconfiguration(f);
set security configuration information on
requestcontext
usingxwssecurityconfiguration.message_security_configuration
property. example of complete file uses code, @ example client in \jaxws2.0\simple-doclit\src\simple\client\ directory.// put security config info ((bindingprovider)stub).getrequestcontext().put( xwssecurityconfiguration.message_security_configuration, config);
invoke method on stub if writing client without regard adding xws-security. example application \jaxws2.0\simple-doclit\src\simple\client\ directory shown below:
holder<string> hold = new holder("hello !"); stub.ping(ticket, hold);
Comments
Post a Comment