background image

Setting up SecurityEnvironmentHandlers

<< Configuring Message Security Using XWSS | SAAJ application using XWSS >>
<< Configuring Message Security Using XWSS | SAAJ application using XWSS >>
U
SING THE
J
AVA
WSDP XWSS S
ECURITY
I
MPLEMENTATION
249
<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>
</xwss:JAXRPCSecurity>
For more information on writing and understanding security configura-
tions and setting up
SecurityEnvironmentHandlers
, please see the Java
Web Services Developer Pack Tutorial at
http://java.sun.com/web-
services/docs/1.6/tutorial/doc/index.html
.
2. In your client code, create an
XWSSecurityConfiguration
object initial-
ized with the security configuration generated. Here is an example of the
code that you would use in your client file. For an example of a complete
file that uses this code, look at the example client in the \
jaxws2.0\sim-
ple-doclit\src\simple\client\
directory.
FileInputStream f = new FileInputStream("./etc/
client_security_config.xml");
XWSSecurityConfiguration config =
SecurityConfigurationFactory.newXWSSecurityConfiguration(f);
3. Set security configuration information on the
RequestContext
by using
the
XWSSecurityConfiguration.MESSAGE_SECURITY_CONFIGURATION
property. For an example of a complete file that uses this code, look at the