* inital commit of first example
authorGerhard Weis <gweis@gmx.at>
Wed, 10 Dec 2008 11:52:52 +1000
changeset 0ebd32ab2ff76
child 1 741bf08a5542
* inital commit of first example
.project
.pydevproject
README.txt
buildout.cfg
setup.py
src/rsl/__init__.py
src/rsl/examples/__init__.py
src/rsl/examples/currencyconv.py
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.project	Wed Dec 10 11:52:52 2008 +1000
     1.3 @@ -0,0 +1,17 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<projectDescription>
     1.6 +	<name>rsl.examples</name>
     1.7 +	<comment></comment>
     1.8 +	<projects>
     1.9 +	</projects>
    1.10 +	<buildSpec>
    1.11 +		<buildCommand>
    1.12 +			<name>org.python.pydev.PyDevBuilder</name>
    1.13 +			<arguments>
    1.14 +			</arguments>
    1.15 +		</buildCommand>
    1.16 +	</buildSpec>
    1.17 +	<natures>
    1.18 +		<nature>org.python.pydev.pythonNature</nature>
    1.19 +	</natures>
    1.20 +</projectDescription>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/.pydevproject	Wed Dec 10 11:52:52 2008 +1000
     2.3 @@ -0,0 +1,8 @@
     2.4 +<?xml version="1.0" ?>
     2.5 +<?eclipse-pydev version="1.0"?><pydev_project>
     2.6 +<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
     2.7 +<path>/rsl.examples/src</path>
     2.8 +</pydev_pathproperty>
     2.9 +<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
    2.10 +
    2.11 +<pydev_pathproperty name="org.python.pydev.PROJECT_EXTERNAL_SOURCE_PATH"><path>/Users/gerhard/Documents/Projects/Proclos/workspace_python/rslib/rsl.mime/src</path><path>/Users/gerhard/Documents/Projects/Proclos/workspace_python/rslib/rsl.http/src</path><path>/Users/gerhard/Documents/Projects/Proclos/workspace_python/rslib/rsl.soap11/src</path><path>/Users/gerhard/Documents/Projects/Proclos/workspace_python/rslib/rsl.wsdl1/src</path><path>/Users/gerhard/Documents/Projects/Proclos/workspace_python/rslib/rsl/src</path><path>/Users/gerhard/Downloads/buildout/eggs/setuptools-0.6c9-py2.5.egg</path><path>/Users/gerhard/Downloads/buildout/eggs/lxml-2.0.8-py2.5-macosx-10.3-i386.egg</path><path>/Users/gerhard/Downloads/buildout/eggs/zope.interface-3.4.1-py2.5-macosx-10.3-i386.egg</path><path>/Users/gerhard/Downloads/buildout/eggs/rsl.xsd-0.2.0-py2.5.egg</path><path>/Users/gerhard/Documents/Projects/Proclos/workspace_python/rslib/rsl.wsdl/src</path></pydev_pathproperty></pydev_project>
    2.12 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/README.txt	Wed Dec 10 11:52:52 2008 +1000
     3.3 @@ -0,0 +1,14 @@
     3.4 +
     3.5 +Using the examples:
     3.6 +===================
     3.7 +
     3.8 +To use the examples in this package, you need a working buildout installation.
     3.9 +
    3.10 +Then run:
    3.11 +
    3.12 +$ buildout init
    3.13 +$ ./bin/buildout
    3.14 +
    3.15 +You can pass various options to ./bin/buildout. For instance you might want to pass '-N'.
    3.16 +
    3.17 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/buildout.cfg	Wed Dec 10 11:52:52 2008 +1000
     4.3 @@ -0,0 +1,12 @@
     4.4 +[buildout]
     4.5 +develop = .
     4.6 +parts = examples pydev
     4.7 +
     4.8 +[examples]
     4.9 +recipe = zc.recipe.egg
    4.10 +eggs = rsl.examples
    4.11 +interpreter = python
    4.12 +
    4.13 +[pydev]
    4.14 +recipe = pb.recipes.pydev
    4.15 +eggs = ${examples:eggs}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/setup.py	Wed Dec 10 11:52:52 2008 +1000
     5.3 @@ -0,0 +1,41 @@
     5.4 +#!/usr/bin/env python
     5.5 +
     5.6 +from setuptools import setup
     5.7 +from setuptools import find_packages
     5.8 +
     5.9 +setup(name='rsl.examples',
    5.10 +      version='0.2.1',
    5.11 +      package_dir={'':'src'},
    5.12 +      packages=find_packages('src'),
    5.13 +
    5.14 +      namespace_packages = ['rsl',
    5.15 +                            'rsl.examples'],
    5.16 +
    5.17 +      # dependencies:
    5.18 +      install_requires = ['setuptools',
    5.19 +                          'rsl >= 0.2.1',
    5.20 +                          'rsl.wsdl1 >= 0.2.1',
    5.21 +                          'rsl.soap11 >= 0.2.0',
    5.22 +                          'rsl.http >= 0.2.0',
    5.23 +                          'rsl.mime >= 0.2.1',
    5.24 +                         ],
    5.25 +
    5.26 +      # PyPI metadata
    5.27 +      author = 'Gerhard Weis',
    5.28 +      author_email = 'gerhard.weis@proclos.com',
    5.29 +      description = 'Currencyconverter example',
    5.30 +      license='BSD',
    5.31 +      #keywords='',
    5.32 +      url='http://rslib.sourceforge.net',
    5.33 +
    5.34 +      #long_description='', # restructured text
    5.35 +
    5.36 +      data_files = [],
    5.37 +      
    5.38 +      entry_points = {
    5.39 +            'console_scripts': [
    5.40 +                    'currencyconv = rsl.examples.currencyconv:main',
    5.41 +            ],
    5.42 +      }
    5.43 +)
    5.44 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/rsl/__init__.py	Wed Dec 10 11:52:52 2008 +1000
     6.3 @@ -0,0 +1,30 @@
     6.4 +##############################################################################
     6.5 +# Copyright 2008, Gerhard Weis
     6.6 +# All rights reserved.
     6.7 +#
     6.8 +# Redistribution and use in source and binary forms, with or without
     6.9 +# modification, are permitted provided that the following conditions are met:
    6.10 +#
    6.11 +#  * Redistributions of source code must retain the above copyright notice,
    6.12 +#    this list of conditions and the following disclaimer.
    6.13 +#  * Redistributions in binary form must reproduce the above copyright notice,
    6.14 +#    this list of conditions and the following disclaimer in the documentation
    6.15 +#    and/or other materials provided with the distribution.
    6.16 +#  * Neither the name of the authors nor the names of its contributors
    6.17 +#    may be used to endorse or promote products derived from this software
    6.18 +#    without specific prior written permission.
    6.19 +#
    6.20 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
    6.21 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    6.22 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    6.23 +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    6.24 +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
    6.25 +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    6.26 +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    6.27 +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    6.28 +# CONTRACT, STRICT LIABILITY, OR TORT
    6.29 +##############################################################################
    6.30 +'''
    6.31 +define rsl as namespace package and initialise rsl library
    6.32 +'''
    6.33 +__import__('pkg_resources').declare_namespace(__name__)
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/rsl/examples/__init__.py	Wed Dec 10 11:52:52 2008 +1000
     7.3 @@ -0,0 +1,30 @@
     7.4 +##############################################################################
     7.5 +# Copyright 2008, Gerhard Weis
     7.6 +# All rights reserved.
     7.7 +#
     7.8 +# Redistribution and use in source and binary forms, with or without
     7.9 +# modification, are permitted provided that the following conditions are met:
    7.10 +#
    7.11 +#  * Redistributions of source code must retain the above copyright notice,
    7.12 +#    this list of conditions and the following disclaimer.
    7.13 +#  * Redistributions in binary form must reproduce the above copyright notice,
    7.14 +#    this list of conditions and the following disclaimer in the documentation
    7.15 +#    and/or other materials provided with the distribution.
    7.16 +#  * Neither the name of the authors nor the names of its contributors
    7.17 +#    may be used to endorse or promote products derived from this software
    7.18 +#    without specific prior written permission.
    7.19 +#
    7.20 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
    7.21 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    7.22 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    7.23 +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    7.24 +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
    7.25 +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    7.26 +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    7.27 +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    7.28 +# CONTRACT, STRICT LIABILITY, OR TORT
    7.29 +##############################################################################
    7.30 +'''
    7.31 +define rsl.examples as namespace package and initialise rsl library
    7.32 +'''
    7.33 +__import__('pkg_resources').declare_namespace(__name__)
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/rsl/examples/currencyconv.py	Wed Dec 10 11:52:52 2008 +1000
     8.3 @@ -0,0 +1,31 @@
     8.4 +#!/bin/env python
     8.5 +
     8.6 +from rsl.wsdl.wsdl import loadWSDL
     8.7 +from rsl.misc.http import installopener
     8.8 +from rsl.soap11.namespace import NS_SOAP
     8.9 +from rsl.http.namespace import NS_HTTP
    8.10 +
    8.11 +
    8.12 +def main():
    8.13 +    #wsdl = loadWSDL("http://www.webservicex.net/CurrencyConvertor.asmx?wsdl")
    8.14 +    wsdl = loadWSDL("file:../rsl.soap11/src/rsl/soap11/tests/offline/wsdl/webmethods/currencyconv.wsdl")
    8.15 +    
    8.16 +    #proxysoap = wsdl.getProxy(NS_SOAP)
    8.17 +    #_, ret = proxysoap.ConversionRate("AUD", "EUR")
    8.18 +    #print "1 AUD = %f EUR" % ret
    8.19 +    
    8.20 +    # make sure to use the service with HTTP-GET requests, because the WSDL file for
    8.21 +    # HTTP-POST requests is not standard conform. It uses mime:content to describe input params
    8.22 +    #      but mime:content only allows one message part. To make this work, the wsdl should use
    8.23 +    #      http:urlEncoded with verb POST
    8.24 +    
    8.25 +    #proxyhttp = wsdl.getProxy(portname='CurrencyConvertorHttpGet')
    8.26 +    #_, ret = proxyhttp.ConversionRate("EUR", "AUD")
    8.27 +    #print "1 EUR = %f AUD" % ret
    8.28 +    
    8.29 +    proxyhttp = wsdl.getProxy(NS_HTTP)
    8.30 +    _, ret = proxyhttp.ConversionRate("EUR", "AUD")
    8.31 +    print "1 EUR = %f AUD" % ret
    8.32 +
    8.33 +if __name__ == "__main__":
    8.34 +    main()
    8.35 \ No newline at end of file