Re: Nick's example of WS-CDL exceptions with WSDL 1.1 & WSDL 2.0

Sorry, small mistake. Please replace "withdraw" with "handlePurchaseOrder" in the text below.


Thanks,

Nick
  ----- Original Message ----- 
  From: Nickolas Kavantzas 
  To: WS-Choreography List 
  Sent: Tuesday, May 24, 2005 7:53 PM
  Subject: Nick's example of WS-CDL exceptions with WSDL 1.1 & WSDL 2.0


  Hi all,

  Below is my example for demonstrating WS-CDL interactions throwing exceptions,
  based on the current WS-CDL spec semantics.

  The example was taken from section 2.5.2.3 of the latest WS-CDL WD.
  I then wrote the WSDL 1.1 and 2.0 definitions associated with the WS-CDL script.



  Regards,

  --
  Nick





  ---------------------------------------------------------------------
  ---------------------------------------------------------------------
  WSDL 1.1:

  <?xml version="1.0" encoding="utf-8" ?> 
  <definitions
      xmlns="http://schemas.xmlsoap.org/wsdl/"
      targetNamespace="http://www.oracle.com/nick/intfsample"
      xmlns:tns=http://www.oracle.com/nick/intfsample"  >

      <types>
         <xsd:schema targetNamespace="...">
             <xsd:element name="InvalidRequest" type="xsd:string"/>
         </xsd:schema>
      </types>

      <message name="OutOfStockException" >
          <part name="faultDetail" element="tns:InvalidRequest" />
      </message>

      <portType ... >

          <operation name="withdraw" ...>
             <input name="inp"   message="..."/>
             <output name="outp" message="..."/>

             <fault name="flt"  message="tns:OutOfStockException"/>

          </operation>

      </portType >

      ...

  </definitions>


  ---------------------------------------------------------------------

  WSDL 2.0:

  <?xml version="1.0" encoding="utf-8" ?> 
  <description
      xmlns="http://www.w3.org/2005/05/wsdl"
      targetNamespace="http://www.oracle.com/nick/intfsample"
      xmlns:tns=http://www.oracle.com/nick/intfsample"  >

      <types>
         <xsd:schema targetNamespace="...">
             <xsd:element name="InvalidRequest" type="xsd:string"/>
         </xsd:schema>
      </types>
    

    <interface ... >

      <fault name = "OutOfStockException"
              element = "tns:InvalidRequest"/>

      <operation name="withdraw" 
              pattern="http://www.w3.org/2005/05/wsdl/in-out" 
              style="http://www.w3.org/2005/05/wsdl/style/uri"
              safe = "true">
          <input messageLabel="In" 
                element="..." />
          <output messageLabel="Out" 
                element="..." />

          <outfault ref="tns:OutOfStockException"  messageLabel="Out"/>

      </operation>

    </interface>

    ...

  </description>


  ---------------------------------------------------------------------

  WS-CDL example:


  <?xml version="1.0" encoding="UTF-8"?>
  <package xmlns="http://www.w3.org/2004/12/ws-chor/cdl"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"     
       targetNamespace="http://www.oracle.com/nick/sample"
       xmlns:tns=http://www.oracle.com/nick/sample"
       xmlns:cwns=http://www.oracle.com/nick/intfsample"
       name="ConsumerRetailerChoreography"
       version="1.0">

    <informationType name="purchaseOrderType" type="tns:PurchaseOrderMsg"/>
    <informationType name="purchaseOrderAckType" type="tns:PurchaseOrderAckMsg"/>


    <!-- The informationType "badPOAckType" is of type Exception Type and refers   
        to the WSDL 1.1 message name "cwns:OutOfStockException" or
        to the WSDL 2.0 fault   name "cwns:OutOfStockException"
     -->

     <informationType name="badPOAckType"         
                      element="cwns:OutOfStockException" 
                      exceptionType="true"/>

    <token name="purchaseOrderID" informationType="tns:intType"/>
    <token name="retailerRef" informationType="tns:uriType"/>
    <tokenLocator tokenName="tns:purchaseOrderID"
                  informationType="tns:purchaseOrderType" query="/PO/orderId"/>
    <tokenLocator tokenName="tns:purchaseOrderID"
                  informationType="tns:purchaseOrderAckType" query="/PO/orderId"/>
    <roleType name="Consumer">
      <behavior name="consumerForRetailer" interface="tns:ConsumerRetailerPT"/>
      <behavior name="consumerForWarehouse" interface="tns:ConsumerWarehousePT"/>
    </roleType>
    <roleType name="Retailer">
      <behavior name="retailerForConsumer" interface="tns:RetailerConsumerPT"/>
    </roleType>
    <relationshipType name="ConsumerRetailerRelationship">
      <role type="tns:Consumer" behavior="consumerForRetailer"/>
      <role type="tns:Retailer" behavior="retailerForConsumer"/>
    </relationshipType>
    <channelType name="ConsumerChannel">
      <role type="tns:Consumer"/>
      <reference>
        <token name="tns:consumerRef"/>
      </reference>
      <identity>
        <token name="tns:purchaseOrderID"/>
      </identity>
    </channelType>
    <channelType name="RetailerChannel">
      <passing channel="ConsumerChannel" action="request" />
      <role type="tns:Retailer" behavior="retailerForConsumer"/>
      <reference>
        <token name="tns:retailerRef"/>
      </reference>
      <identity>
        <token name="tns:purchaseOrderID"/>
      </identity>
    </channelType>

    <choreography name="ConsumerRetailerChoreography" root="true">
      <relationship type="tns:ConsumerRetailerRelationship"/>
      <variableDefinitions>
        <variable name="purchaseOrder" informationType="tns:purchaseOrderType" 
                  silent="true" />
        <variable name="purchaseOrderAck" 
                  informationType="tns:purchaseOrderAckType" />
        <variable name="retailer-channel" channelType="tns:RetailerChannel"/>
        <variable name="consumer-channel" channelType="tns:ConsumerChannel"/>
        <variable name="badPurchaseOrderAck"   
                  informationType="tns:badPOAckType" roleTypes="tns:Consumer"/>
        <variable name="badPurchaseOrderAck"   
                  informationType="tns:badPOAckType" roleTypes="tns:Retailer"
                  silent="true" />
      </variableDefinitions>

      <interaction name="createPO"
                   channelVariable="tns:retailer-channel" 
                   operation="handlePurchaseOrder" align="true" 
                   initiate="true">
        <participate relationshipType="tns:ConsumerRetailerRelationship" 
                     fromRole="tns:Consumer" toRole="tns:Retailer"/>
        <exchange name="request" 
                  informationType="tns:purchaseOrderType" action="request">
          <send variable="cdl:getVariable("tns:purchaseOrder", ...)" />
          <receive variable="cdl:getVariable("tns:purchaseOrder", ...)"
                   recordReference="record-the-channel-info" />
        </exchange>
        <exchange name="response"
                  informationType="purchaseOrderAckType" action="respond">
          <send variable="cdl:getVariable("tns:purchaseOrderAck", ...)" />
          <receive variable="cdl:getVariable("tns:purchaseOrderAck", ...)" />
        </exchange>

        <exchange name="badPurchaseOrderAckException" 
                  informationType="badPOAckType" action="respond">
          <send variable="cdl:getVariable("tns:badPurchaseOrderAck", ...)"
                  causeException="true" />
          <receive variable="cdl:getVariable("tns:badPurchaseOrderAck", ...)"
                  causeException="true" />                 
        </exchange>

        <record name="record-the-channel-info" when="after">
          <source variable="cdl:getVariable("tns:purchaseOrder, "", 
                                            "PO/CustomerRef")"/>
          <target variable="cdl:getVariable("tns:consumer-channel", ...)"/>
        </record>
      </interaction>

   </choreography>    
  </package>

Received on Wednesday, 25 May 2005 03:02:19 UTC