简体   繁体   中英

How to specify the service instance in an external WS-policy attachment file?

I am trying to create a WS-policy attachment file in order to attach a policy to an activity of a particular process instance. I have read that an endpoint reference(EPR) should be included in the AppliesTo element but the problem is that I don't know how to specify the process instance. The following code attaches a policy to an invoke activity for all instances of the process MyProcess .

<wsp:PolicyAttachment>
  xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"
  xmlns:q4b="http://www.example.com/q4b"
  xmlns:ns="http://www.example.com/processes"
<wsp:AppliesTo>
   <q4b:process name="ns:myProcess" expressionLanguage="xpath1.0">
     /process/inovoke[2]
   </q4b:process>
</wsp:AppliesTo>
<wsp:PolicyReference>
  URI="http://www.example.com/policies/myPolicy"/>
</wsp:PolicyAttachment>

The AppliesTo element defines the policy subject. It includes a new defined XML-type called q4b:process which specifies the name of the process and includes an XPath expression to select the second invoke activity of that process. The PolicyReference element is a reference to the policy to be attached.

In the WS-Policy Attachement specification there is an example that uses an endpoint reference but the explanation says it will apply the policy to all interactions with the endpoint. This is not exactly what I want since I would like the policy to be applied only to a specified instance of the process and only to a specified activity. I am using Apache ODE as the workflow engine.

The following example illustrates the use of this mechanism with an EndpointReference domain expression for a deployed endpoint as defined in Web Services Addressing [WS-Addressing Core]:

(01) <wsp:PolicyAttachment>
(02)   <wsp:AppliesTo>
(03)     <wsa:EndpointReference>
(04)       <wsa:Address>http://www.example.com/acct</wsa:Address>
(05)     </wsa:EndpointReference>
(06)   </wsp:AppliesTo>
(07)   <wsp:PolicyReference
(08)      URI="http://www.example.com/policies#RmPolicy" />
(09) </wsp:PolicyAttachment>

In this example, the policy expression at applies to all interactions with the endpoint.

WS-Policy Attachment specifications

WS-Addressing specifications

Thank you for your time and effort.

You shouldn't use the interface (the WSDL) to define the internal behavior of your processes, acting so you are exposing your implementation. Interfaces are meant to hide / encapsulate implementation from the consumer point of view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM