2-102 Securing WebLogic Web Services for Oracle WebLogic Server
java fork=true classname=examples.webservices.security_mtom.client.MtomClient
failonerror=true jvmarg line=-Dweblogic.wsee.verbose=
classpath refid=client.class.path arg line=
{basedir}certs{client-keystore-name} {client-keystore-pass}
{client-cert-alias} {client-key-pass}
{basedir}certstestServerCertTempCert.der http:{wls.hostname}:{wls.port}SecurityMtomServiceSecurityMtomService?WSDL
java target
-- Target the configure the web service security -- target name=config.server.security description=Target the configure the web
service security copy todir={examples.domain.dir} overwrite=true
fileset dir={certs.dir} includes={server-keystore-name} copy
java classname=weblogic.WLST fork=true failonerror=true arg line=configWss.py {wls.username} {wls.password} {wls.hostname}
{wls.port} {server-keystore-name} {server-keystore-pass} {server-cert-alias}
{server-key-pass} java
target
project
2.22.6 Building and Running the Example
Follow these steps to build and run the example:
1.
Start the Examples server.
2.
Set up your environment, as described in the MW_HOME\WL_ HOME\samples\server\examples\src\examples\examples.html
instructions file.
MW_HOME\WL_HOME \samples\domains\wl_serversetExamplesEnv.cmd
3.
Change to the MW_HOME\WL_ HOME
\samples\server\examples\src\examples\webservices directory and create a new subdirectory called security_mtom.
4.
Cut and paste the contents of the build.xml, configWss.py, MtomClient.java, and SecurityMtomService.java sections to files with
the same names in the MW_HOME\WL_ HOME
\samples\server\examples\src\examples\webservices\securit y_mtom directory.
5.
Copy all of the files clientKeyStore.jks, serverKeyStore.jks, and testServerCertTempCert.der from
Configuring Message-Level Security 2-103
MW_HOME\WL_ HOME
\samples\server\examples\src\examples\webservices\wss1.1\ certs
to a new certs subdirectory MW_HOME\WL_
HOME \samples\server\examples\src\examples\webservices\securit
y_mtom\certs
6.
Change to the MW_HOME\WL_ HOME
\samples\server\examples\src\examples\webservices\securit y_mtom directory.
7.
Execute the following command: prompt ant config.server.security
8.
Restart Weblogic Server.
9.
Build, deploy and run the example: prompt ant build deploy run
2.22.7 Deployed WSDL for SecurityMtomService
The deployed WSDL for the SecurityMtomService Web service is available at the following URL:
http:host:portSecurityMtomServiceSecurityMtomService?WSDL The complete WSDL is shown in
Example 2–29 .
Example 2–29 Deployed WSDL for SecurityMtomService
?xml version=1.0 encoding=UTF-8 ? s1:definitions name=SecurityMtomServiceServiceDefinitions
targetNamespace=http:exampleswebservicessecurity_mtom xmlns= xmlns:s0=http:docs.oasis-open.orgwss200401oasis-200401-wss-wssecurity-utili
ty-1.0.xsd xmlns:s1=http:schemas.xmlsoap.orgwsdl
xmlns:s2=http:exampleswebservicessecurity_mtom xmlns:s3=http:schemas.xmlsoap.orgwsdlsoap12
xmlns:wsp=http:schemas.xmlsoap.orgws200409policy wsp:UsingPolicy s1:Required=true
wsp:Policy s0:Id=Mtom.xml wsoma:OptimizedMimeSerialization
xmlns:wsoma=http:schemas.xmlsoap.orgws200409policyoptimizedmimeserializati on
wsp:Policy wsp:Policy s0:Id=Wssp1.2-Wss1.1-EncryptedKey.xml
sp:SymmetricBinding xmlns:sp=http:docs.oasis-open.orgws-sxws-securitypolicy200512
wsp:Policy sp:ProtectionToken
wsp:Policy sp:X509Token
sp:IncludeToken=http:docs.oasis-open.orgws-sxws-securitypolicy200512Include TokenNever
wsp:Policy sp:RequireThumbprintReference
sp:WssX509V3Token11 wsp:Policy
2-104 Securing WebLogic Web Services for Oracle WebLogic Server
sp:X509Token wsp:Policy
sp:ProtectionToken sp:AlgorithmSuite
wsp:Policy sp:Basic256
wsp:Policy sp:AlgorithmSuite
sp:Layout wsp:Policy
sp:Lax wsp:Policy
sp:Layout sp:IncludeTimestamp
sp:OnlySignEntireHeadersAndBody wsp:Policy
sp:SymmetricBinding sp:Wss11 xmlns:sp=http:docs.oasis-open.orgws-sxws-securitypolicy200512
wsp:Policy sp:MustSupportRefKeyIdentifier
sp:MustSupportRefIssuerSerial sp:MustSupportRefThumbprint
sp:MustSupportRefEncryptedKey sp:RequireSignatureConfirmation
wsp:Policy sp:Wss11
wsp:Policy wsp:Policy s0:Id=Wssp1.2-2007-EncryptBody.xml
sp:EncryptedParts xmlns:sp=http:docs.oasis-open.orgws-sxws-securitypolicy200702
sp:Body sp:EncryptedParts
wsp:Policy wsp:Policy s0:Id=Wssp1.2-2007-SignBody.xml
sp:SignedParts xmlns:sp=http:docs.oasis-open.orgws-sxws-securitypolicy200702
sp:Body sp:SignedParts
wsp:Policy s1:types
xs:schema attributeFormDefault=unqualified elementFormDefault=qualified targetNamespace=java:examples.webservices.security_mtom
xmlns:s0=http:schemas.xmlsoap.orgwsdl xmlns:s1=http:exampleswebservicessecurity_mtom
xmlns:s2=http:schemas.xmlsoap.orgwsdlsoap12 xmlns:wsp=http:schemas.xmlsoap.orgws200409policy
xmlns:xs=http:www.w3.org2001XMLSchema xs:complexType name=ArrayOfJavaLangstring_literal
xs:sequence xs:element maxOccurs=unbounded minOccurs=0 name=JavaLangstring
nillable=true type=xs:string xs:sequence
xs:complexType xs:element name=ArrayOfJavaLangstring_literal
type=java:ArrayOfJavaLangstring_literal xmlns:java=java:examples.webservices.security_mtom
xs:element name=base64Binary_literal type=xs:base64Binary xs:schema
xs:schema attributeFormDefault=unqualified elementFormDefault=qualified targetNamespace=http:exampleswebservicessecurity_mtom
Configuring Message-Level Security 2-105
xmlns:s0=http:schemas.xmlsoap.orgwsdl xmlns:s1=http:exampleswebservicessecurity_mtom
xmlns:s2=http:schemas.xmlsoap.orgwsdlsoap12 xmlns:wsp=http:schemas.xmlsoap.orgws200409policy
xmlns:xs=http:www.w3.org2001XMLSchema xs:import namespace=java:examples.webservices.security_mtom
xs:element name=echoBinaryAsString xs:complexType
xs:sequence xs:element name=bytes type=xs:base64Binary
xs:sequence xs:complexType
xs:element xs:element name=echoBinaryAsStringResponse
xs:complexType xs:sequence
xs:element name=return type=xs:string xs:sequence
xs:complexType xs:element
xs:element name=echoBinaryArrayAsStringArray xs:complexType
xs:sequence xs:element name=array type=xs:base64Binary
xs:sequence xs:complexType
xs:element xs:element name=echoBinaryArrayAsStringArrayResponse
xs:complexType xs:sequence
xs:element name=return type=java:ArrayOfJavaLangstring_literal xmlns:java=java:examples.webservices.security_mtom
xs:sequence xs:complexType
xs:element xs:element name=echoStringAsBinary
xs:complexType xs:sequence
xs:element name=s type=xs:string xs:sequence
xs:complexType xs:element
xs:element name=echoStringAsBinaryResponse xs:complexType
xs:sequence xs:element name=return type=xs:base64Binary
xs:sequence xs:complexType
xs:element xs:schema
s1:types s1:message name=echoBinaryAsString
s1:part element=s2:echoBinaryAsString name=parameters s1:message
s1:message name=echoBinaryAsStringResponse s1:part element=s2:echoBinaryAsStringResponse name=parameters
s1:message s1:message name=echoBinaryArrayAsStringArray
s1:part element=s2:echoBinaryArrayAsStringArray name=parameters s1:message
2-106 Securing WebLogic Web Services for Oracle WebLogic Server
s1:message name=echoBinaryArrayAsStringArrayResponse s1:part element=s2:echoBinaryArrayAsStringArrayResponse name=parameters
s1:message s1:message name=echoStringAsBinary
s1:part element=s2:echoStringAsBinary name=parameters s1:message
s1:message name=echoStringAsBinaryResponse s1:part element=s2:echoStringAsBinaryResponse name=parameters
s1:message s1:portType name=SecurityMtomService
wsp:PolicyURIs=Wssp1.2-2007-SignBody.xml Wssp1.2-2007-EncryptBody.xml Wssp1.2-Wss1.1-EncryptedKey.xml
s1:operation name=echoBinaryAsString parameterOrder=parameters s1:input message=s2:echoBinaryAsString
s1:output message=s2:echoBinaryAsStringResponse s1:operation
s1:operation name=echoBinaryArrayAsStringArray parameterOrder=parameters s1:input message=s2:echoBinaryArrayAsStringArray
s1:output message=s2:echoBinaryArrayAsStringArrayResponse s1:operation
s1:operation name=echoStringAsBinary parameterOrder=parameters s1:input message=s2:echoStringAsBinary
s1:output message=s2:echoStringAsBinaryResponse s1:operation
s1:portType s1:binding name=SecurityMtomServiceServiceSoapBinding
type=s2:SecurityMtomService s3:binding style=document transport=http:schemas.xmlsoap.orgsoaphttp
wsp:Policy wsp:PolicyReference URI=Mtom.xml
wsp:Policy s1:operation name=echoBinaryAsString
s3:operation style=document s1:input
s3:body parts=parameters use=literal s1:input
s1:output s3:body parts=parameters use=literal
s1:output s1:operation
s1:operation name=echoBinaryArrayAsStringArray s3:operation style=document
s1:input s3:body parts=parameters use=literal
s1:input s1:output
s3:body parts=parameters use=literal s1:output
s1:operation s1:operation name=echoStringAsBinary
s3:operation style=document s1:input
s3:body parts=parameters use=literal s1:input
s1:output s3:body parts=parameters use=literal
s1:output s1:operation
s1:binding s1:service name=SecurityMtomServiceService
Configuring Message-Level Security 2-107
s1:port binding=s2:SecurityMtomServiceServiceSoapBinding name=SecurityMtomServiceSoapPort
s3:address location=http:localhost:7001SecurityMtomServiceSecurityMtomService
s1:port s1:service
s1:definitions
2.23 Example of Adding Security to Reliable Messaging Web Service