GithubHelp home page GithubHelp logo

stepank / pyws Goto Github PK

View Code? Open in Web Editor NEW
26.0 4.0 14.0 1.39 MB

python SOAP server providing WSDL

Home Page: http://stepank.github.com/pyws/

License: MIT License

Makefile 7.29% Python 62.63% Shell 3.45% Java 8.52% C# 9.22% PHP 8.89%

pyws's Introduction

pyws

Pyws is a project, which purpuse is to help developers to expose some functions of their systems as public API via SOAP protocol with WSDL description. The main idea is to let developers completely forget about SOAP itself and make creating of API trasparent and painless.

Build status

Documentation

The documentation can be found at http://stepank.github.com/pyws/.

Contacting me

Feel free to contact me concerning any problems, issues or questions about this project via email [email protected].

pyws's People

Contributors

kjir avatar spencerogden avatar stepank avatar wrexor 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

Watchers

 avatar  avatar  avatar  avatar

pyws's Issues

Drop python 2.5 support

My build server runs Ubuntu 14.04 which has virtualenv 1.11 in its repos. This version of virtualenv does not support python 2.5, so testing pyws against it got more cumbersome. Additionally, when I decide to support python 3, it will be easier to implement.

Better REST protocol

Current REST implementation is just stub, it supports only the GET HTTP method. A new REST protocol must support various HTTP methods, nested URLs and request body processing.

Consider adding some response headers

Adding these response headers might be necessary to consume pyws webservices from web browsers:

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST,OPTIONS,GET
Access-Control-Allow-Headers: Content-Type

I followed the tutorial, but get following error?

WSGIRequest' object has no attribute 'raw_post_data'
Request Method: GET
Request URL: http://localhost:8000/api/
Django Version: 1.7.dev20130808093617
Exception Type: AttributeError
Exception Value:
'WSGIRequest' object has no attribute 'raw_post_data'
Exception Location: /usr/local/lib/python2.7/dist-packages/pyws-1.1.2-py2.7.egg/pyws/adapters/_django.py in serve, line 25
Python Executable: /usr/bin/python
Python Version: 2.7.3
Python Path:
['/home/thomas/Dropbox/dev/python/vms_emailws',
'/usr/local/lib/python2.7/dist-packages/pyws-1.1.2-py2.7.egg',
'/home/thomas/Dropbox/dev/python/django',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
'/usr/lib/python2.7/dist-packages/ubuntuone-couch',
'/usr/lib/python2.7/dist-packages/ubuntuone-installer',
'/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
Server time: Fri, 9 Aug 2013 14:12:49 +0000

Getting suds.transport.TransportError

Hello

I followed tutorial available in documentation and I am getting:
suds.transport.TransportError: HTTP Error 500: INTERNAL SERVER ERROR

I use django 1.6

my urls.py:
url('^api/(.*)', serve, {'server': server}),

server.py

from pyws.server import SoapServer
from .settings_core import PROJECT_NAME

server = SoapServer(
service_name='Test',
tns='http://example.com/',
location='http://localhost:8000/api/',
)

from pyws.functions.register import register

@register()
def add_simple(a, b):
return a + b

example call:
import suds
client = suds.client.Client('http://localhost:8000/api/wsdl', cache=None)
client.service.add_simple('hello ', 'world')

Fix some issues with datetime support

At the moment datetime support has two problems:

  1. micro/milliseconds do not appear in responses,
  2. appearance of micro/milliseconds in requests results in errors on python 2.5.

Python 2.5 support

Check if it is possible to run pyws on python 2.5 and fix problems if they occur. There is at least one known issue: usage of 'with' statement.

Add headers validation

Headers are not validated, hence some values (number, dates) are not converted from strings.

It should be possible to specify optional arguments

It is not possible to declare an optional argument: it is possible to define a default value for a nullable argument, but it is not possible to declare it as optional.

This would be very useful in cases where you might want to add a new parameter, but without imposing a change in (stupid) clients that do not automatically add missing parameters as empty tags.

Here is an example (partial) WSDL with optional arguments:

<xsd:element name="message">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="to" type="xsd:string" nillable="true"/>
            <xsd:element name="subject" type="xsd:string" nillable="true"/>
            <xsd:element name="text" type="xsd:string" minOccurs="0" nillable="true"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>

Remove Twisted Web adapter

Given the fact that pyws is written completely in synchronous style, using it with Twisted Web is absolutely pointless.

pyws crashes if SOAP request body does not match the required schema

If I have the test server (pyws/examples/_wsgi/__init__.py) running and fire the following request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:ns1="http://example.com/types/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body>
        <ns1:sum_tree xsi:type="ns1:Tree">
            <ns1:value>10</ns1:value>
            <ns1:left>
                <ns1:value>20</ns1:value>
                <ns1:left xsi:nil="true"/>
                <ns1:right xsi:nil="true"/>
            </ns1:left>
            <ns1:right>
                <ns1:value>30</ns1:value>
                <ns1:left xsi:nil="true"/>
                <ns1:right xsi:nil="true"/>
            </ns1:right>
        </ns1:sum_tree>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

(sum_tree must contain p element), I just get:

A server error occurred.  Please contact the administrator.

The following message can be found in logs:

ERROR:pyws:Traceback (most recent call last):
  File "/home/stepank/projects/pyws/src/pyws/server.py", line 174, in process_request
    args = protocol.get_arguments(request, function.args)
  File "/home/stepank/projects/pyws/src/pyws/protocols/soap/__init__.py", line 216, in get_arguments
    return xml2obj(self.parse_request(request).func_xml, arguments) or {}
  File "/home/stepank/projects/pyws/src/pyws/protocols/soap/__init__.py", line 44, in xml2obj
    obj = xml2obj(child, schema[name])
KeyError: 'value'

Boolean support

Boolean types seem to be getting converted to integers in the WSDL description, yet they are a primitive type according to XMLSchema.

Would be nice if people could use true/false instead of 0/1.

The example crashes with a 500 (py2.7, django1.3)

KeyError at /
'QUERY_STRING'
Request Method: POST
Request URL: http://localhost:8000/
Django Version: 1.3.1
Exception Type: KeyError
Exception Value:
'QUERY_STRING'
Exception Location: /home/delhivery/src/venv/local/lib/python2.7/site-packages/pyws-1.1.3-py2.7.egg/pyws/adapters/_django.py in serve, line 35
Python Executable: /home/delhivery/src/venv/bin/python
Python Version: 2.7.3

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.