summaryrefslogtreecommitdiffstats
path: root/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-02-28 19:40:06 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-02-28 19:40:06 +0000
commite982b4ef38fd043c15e89bdd60763b10434a087e (patch)
tree6b9d9c3fc9aff22edb0f137040164c1cbf2359af /sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather
parent64e2486555a0a14f7d9690c2fc62c30bde803a91 (diff)
Moving old inactive code to a branch as it's confusing code assist, searches and indexing in trunk.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@917273 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather')
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/Makefile.am23
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/WeatherForecast.wsdl133
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py65
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/sample.weather.composite36
4 files changed, 257 insertions, 0 deletions
diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/Makefile.am b/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/Makefile.am
new file mode 100644
index 0000000000..d0450ef707
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/Makefile.am
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+deploydir=$(prefix)/PythonWeatherForecast/deploy
+compositedir=$(deploydir)/sample.weather
+
+composite_DATA = *.composite *.wsdl *.py
+EXTRA_DIST = *.composite *.wsdl *.py
+
diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/WeatherForecast.wsdl b/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/WeatherForecast.wsdl
new file mode 100644
index 0000000000..ec39e2287a
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/WeatherForecast.wsdl
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://www.webservicex.net"
+ targetNamespace="http://www.webservicex.net"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.webservicex.net">
+ <xsd:element name="GetWeatherByZipCode">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ZipCode" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="GetWeatherByZipCodeResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="1" maxOccurs="1" name="GetWeatherByZipCodeResult" type="tns:WeatherForecasts" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="WeatherForecasts">
+ <xsd:sequence>
+ <xsd:element minOccurs="1" maxOccurs="1" name="Latitude" type="xsd:float" />
+ <xsd:element minOccurs="1" maxOccurs="1" name="Longitude" type="xsd:float" />
+ <xsd:element minOccurs="1" maxOccurs="1" name="AllocationFactor" type="xsd:float" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="FipsCode" type="xsd:string" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="PlaceName" type="xsd:string" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="StateCode" type="xsd:string" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="Status" type="xsd:string" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="Details" type="tns:ArrayOfWeatherData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ArrayOfWeatherData">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="WeatherData" type="tns:WeatherData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="WeatherData">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="Day" type="xsd:string" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="WeatherImage" type="xsd:string" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="MaxTemperatureF" type="xsd:string" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="MinTemperatureF" type="xsd:string" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="MaxTemperatureC" type="xsd:string" />
+ <xsd:element minOccurs="0" maxOccurs="1" name="MinTemperatureC" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="GetWeatherByPlaceName">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="PlaceName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="GetWeatherByPlaceNameResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="1" maxOccurs="1" name="GetWeatherByPlaceNameResult" type="tns:WeatherForecasts" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="WeatherForecasts" type="tns:WeatherForecasts" />
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="GetWeatherByZipCodeRequest">
+ <wsdl:part name="parameters" element="tns:GetWeatherByZipCode" />
+ </wsdl:message>
+ <wsdl:message name="GetWeatherByZipCodeResponse">
+ <wsdl:part name="parameters" element="tns:GetWeatherByZipCodeResponse" />
+ </wsdl:message>
+ <wsdl:message name="GetWeatherByPlaceNameRequest">
+ <wsdl:part name="parameters" element="tns:GetWeatherByPlaceName" />
+ </wsdl:message>
+ <wsdl:message name="GetWeatherByPlaceNameResponse">
+ <wsdl:part name="parameters" element="tns:GetWeatherByPlaceNameResponse" />
+ </wsdl:message>
+ <wsdl:portType name="WeatherForecastPortType">
+ <wsdl:operation name="GetWeatherByZipCode">
+ <wsdl:input message="tns:GetWeatherByZipCodeRequest" />
+ <wsdl:output message="tns:GetWeatherByZipCodeResponse" />
+ </wsdl:operation>
+ <wsdl:operation name="GetWeatherByPlaceName">
+ <wsdl:input message="tns:GetWeatherByPlaceNameRequest" />
+ <wsdl:output message="tns:GetWeatherByPlaceNameResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="WeatherForecastSoapBinding" type="tns:WeatherForecastPortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ <wsdl:operation name="GetWeatherByZipCode">
+ <soap:operation soapAction="http://www.webservicex.net/GetWeatherByZipCode" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetWeatherByPlaceName">
+ <soap:operation soapAction="http://www.webservicex.net/GetWeatherByPlaceName" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="WeatherForecast">
+ <wsdl:port name="WeatherForecastPort" binding="tns:WeatherForecastSoapBinding">
+ <soap:address location="http://www.webservicex.net/WeatherForecast.asmx" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py b/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py
new file mode 100644
index 0000000000..6e3775de0b
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/WeatherForecastImpl.py
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+#
+#
+# This Python code is a simple sample that calls a service that returns an
+# SDO which has been converted into an ElementTree Element object. The Element
+# object is then converted into formatted text
+
+import xml.etree.ElementTree
+
+def getForecastByPlaceName(placeName):
+
+ print "Python - WeatherForecastImpl.getForecastByPlaceName:", placeName
+
+ xmlResult = weatherWebService.GetWeatherByPlaceName(placeName)
+
+ print "Python - Formatting result from weatherService:", xmlResult
+
+ return formatWeather(xmlResult, placeName)
+
+
+def getForecastByZipCode(zipCode):
+
+ print "Python - WeatherForecastImpl.getForecastByZipCode:", zipCode
+
+ xmlResult = weatherWebService.GetWeatherByZipCode(zipCode)
+
+ print "Python - Formatting result from weatherService:", xmlResult
+
+ return formatWeather(xmlResult, zipCode)
+
+
+def formatWeather(weather, name):
+
+ result = "Could not retrieve Weather Forecast for " + str(name)
+
+ pathAndNS = "./{http://www.webservicex.net}"
+
+ if weather.findtext(pathAndNS+"PlaceName"):
+
+ result = "\n\nWeather Forecast for "+ weather.findtext(pathAndNS+"PlaceName")+ ", "+ weather.findtext(pathAndNS+"StateCode")+"\n"
+ result += "Latitude: "+ weather.findtext(pathAndNS+"Latitude")+ " Longitude: "+ weather.findtext(pathAndNS+"Longitude")+"\n\n"
+
+ for node in weather.findall(".//{http://www.webservicex.net}WeatherData"):
+ if node.findtext(pathAndNS+"Day"): result += node.findtext(pathAndNS+"Day")
+ if node.findtext(pathAndNS+"MaxTemperatureC"): result += ":\tMax "+ node.findtext(pathAndNS+"MaxTemperatureC")
+ if node.findtext(pathAndNS+"MinTemperatureC"): result += "C. Min "+ node.findtext(pathAndNS+"MinTemperatureC")+ "C.\n"
+
+ return result
diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/sample.weather.composite b/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/sample.weather.composite
new file mode 100644
index 0000000000..70e9674d23
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PythonWeatherForecast/sample.weather/sample.weather.composite
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="sample.weather">
+
+ <component name="WeatherComponent">
+ <implementation.python module="WeatherForecastImpl"/>
+ <!--implementation.ruby script="WeatherForecastImpl.rb" class="WeatherForecastImpl"/-->
+ <reference name="weatherWebService">WeatherService</reference>
+ </component>
+
+ <reference name="WeatherService">
+ <interface.wsdl interface="http://www.webservicex.net#wsdl.interface(WeatherForecastPortType)"/>
+ <binding.ws endpoint="http://www.webservicex.net#wsdl.endpoint(WeatherForecast/WeatherForecastPort)"/>
+ <!--binding.ws uri="http://www.webservicex.net/WeatherForecast.asmx"/-->
+ </reference>
+
+</composite>