Giter Site home page Giter Site logo

soappy's Introduction

SOAPpy - Simple to use SOAP library for Python

Disclaimer

Please use suds rather than SOAPpy. SOAPpy is old and clamsy.

Credits

Companies

makinacom

Authors

Contributors

Copyright (c) 20011 Makina Corpus Copyright (c) 2002-2005, Pfizer, Inc. Copyright (c) 2001, Cayce Ullman. Copyright (c) 2001, Brian Matthews. All rights reserved, see the file LICENSE for conditions of use.

INTRODUCTION

The goal of the SOAPpy team is to provide a full-featured SOAP library for Python that is very simple to use and that fully supports dynamic interaction between clients and servers.

INCLUDED

  • General SOAP Parser based on sax.xml
  • General SOAP Builder
  • SOAP Proxy for RPC client code
  • SOAP Server framework for RPC server code

FEATURES

  • Handles all SOAP 1.0 types
  • Handles faults
  • Allows namespace specification
  • Allows SOAPAction specification
  • Homogeneous typed arrays
  • Supports multiple schemas
  • Header support (mustUnderstand and actor)
  • XML attribute support
  • Multi-referencing support (Parser/Builder)
  • Understands SOAP-ENC:root attribute
  • Good interop, passes all client tests for Frontier, SOAP::LITE, SOAPRMI
  • Encodings
  • SSL clients (with Python compiled with OpenSSL support)
  • SSL servers (with Python compiled with OpenSSL support and M2Crypto installed)
  • Encodes XML tags per SOAP 1.2 name mangling specification (Gregory Warnes)
  • Automatic stateful SOAP server support (Apache v2.x) (blunck2)
  • WSDL client support
  • WSDL server support

TODO (See RELEASE_INFO and CHANGELOG for recent changes)

  • Timeout on method calls
  • Advanced arrays (sparse, multidimensional and partial)
  • Attachments
  • mod_python example
  • medusa example
  • Improved documentation

MANIFEST

Files

    README              This file
    RELEASE_NOTES       General information about each release
    ChangeLog           Detailed list of changes
    TODO                List of tasks that need to be done
    setup.py            Python installation control files
    SOAPpy.spec         RPM package control file

Directories

    SOAPpy/            Source code for the package
    SOAPpy/wstools/    Source code for WSDL tools
    tests/             unit tests and examples
    validate/          interop client and servers
    bid/               N+I interop client and server
    contrib/           Contributed examples (also see test/)
    docs/              Documentation
    tools/             Misc tools useful for the SOAPpy developers
    zope/              Patches to Zope allowing it to provide SOAP services

INSTALLATION

USING GITHUB

You can install SOAPpy and its dependencies directly from GitHub using PIP:

pip install -e "git+http://github.com/kiroky/SOAPpy.git@develop#egg=SOAPpy"

REQUIRED PACKAGES

  • wstools

OPTIONAL PACKAGES

INSTALLATION STEPS

As of version 0.9.8 SOAPpy can be installed using the standard python package installation tools.

To install:

  1. Unpack the distribution package:

    On Windows, use your favorite zip file uncompression tool.

    On Unix:

    $ tar -xvzf SOAPpy-$VERSION$.tar.gz
    
    If you have gnu tar, otherwise
    $ gzcat SOAPpy-$VERSION$.tar.gz | tar -xvf -
    
  2. Change into the source directory

    cd SOAPpy-$VERSION$
    
  3. Compile the package:

    $ python setup.py build
    
  4. Install the package

    On Windows:

    $ python setup.py install
    

    On Unix install as the owner of the python directories (usally root):

    $ su root
    Password: XXXXXX
    $ python setup.py install
    

DOCUMENTATION

QUICK START

A simple "Hello World" http SOAP server:

import SOAPpy
def hello():
    return "Hello World"
server = SOAPpy.SOAPServer(("localhost", 8080))
server.registerFunction(hello)
server.serve_forever()

And the corresponding client:

import SOAPpy
server = SOAPpy.SOAPProxy("http://localhost:8080/")
print server.hello()

BASIC TUTORIAL

Mark Pilgrims _Dive Into Python, published in printed form by Apress and online at at http://diveintopython.org provides a nice tutorial for SOAPpy in Chapter 12, "SOAP Web Services". See http://diveintopython.org/soap_web_services .

OTHER DOCUMENTATION

For further information see the files in the docs/ directory.

Note that documentation is one of SOAPpy's current weak points. Please help us out!

Support

Github: https://github.com/kiorky/SOAPpy Issues: https://github.com/kiorky/SOAPpy/issues

soappy's People

Contributors

baldulin avatar claytonc avatar dawryn avatar hefee avatar jeffkit avatar jonozzz avatar kiorky avatar pelletier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soappy's Issues

No versions specified for required packages

In setup.py, the install_requires argument does not specify versions for the required packages.
wstools v0.4.4 has a serious bug. Please specify the version tested with

setup( name="SOAPpy", version='0.12.23.dev0', description="SOAP Services for Python", maintainer="Gregory Warnes, kiorky", maintainer_email="[email protected], [email protected]", url = url, long_description=long_description, packages=find_packages('src'), package_dir = {'': 'src'}, include_package_data=True, install_requires=[ 'wstools', 'defusedxml', ] )

invalid syntax

everytime I want to run anything in test directory, I have this:

Traceback (most recent call last): File "./echoClient.py", line 8, in <module> from SOAPpy import * File "build/bdist.linux-x86_64/egg/SOAPpy/__init__.py", line 5, in <module> File "/mytmp/lib/python/SOAPpy_py3-0.52.24-py2.7.egg/SOAPpy/Client.py", line 343 print(data, end=' ') ^ SyntaxError: invalid syntax

How can I remove SOAPAction header from HTTP request?

I just hack the code to set SOAPAction header to empty string, so the server can accept my request.
Because the soapAction is defined as empty string in the WSDL file.
How can I meet my requirement with configuration or parameters?

Py3 support? - Add platform metadata to setup

Hi,

just pip-installed this from pypi. Only from the import error did I see that there is no Py3 support. I humbly suggest two things:

  1. that supported platforms are added to setup metadata so pip does not install an incompatible package
  2. dependencies (apikg, pytest-timeout, defusexml etc.) be mentioned in the docs and dependencies metadata
  3. Py3 support be added - it is a pain that py3 does not seem to have good SOAP support.

Thanks.
Leo

setup.py fails under some conditions due to encoding issues

Mostly creating this so if someone has the same problem this will show up in Google

Collecting SOAPpy (from servicenow->nms-servicenow-replica==0.0.1a1480522484)
  Downloading SOAPpy-0.12.22.zip (172kB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File \"<string>\", line 1, in <module>
      File \"/tmp/pip-build-fuwjy0sg/SOAPpy/setup.py\", line 17, in <module>
        +'\\n'+read('CHANGES.txt')
      File \"/tmp/pip-build-fuwjy0sg/SOAPpy/setup.py\", line 12, in read
        os.path.join('.', *rnames)
      File \"/usr/lib64/python3.4/encodings/ascii.py\", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 842: ordinal not in range(128)

We have this issue when running pip3 install soappy through Ansible executing in our Jenkins server, we have found out that adding:

export LANG="en_US.UTF-8"
export LANGUAGE="en_US:en"

to Ansible's environment fixes the issue, previously Jenkins had LANG=C.UTF-8 and no LANGUAGE set

SOAPpy is old and clamsy

In the README it sais:

Disclaimer
Please use suds rather than SOAPpy. SOAPpy is old and clamsy.

Is this still relevant?

type error

Hi,

When I try to use your soappy basic example I have this error :

File "/usr/local/lib/python3.5/dist-packages/SOAPpy/Server.py", line 230, in do_POST
parseSOAPRPC(data, header = 1, body = 1, attrs = 1, ignore_ext=self.ignore_ext)
File "/usr/local/lib/python3.5/dist-packages/SOAPpy/Parser.py", line 1102, in parseSOAPRPC
t = _parseSOAP(xml_str, rules = rules, ignore_ext=ignore_ext)
File "/usr/local/lib/python3.5/dist-packages/SOAPpy/Parser.py", line 1053, in _parseSOAP
inpsrc.setByteStream(StringIO(xml_str))
TypeError: initial_value must be str or None, not bytes

But I don't know why... I try to use IO.StringIO or BytesIO, decode, etc... but nothing work....

Can you help me ?

Thanks

ImportError: No module named 'WSDLTools' during pip install of SOAPpy

Cannot install SOAPpy with pip (with Python 3.4.1):

Downloading/unpacking soappy
  Downloading SOAPpy-0.12.22.zip (172kB): 172kB downloaded
  Running setup.py (path:/home/kartoch/Documents/works/python/python-ovh/build/soappy/setup.py) egg_info for package soappy

    warning: no files found matching '*.rst'
    warning: no previously-included files matching '*pyc' found anywhere in distribution
Downloading/unpacking wstools (from soappy)
  Downloading wstools-0.4.3.tar.gz (148kB): 148kB downloaded
  Running setup.py (path:/home/kartoch/Documents/works/python/python-ovh/build/wstools/setup.py) egg_info for package wstools
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/home/kartoch/Documents/works/python/python-ovh/build/wstools/setup.py", line 19, in <module>
        from src.wstools.version import __version__
      File "/home/kartoch/Documents/works/python/python-ovh/build/wstools/src/wstools/__init__.py", line 6, in <module>
        import WSDLTools
    ImportError: No module named 'WSDLTools'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/home/kartoch/Documents/works/python/python-ovh/build/wstools/setup.py", line 19, in <module>

from src.wstools.version import __version__

  File "/home/kartoch/Documents/works/python/python-ovh/build/wstools/src/wstools/__init__.py", line 6, in <module>

    import WSDLTools

ImportError: No module named 'WSDLTools'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/kartoch/Documents/works/python/python-ovh/build/wstools
Storing debug log for failure in /home/kartoch/.pip/pip.log

SOAPpy: XML billion laughs attack unfixed for client

Commit 64125a2 fixes billion laughs issue in SOAPpy. However, the way forbid_* defaults were chosen and how client and server parts call parseSOAPRPC, client side remains vulnerable to the billion laughs attack. Malicious SOAP server can cause SOAPpy client to use excessive amount of memory and CPU time.

FWIW, the _parseSOAP arguments seem confusing, given that ignore_ext overlaps with forbid_*, and that setting it to true disables not only external entities as the argument name suggests, but also internal entities.

Sample server / client does not work, Python 3.6.4

Good day, thank you all for your efforts on SOAPpy-py3.
I'm trying to run the sample server and client and while the server runs with no error,
when I try to run the client, the client produces:

Traceback (most recent call last):
File "client01.py", line 3, in
print('from server: ' + server.hello() )
File "/usr/lib/python3.6/site-packages/SOAPpy/Client.py", line 639, in call
return self.__r_call(*args, **kw)
File "/usr/lib/python3.6/site-packages/SOAPpy/Client.py", line 661, in __r_call
self.__hd, self.__ma)
File "/usr/lib/python3.6/site-packages/SOAPpy/Client.py", line 524, in __call
timeout = self.timeout)
File "/usr/lib/python3.6/site-packages/SOAPpy/Client.py", line 385, in call
data = f.read()
ValueError: read of closed file

The server produces:

*** Internal exception initial_value must be str or None, not bytes ****
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/SOAPpy/Server.py", line 230, in do_POST
parseSOAPRPC(data, header = 1, body = 1, attrs = 1, ignore_ext=self.ignore_ext)
File "/usr/lib/python3.6/site-packages/SOAPpy/Parser.py", line 1102, in parseSOAPRPC
t = _parseSOAP(xml_str, rules = rules, ignore_ext=ignore_ext)
File "/usr/lib/python3.6/site-packages/SOAPpy/Parser.py", line 1053, in _parseSOAP
inpsrc.setByteStream(StringIO(xml_str))
TypeError: initial_value must be str or None, not bytes


My SOAPpy-py3 is v0.52.24

should I change the return in the server to return (b'Hello World') ?
Maybe then have the client do something like
response = server.hello().decode('utf-8') ?

Thanks......

SOAPProxy call errors out TypeError: expected bytes-like object, not str

I think the base64 encoding is incorrectly handled here, also encodestring is deprecated.

this should be something like below
val = base64.encodestring(urllib.parse.unquote_plus(addr.user).encode())

the encode string errors out saying: TypeError: expected bytes-like object, not str

Location: https://github.com/Synerty/SOAPpy-py3/blob/master/src/SOAPpy/Client.py#L317
if addr.user != None:
val = base64.encodestring(urllib.parse.unquote_plus(addr.user))
r.putheader('Authorization','Basic ' + val.replace('\012',''))

SOAPBuilder dump custom object with slots

There is a bug in handling custom objects.
Support for objects with slots needed.

Traceback (most recent call last):
  File "C:\Utilities\Python27\lib\site-packages\SOAPpy\Server.py", line 422, in do_POST
    config=self.server.config)
  File "C:\Utilities\Python27\lib\site-packages\SOAPpy\SOAPBuilder.py", line 650, in buildSOAP
    return t.build()
  File "C:\Utilities\Python27\lib\site-packages\SOAPpy\SOAPBuilder.py", line 153, in build
    self.dump(v, k, typed = typed, ns_map = ns_map)
  File "C:\Utilities\Python27\lib\site-packages\SOAPpy\SOAPBuilder.py", line 287, in dump
    self.dump_dispatch(obj, tag, typed, ns_map)
  File "C:\Utilities\Python27\lib\site-packages\SOAPpy\SOAPBuilder.py", line 563, in dump_dispatch
    func(obj, tag, typed, ns_map)
  File "C:\Utilities\Python27\lib\site-packages\SOAPpy\SOAPBuilder.py", line 533, in dump_dictionary
    self.dump(v, k, 1, ns_map)
  File "C:\Utilities\Python27\lib\site-packages\SOAPpy\SOAPBuilder.py", line 287, in dump
    self.dump_dispatch(obj, tag, typed, ns_map)
  File "C:\Utilities\Python27\lib\site-packages\SOAPpy\SOAPBuilder.py", line 632, in dump_dispatch
    for (k, v) in d1:
ValueError: too many values to unpack

Proposed solution:

diff -u -r github/SOAPpy/src/SOAPpy/SOAPBuilder.py local\SOAPpy\src\SOAPpy\/SOAPBuilder.py
--- github/SOAPpy/src/SOAPpy/SOAPBuilder.py 2014-05-15 12:30:00.358000000 +0200
+++ local/SOAPpy/src/SOAPpy/SOAPBuilder.py  2014-05-15 13:07:45.167585200 +0200
@@ -678,9 +678,11 @@
         else:                           # Some Class
             self.out.append('<%s%s%s>\n' % (tag, id, r))

-            d1 = getattr(obj, '__dict__', None)
+            d1 = getattr(obj, '__dict__', None if not hasattr(obj, "__slots__")
+                                          else dict(((k, getattr(obj, k)) 
+                                                for k in obj.__slots__)))
             if d1 is not None:
-                for (k, v) in d1:
+                for (k, v) in d1.items():
                     if k[0] != "_":
                         self.dump(v, k, 1, ns_map)

ImportError: No module named request while import SOAPpy

import SOAPpy

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/SOAPpy/__init__.py", line 5, in <module> from Client import * File "/usr/local/lib/python2.7/dist-packages/SOAPpy/Client.py", line 61, in <module> from Parser import parseSOAPRPC File "/usr/local/lib/python2.7/dist-packages/SOAPpy/Parser.py", line 10, in <module> from wstools.XMLname import fromXMLname File "/usr/local/lib/python2.7/dist-packages/wstools/__init__.py", line 6, in <module> from . import WSDLTools # noqa File "/usr/local/lib/python2.7/dist-packages/wstools/WSDLTools.py", line 21, in <module> from .Utility import Collection, CollectionNS, DOM, ElementProxy, basejoin # noqa File "/usr/local/lib/python2.7/dist-packages/wstools/Utility.py", line 25, in <module> import urllib.request, urllib.parse, urllib.error ImportError: No module named request

LICENSE file missing in pypi distfile

Hi,
If we download the distfile 0.12.22 from github we can sees a BSD3CLAUSE LICENSE file after extracting. However if we download a distfile from pypi I can't seem to find a LICENSE file after extracting. Can you make sure that the next time it is released in pypi the LICENSE file is attached.

BR,
Muhammad

Unable to read WSDL file from ONVIF

I've just tried the following with Python 2.7.9

>>> from SOAPpy import WSDL
>>> wsdl = 'http://www.onvif.org/ver10/media/wsdl/media.wsdl'
>>> server = WSDL.Proxy(wsdl)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/SOAPpy/WSDL.py", line 91, in __init__
    service = self.wsdl.services[0]
  File "/usr/lib/python2.7/site-packages/wstools/Utility.py", line 1184, in __getitem__
    return self.list[key]
IndexError: list index out of range

I'm not sure what's happening here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.