Eric Prud'hommeaux <[email protected]>,
Philippe Le
Hégaret <[email protected]>
XML 2006
December 6, 2006
… general purpose model and corresponding syntax to describe the policies of entities in a Web services-based system
Used in:
CheckClearingService
, you'd
better…X
used CheckClearingService
…Example:
<Policy> <wsap:AddressingRequired /> <mtom:OptimizedMimeSerialization /> </Policy>
… represents an individual requirement, capability, or other property of a behavior.
<wsap:AddressingRequired />
<Policy> <sp:TransportBinding> <Policy> <sp:TransportToken> <Policy> <sp:HttpsToken> <Policy> <sp:HttpDigestAuthentication /> </Policy> </sp:HttpsToken> </Policy> </sp:TransportToken> <sp:AlgorithmSuite> <Policy> <sp:Basic256Rsa15/> </Policy> </sp:AlgorithmSuite> </Policy> </sp:TransportBinding> </Policy>
… represents an individual requirement, capability, or other property of a behavior.
<sp:HttpDigestAuthentication />
… could be context dependent.
Example:
<wsp:Policy> <wsap:AddressingRequired /> <mtom:OptimizedMimeSerialization wsp:Optional="true"/> <wsp:ExactlyOne> <sp:TransportBinding>…</sp:TransportBinding> <sp:AsymmetricBinding>…</sp:AsymmetricBinding> </wsp:ExactlyOne> </wsp:Policy>
<Policy> <ExactlyOne> <All> <wsap:AddressingRequired /> <mtom:OptimizedMimeSerialization /> <sp:TransportBinding>…</sp:TransportBinding> </All> <All> <wsap:AddressingRequired /> <mtom:OptimizedMimeSerialization /> <sp:AsymmetricBinding>…</sp:AsymmetricBinding> </All> <All> <wsap:AddressingRequired /> <sp:TransportBinding>…</sp:TransportBinding> </All> <All> <wsap:AddressingRequired /> <sp:AsymmetricBinding>…</sp:AsymmetricBinding> </All> </ExactlyOne> </Policy>
<Policy> <sp:TransportBinding> <Policy> <sp:TransportToken> <Policy> <sp:HttpsToken> <Policy> <ExactlyOne> <sp:HttpDigestAuthentication /> <sp:HttpBasicAuthentication /> <ExactlyOne> </Policy> </sp:HttpsToken> </Policy> </sp:TransportToken> </Policy> </sp:TransportBinding> </Policy>
<Policy> <ExactlyOne> <All> <sp:TransportBinding> <Policy> <sp:TransportToken> <Policy> <sp:HttpsToken> <Policy> <sp:HttpDigestAuthentication /> </Policy> </sp:HttpsToken> </Policy> </sp:TransportToken> </Policy> </sp:TransportBinding> </All> <All> <sp:TransportBinding> <Policy> <sp:TransportToken> <Policy> <sp:HttpsToken> <Policy> <sp:HttpBasicAuthentication /> </Policy> </sp:HttpsToken> </Policy> </sp:TransportToken> </Policy> </sp:TransportBinding> </All> </ExactlyOne> </Policy>
<wsp:Policy> <wsap:AddressingRequired /> <mtom:OptimizedMimeSerialization wsp:Optional="true"/> <wsp:ExactlyOne> <sp:TransportBinding>…</sp:TransportBinding> <sp:AsymmetricBinding>…</sp:AsymmetricBinding> </wsp:ExactlyOne> </wsp:Policy>
<wsp:Policy> <A /> <B wsp:Optional="true"/> <wsp:ExactlyOne> <C/> <D/> </wsp:ExactlyOne> </wsp:Policy>
A B? ( C | D )
mtom:OptimizedMimeSerialization wsap:AddressingRequired? ( sp:TransportBinding | sp:AsymmetricBinding )
( A B C ) | ( A B D ) | ( B C ) | ( B D )
( AddressingRequired AsymmetricBinding ) | ( AddressingRequired TransportBinding ) | ( AddressingRequired AsymmetricBinding OptimizedMimeSerialization ) | ( AddressingRequired TransportBinding OptimizedMimeSerialization )
String match of
( AddressingRequired TransportBinding )
looks for policy intersections.
<sp:SignedParts> <sp:Body /> </sp:SignedParts>
SignedParts
and Body
become one opaque identifier.
Secret knowledge allows me to know that really means:
<sp:SignedParts> <Policy> <sp:Body/> </Policy> </sp:SignedParts>
or
<SignedParts-Body/>
From the surface syntax,
<wsap:AddressingRequired/>
≠
<wsap:AddressingRequired> <Policy> <wsap:AnonymousResponses/> </Policy> </wsap:AddressingRequired>
A<B>
wsap:AddressingRequired<wsap:AnonymousResponses>
… do X
and Y
.
<wsp:Policy> <X/> <Y/> </wsp:Policy>
… do X
or Y
, but not both.
<wsp:Policy> <wsp:ExactlyOne> <X/> <Y/> </wsp:ExactlyOne> </wsp:Policy>
… do X
and maybe Y
.
<wsp:Policy> <X/> <Y wsp:Optional="true"/> </wsp:Policy>
<wsp:Policy> <wsp:ExactlyOne> <wsp:All> <X/> </wsp:All> <wsp:All> <X/> <Y/> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>
… do X
if and only if you do Y
.
<wsp:Policy wsp:Optional="true">
<X/>
<Y/>
</wsp:Policy>
<wsp:Policy> <wsp:ExactlyOne> <wsp:All></wsp:All> <wsp:All> <X/> <Y/> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>
… do X
and Y
(together).
<wsp:Policy>
<All wsp:Optional="true">
<X/>
<Y/>
</All>
</wsp:Policy>
(Of course, you need to use the expanded form.)
Some requirements that match the capability X iff Y
:
<wsp:Policy> <X/> <Y/> </wsp:Policy>
<wsp:Policy> </wsp:Policy>
<wsp:Policy> <X/> <Y wsp:Optional="true"/> </wsp:Policy>
Off-the-shelf query tools:
for $pol in fn:doc("libs.xml")/Policy/All/ where $pol/wsap:AddressingRequired and $pol/mtom:OptimizedMimeSerialization and count($pol/*[not(wsap:AddressingRequired) and not(mtom:OptimizedMimeSerialization)]) = 0 return $pol
returns a node if libs.xml
expresses that capability.
ASK { ?pol rdfp:requires ( [ rdfp:policyName mtom:OptimizedMimeSerialization ] [ rdfp:policyName wsap:AddressingRequired ] ) }
The RDF (Turtle) representation looks very much like this query.
_:somePolicy rdfp:requires ( [ rdfp:policyName mtom:OptimizedMimeSerialization ] [ rdfp:policyName wsap:AddressingRequired ] ) }
<Policy> <wsap:AddressingRequired /> </Policy>
<xs:element name="soap12:Headers"> <xs:complexType> <xs:all> <xs:element ref='wsa:To'/> <xs:element ref='wsa:Action'/> <xs:element ref='wsa:MessageId' minOccurs='0'/> <xs:element ref='wsa:From' minOccurs='0'/> <xs:element ref='wsa:ReplyTo' minOccurs='0'/> <xs:element ref='wsa:FaultTo' minOccurs='0'/> </xs:all> </xs:complexType> </xs:element>
<xs:element name="soap12:Headers"> <xs:complexType> <xs:all> <xs:element ref='wsa:To'/> <xs:element ref='wsa:Action'/> <xs:element ref='wsa:MessageId' minOccurs='1'/> <xs:element ref='wsa:From' minOccurs='1'/> <xs:element ref='wsa:ReplyTo' minOccurs='0'/> </xs:all> </xs:complexType> </xs:element>
<wsp:Policy>
<wsap:AddressingRequired>
<Policy>
<myns:MessageIdRequired/>
<myns:FromRequired/>
<myns:FaultToProhibited/>
</Policy>
</wsap:AddressingRequired>
</wsp:Policy>
<Policy> <wsap:AddressingRequired /> <mtom:OptimizedMimeSerialization /> </Policy>
MIME-Version: 1.0 Content-Type: Multipart/Related;boundary=MIME_boundary; type="application/xop+xml"; start="<[email protected]>"; startinfo="application/soap+xml" --MIME_boundary Content-Type: application/xop+xml; type="application/soap+xml" Content-Transfer-Encoding: 8bit Content-ID: <[email protected]> <soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope' xmlns:xmlmime='http://www.w3.org/2004/11/xmlmime'> <soap:Body> <soap:Headers> <wsa:To>http://www.example.org/</wsa:To> <wsa:Action>http://www.example.org/ProcessData</wsa:Action> </soap:Headers> <m:data xmlns:m='http://example.org/stuff'> <m:photo xmlmime:contentType='image/png'><xop:Include xmlns:xop='http://www.w3.org/2004/08/xop/include' href='cid:http://example.org/me.png'/></m:photo> </m:data> </soap:Body> </soap:Envelope> --MIME_boundary Content-Type: image/png Content-Transfer-Encoding: binary Content-ID: <http://example.org/me.png> // binary octets for png --MIME_boundary--
<message optimizedMimeSerialization='true'> <httpHeaders> <method>POST</method> <contentType>application/soap+xml</contentType> </httpHeaders> <soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope' xmlns:xmlmime='http://www.w3.org/2004/11/xmlmime'> <soap:Body> <soap:Headers> <wsa:To>http://www.example.org/</wsa:To> <wsa:Action>http://www.example.org/ProcessData</wsa:Action> </soap:Headers> <m:data xmlns:m='http://example.org/stuff'> <m:photo xmlmime:contentType='image/png'>6834BA74FE…</m:photo> </m:data> </soap:Body> </soap:Envelope> </message>
<xs:element name="message"> <xs:complexType> <xs:all> <xs:element ref="httpHeaders" /> <xs:element ref="soap12:Envelop"> <xs:complexType> <xs:sequence> <xs:element name="soap12:Headers"> <xs:complexType> <xs:all> <xs:element ref='wsa:To'/> <xs:element ref='wsa:Action'/> <xs:element ref='wsa:MessageId' minOccurs='0'/> <xs:element ref='wsa:From' minOccurs='0'/> <xs:element ref='wsa:ReplyTo' minOccurs='0'/> <xs:element ref='wsa:FaultTo' minOccurs='0'/> </xs:all> </xs:complexType> </xs:element> <xs:element ref="soap12:Body" /> </xs:sequence> </xs:complexType> </xs:element> </xs:all> </xs:complexType> <xs:attribute name="optimizedMimeSerialization" xsi:type="xsd:boolean" fixed='true'/> </xs:element>
<Policy> <wsap:AddressingRequired /> <sp:SignedParts wsp:Optional="true"> <sp:Body /> </sp:SignedParts> </Policy>
<xs:complexType> <xs:all> <xs:element ref='wsa:To'/> <xs:element ref='wsa:Action'/> … <xs:element name='wsse:Security' minOccurs='0'/> <xs:element ref='ds:Signature'> … </xs:element> </xs:element> </xs:all> </xs:complexType>
<Policy> <ExactlyOne> <All> <wsap:AddressingRequired /> <sp:SignedParts> <sp:Body /> </sp:SignedParts> </All> <All> <wsap:AddressingRequired /> </All> </ExactlyOne> </Policy>
<xs:complexType> <xs:choice> <xs:all> <xs:element ref='wsa:To'/> <xs:element ref='wsa:Action'/> … <xs:element name='wsse:Security'/> <xs:element ref='ds:Signature'> … </xs:element> </xs:element> </xs:all> <xs:all> <xs:element ref='wsa:To'/> <xs:element ref='wsa:Action'/> … </xs:all> <xs:choice> </xs:complexType>
Pros
Cons
And what about capabilities vs requirements?
Minor proposal: add support for wsp:Optional
on
Policy/All
and ExactlyOne
Stronger proposal: don't allow arbitrary elements in a policy assertion!
Slides at:
http://www.w3.org/2006/Talks/1205-ws-policy-alts/