<!-- amazonBPEL BPEL Process [Generated by the Eclipse BPEL Designer] -->

<bpel:process name="amazonBPEL"

             targetNamespace="http://namespace/amazons3/"

             suppressJoinFailure="yes"

             xmlns:tns="http://namespace/amazons3/"

             xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"

             xmlns:ns="http://s3.amazonaws.com/doc/2006-03-01/">

        <!-- Import the client WSDL -->

        <bpel:import namespace="http://s3.amazonaws.com/doc/2006-03-01/" location="AmazonS3.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>

        <bpel:import namespace="http://s3.amazonaws.com/doc/2006-03-01/" location="AmazonS3.xsd" importType="http://www.w3.org/2001/XMLSchema"></bpel:import>

        <bpel:import location="amazonBPELArtifacts.wsdl" namespace="http://namespace/amazons3/"

                importType="http://schemas.xmlsoap.org/wsdl/" />

             

        <!-- ================================================================= -->            

        <!-- PARTNERLINKS                                                          -->

        <!-- List of services participating in this BPEL process                   -->

        <!-- ================================================================= -->            

        <bpel:partnerLinks>

            <!-- The 'client' role represents the requester of this service. -->

            <bpel:partnerLink name="client"

                         partnerLinkType="tns:amazonBPEL"

                         myRole="amazonBPELProvider"

                         />

            <bpel:partnerLink name="AmazonLink" partnerLinkType="tns:amazonLinkType" partnerRole="amazonRole"></bpel:partnerLink>

        </bpel:partnerLinks>

 

        <!-- ================================================================= -->            

        <!-- VARIABLES                                                             -->

        <!-- List of messages and XML documents used within this BPEL process  -->

        <!-- ================================================================= -->            

        <bpel:variables>

            <!-- Reference to the message passed as input during initiation -->

            <bpel:variable name="input"

                      messageType="tns:amazonBPELRequestMessage"/>

                     

            <!--

              Reference to the message that will be returned to the requester

              -->

            <bpel:variable name="output"

                      messageType="tns:amazonBPELResponseMessage"/>

            <bpel:variable name="AmazonLinkResponse" messageType="ns:ListAllMyBucketsResponse"></bpel:variable>

            <bpel:variable name="AmazonLinkRequest" messageType="ns:ListAllMyBucketsRequest"></bpel:variable>

        </bpel:variables>

        <!-- ================================================================= -->            

        <!-- ORCHESTRATION LOGIC                                                   -->

        <!-- Set of activities coordinating the flow of messages across the        -->

        <!-- services integrated within this business process                      -->

        <!-- ================================================================= -->            

        <bpel:sequence name="main">

           

            <!-- Receive input from requester.

                 Note: This maps to operation defined in amazonBPEL.wsdl

                 -->

            <bpel:receive name="receiveInput" partnerLink="client"

                     portType="tns:amazonBPEL"

                     operation="process" variable="input"

                     createInstance="yes"/>

           

            <!-- Generate reply to synchronous request -->

            <bpel:assign validate="no" name="Assign1">

                <bpel:copy>

                    <bpel:from><bpel:literal><tns:ListAllMyBuckets xmlns:tns="http://s3.amazonaws.com/doc/2006-03-01/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <tns:AWSAccessKeyId></tns:AWSAccessKeyId>

  <tns:Timestamp></tns:Timestamp>

  <tns:Signature></tns:Signature>

</tns:ListAllMyBuckets>

</bpel:literal></bpel:from>

                    <bpel:to variable="AmazonLinkRequest" part="parameters"></bpel:to>

                </bpel:copy>

                <bpel:copy>

                    <bpel:from part="payload" variable="input">

                        <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:awskey]]></bpel:query>

                    </bpel:from>

                    <bpel:to part="parameters" variable="AmazonLinkRequest">

                        <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:AWSAccessKeyId]]></bpel:query>

                    </bpel:to>

                </bpel:copy>

                <bpel:copy>

                    <bpel:from part="payload" variable="input">

                        <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:timestamp]]></bpel:query>

                    </bpel:from>

                    <bpel:to part="parameters" variable="AmazonLinkRequest">

                        <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:Timestamp]]></bpel:query>

                    </bpel:to>

                </bpel:copy>

                <bpel:copy>

                    <bpel:from part="payload" variable="input">

                        <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:sign]]></bpel:query>

                    </bpel:from>

                    <bpel:to part="parameters" variable="AmazonLinkRequest">

                        <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:Signature]]></bpel:query>

                    </bpel:to>

                </bpel:copy>

            </bpel:assign>

            <bpel:invoke name="Invoke" partnerLink="AmazonLink" operation="ListAllMyBuckets" portType="ns:AmazonS3" inputVariable="AmazonLinkRequest" outputVariable="AmazonLinkResponse"></bpel:invoke>

            <bpel:assign validate="no" name="Assign">

                <bpel:copy>

                    <bpel:from><bpel:literal><tns:amazonBPELResponse xmlns:tns="http://namespace/amazons3/" xmlns:tns1="http://s3.amazonaws.com/doc/2006-03-01/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <tns:result>

        <tns1:Owner>

          <tns1:ID></tns1:ID>

          <tns1:DisplayName></tns1:DisplayName>

        </tns1:Owner>

        <tns1:Buckets>

          <tns1:Bucket>

            <tns1:Name></tns1:Name>

            <tns1:CreationDate></tns1:CreationDate>

          </tns1:Bucket>

        </tns1:Buckets>

  </tns:result>

</tns:amazonBPELResponse>

</bpel:literal></bpel:from>

                    <bpel:to variable="output" part="payload"></bpel:to>

                </bpel:copy>

                <bpel:copy>

                    <bpel:from part="parameters" variable="AmazonLinkResponse">

                        <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:ListAllMyBucketsResponse]]></bpel:query>

                    </bpel:from>

                    <bpel:to part="payload" variable="output">

                        <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>

                    </bpel:to>

                </bpel:copy>

            </bpel:assign>

            <bpel:reply name="replyOutput"

                   partnerLink="client"

                   portType="tns:amazonBPEL"

                   operation="process"

                   variable="output"

                   />

        </bpel:sequence>

</bpel:process>