<?xml version="1.0" encoding="UTF-8"?>
<bpws:process exitOnStandardFault="no" name="weather"
    suppressJoinFailure="no"
    targetNamespace="http://orchestra.ow2.org/weather"
    xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
    xmlns:ns="http://orchestra.ow2.org/weatherArtifacts"
    xmlns:tns="http://orchestra.ow2.org/weather"
    xmlns:wsx="http://www.webserviceX.NET" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <bpws:import importType="http://schemas.xmlsoap.org/wsdl/"
        location="weather.wsdl" namespace="http://orchestra.ow2.org/weather"/>
    <bpws:import importType="http://schemas.xmlsoap.org/wsdl/"
        location="webserviceX.wsdl" namespace="http://www.webserviceX.NET"/>
    <!-- <bpws:import importType="http://schemas.xmlsoap.org/wsdl/" namespace="http://orchestra.ow2.org/weatherArtifacts"/>-->
    <bpws:import importType="http://schemas.xmlsoap.org/wsdl/"
        location="weatherArtifacts.wsdl" namespace="http://orchestra.ow2.org/weatherArtifacts"/>
    <bpws:partnerLinks>
        <bpws:partnerLink myRole="weatherProvider" name="client" partnerLinkType="tns:weather"/>
        <bpws:partnerLink name="wsPL" partnerLinkType="ns:wsPLT" partnerRole="service"/>
    </bpws:partnerLinks>
    <bpws:variables>
        <bpws:variable messageType="tns:weatherRequestMessage" name="input"/>
        <bpws:variable messageType="tns:weatherResponseMessage" name="output"/>
        <bpws:variable name="string" type="xsd:string"/>
        <bpws:variable messageType="wsx:GetWeatherSoapIn" name="wsIn"/>
        <bpws:variable messageType="wsx:GetWeatherSoapOut" name="wsOut"/>
    </bpws:variables>
    <bpws:sequence name="main">
        <bpws:receive createInstance="yes" name="receiveInput"
            operation="process" partnerLink="client"
            portType="tns:weather" variable="input"/>
        <bpws:assign name="InitVariables" validate="no">
            <bpws:copy>
                <bpws:from>
                    <bpws:literal>
                        <GetWeather xmlns="http://www.webserviceX.NET">
                            <CityName/>
                            <CountryName/>
                        </GetWeather>
                    </bpws:literal>
                </bpws:from>
                <bpws:to part="parameters" variable="wsIn"/>
            </bpws:copy>
            <bpws:copy>
                <bpws:from>
                    <bpws:literal>
                        <weatherResponse xmlns="http://orchestra.ow2.org/weather">
                            <result/>
                        </weatherResponse>
                    </bpws:literal>
                </bpws:from>
                <bpws:to part="payload" variable="output"/>
            </bpws:copy>
        </bpws:assign>
        <bpws:assign name="ConvertInput" validate="no">
            <bpws:copy>
                <bpws:from part="payload" variable="input">
                    <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:input]]></bpws:query>
                </bpws:from>
                <bpws:to variable="string"/>
            </bpws:copy>
            <bpws:copy>
                <bpws:from><![CDATA[substring-before($string, ",")]]></bpws:from>
                <bpws:to part="parameters" variable="wsIn">
                    <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[wsx:CityName]]></bpws:query>
                </bpws:to>
            </bpws:copy>
            <bpws:copy>
                <bpws:from><![CDATA[substring-after($string, ",")]]></bpws:from>
                <bpws:to part="parameters" variable="wsIn">
                    <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[wsx:CountryName]]></bpws:query>
                </bpws:to>
            </bpws:copy>
        </bpws:assign>
        <bpws:invoke inputVariable="wsIn" name="Invoke"
            operation="GetWeather" outputVariable="wsOut"
            partnerLink="wsPL" portType="wsx:GlobalWeatherSoap"/>
        <bpws:assign name="ConvertOutput" validate="no">
            <bpws:copy>
                <bpws:from part="parameters" variable="wsOut">
                    <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[wsx:GetWeatherResult]]></bpws:query>
                </bpws:from>
                <bpws:to part="payload" variable="output">
                    <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpws:query>
                </bpws:to>
            </bpws:copy>
        </bpws:assign>
        <bpws:reply name="replyOutput" operation="process"
            partnerLink="client" portType="tns:weather" variable="output"/>
    </bpws:sequence>
</bpws:process>
