Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

aliased types in service endpoint arguments

  • Loading branch information...
commit 9b85062863cf594ce53e0653e8b0a3d0398dc9c8 1 parent 217745b
@baverman authored
Showing with 23 additions and 5 deletions.
  1. +1 −3 dropthesoap/service.py
  2. +22 −2 tests/test_service.py
View
4 dropthesoap/service.py
@@ -52,7 +52,6 @@ def __init__(self, name, tns):
self.name = name
self.methods = {}
- self.method_schema = xs.schema(Namespace(tns))
self.schema = xs.schema(Namespace(tns))
def expose(self, returns):
@@ -82,7 +81,6 @@ def inner(func):
xs.complexType()(
xs.sequence()(*celements)))
- self.method_schema(request)
self.schema(request)
rname = name + 'Response'
@@ -196,7 +194,7 @@ def dispatch(self, ctx, request):
def call(self, transport_request, xml):
try:
envelope = soap.schema.fromstring(xml)
- request = self.method_schema.from_node(envelope.Body._any[0])
+ request = self.schema.from_node(envelope.Body._any[0])
ctx = Request(transport_request, envelope)
response = self.dispatch(ctx, request)
View
24 tests/test_service.py
@@ -1,10 +1,10 @@
from suds.client import Client
from suds.client import WebFault
-from dropthesoap.service import Service, optional, Fault
+from dropthesoap.service import Service, optional, Fault, array
from dropthesoap.schema import xs
-from .helpers import DirectSudsTransport
+from .helpers import DirectSudsTransport, tostring
def test_simple_service():
service = Service('Boo', 'http://boo')
@@ -55,6 +55,26 @@ def add(x=xs.int, y=xs.int):
assert result.foo == '11'
assert result.bar == '-9'
+def test_aliased_types_in_params():
+ service = Service('Boo', 'http://boo')
+
+ service.schema(
+ xs.complexType(name='paramType')(xs.sequence()(
+ xs.element('foo', xs.string)))
+ )
+
+ @service.expose(xs.string)
+ def concat(param=array('paramType')):
+ return ''.join(r.foo for r in param)
+
+ open('/tmp/wow.xml', 'w').write(service.get_wsdl('http://localhost/'))
+
+ cl = Client('some address', transport=DirectSudsTransport(service), cache=None)
+
+ result = cl.service.concat([{'foo':'boo'}, {'foo':'bar'}])
+ assert result == 'boobar'
+
+
def test_header():
service = Service('Boo', 'http://boo')
Please sign in to comment.
Something went wrong with that request. Please try again.