<process name="simple" 
         targetNamespace="urn:news:NewsService"
         xmlns:tns="urn:news:NewsService"
         xmlns:babelfish="http://www.xmethods.net/sd/BabelFishService.wsdl"
	 xmlns:html2text="http://mycompany.com/services/util/html2text"
	 xmlns:hnews="http://www.SoapClient.com/xml/SQLDataSoap.wsdl"
         xmlns="http://schemas.xmlsoap.org/ws/2002/07/business-process/">

  <containers>
    <container name="userRequest" messageType="tns:userRequest"/>
    <container name="newsRequest" messageType="hnews:ProcessSRL"/>
    <container name="newsResponse" messageType="hnews:ProcessSRLResponse"/>
    <container name="htmlNews" messageType="html2text:html"/>
    <container name="textNews" messageType="html2text:text"/>
    <container name="englishNews" messageType="babelfish:BabelFishRequest"/>
    <container name="translatedNews" messageType="babelfish:BabelFishResponse"/>
    <container name="userResponse" messageType="tns:userResponse"/>
  </containers>

  <partners>
    <partner name="User" serviceLinkType="tns:UserSLT"/>
    <partner name="EnglishNewsService" serviceLinkType="tns:EnglishNewsSLT"/>
    <partner name="HTML2TextService" serviceLinkType="tns:HTML2TextSLT"/>
    <partner name="BabelFishService" serviceLinkType="tns:BabelFishServiceSLT"/>
  </partners>

  <sequence name="sequence">
    <!-- get news request from the user -->
    <receive name="receiveRequest" partner="User" portType="tns:NewsPT" 
             operation="getNews" container="userRequest"
             createInstance="yes"/>
    <!-- create input message required by news service -->
    <assign name="CreateNewsInput">
      <copy>
          <from expression="'/xml/NEWS.SRI'"/>
          <to container="newsRequest" part="SRLFile"/>
      </copy>
      <copy>
          <from expression="'yahoo'"/>
          <to container="newsRequest" part="RequestName"/>
      </copy>
      <copy>
          <from expression="''"/>
          <to container="newsRequest" part="key"/>
      </copy>
    </assign>
    <!-- invoke news service -->
    <invoke name="invokeNewsService" partner="EnglishNewsService" portType="hnews:SQLDataSoapPortType"
            operation="ProcessSRL" inputContainer="newsRequest"
            outputContainer="newsResponse"/>
    <!-- map news response to input data reqd by html2text conversion service -->
    <assign name="mapNewsOutputToConversionInput">
      <copy>
          <from container="newsResponse" part="return"/>
          <to container="htmlNews" part="content"/>
      </copy>
    </assign>
    <!-- invoke convertor to strip off HTML tags from English news -->
    <invoke name="invokeConvertor" partner="HTML2TextService" portType="html2text:Html2TextPortType"
            operation="convertHTML2Text" inputContainer="htmlNews"
            outputContainer="textNews"/>
    <!-- copy user's language preference to input data reqd by translation service -->
    <assign name="copyUserPreferenceToTranslationInput">
      <copy>
          <from container="userRequest" part="language"/>
          <to container="englishNews" part="translationmode"/>
      </copy>
    </assign>
    <!-- map convertor output to input data reqd by translation service -->
    <assign name="mapConvertedNewsToTranslationInput">
      <copy>
          <from container="textNews" part="content"/>
          <to container="englishNews" part="sourcedata"/>
      </copy>
    </assign>
    <!-- invoke translation service to translate into language of choice -->
    <invoke name="invokeTranslator" partner="BabelFishService" portType="babelfish:BabelFishPortType"
            operation="BabelFish" inputContainer="englishNews"
            outputContainer="translatedNews"/>
    <!-- map the translated news output to the output the user expects -->
    <assign name="mapTranslatedNewsToUserOutput">
      <copy>
          <from container="translatedNews" part="return"/>
          <to container="userResponse" part="news"/>
      </copy>
    </assign>
    <!-- respond to the user -->
    <reply name="sendNews" partner="User" portType="tns:NewsPT"
           operation="getNews" container="userResponse"/>
  </sequence>

</process>
