Permalink
Browse files

added messages and portType to wsdl

  • Loading branch information...
baverman committed Mar 27, 2012
1 parent f11376a commit 160e3977fe35547967bd0523a8cdda2476437c9f
Showing with 50 additions and 13 deletions.
  1. +2 −2 dropthesoap/schema/model.py
  2. +29 −11 dropthesoap/schema/wsdl.py
  3. +19 −0 dropthesoap/service.py
@@ -65,8 +65,8 @@ def __str__(self):
class Instance(object):
- def __init__(self, element, *args, **kwargs):
- self._element = element
+ def __init__(self, _element, *args, **kwargs):
+ self._element = _element
self._type.init(self, *args, **kwargs)
def get_node(self, creator):
View
@@ -6,24 +6,42 @@
types = xs.element('types')(xs.cts(
xs.any(minOccurs=0)))
+part = xs.element('part')(
+ xs.complexType()(
+ xs.attribute('name', xs.string),
+ xs.attribute('element', xs.string)))
+
message = xs.element('message', minOccurs=0, maxOccurs=xs.unbounded)(
xs.complexType()(
xs.sequence()(
- xs.element('part')(
- xs.complexType()(
- xs.attribute('name', xs.string),
- xs.attribute('element', xs.string)
- )
- )
- ),
- xs.attribute('name', xs.string)
- )
-)
+ part),
+ xs.attribute('name', xs.string)))
+
+input = xs.element('input')(
+ xs.complexType()(
+ xs.attribute('message', xs.string)))
+
+output = xs.element('output')(
+ xs.complexType()(
+ xs.attribute('message', xs.string)))
+
+operation = xs.element('operation', minOccurs=0, maxOccurs=xs.unbounded)(
+ xs.complexType()(
+ xs.sequence()(
+ input,
+ output),
+ xs.attribute('name', xs.string)))
+
+portType = xs.element('portType', minOccurs=0, maxOccurs=xs.unbounded)(
+ xs.complexType()(
+ xs.sequence()(
+ operation),
+ xs.attribute('name', xs.string)))
definitions = xs.element('definitions')(xs.cts(
types,
message,
-))
+ portType))
schema = xs.schema(namespace)(
definitions
View
@@ -67,6 +67,25 @@ def get_wsdl(self, url):
defs = wsdl.definitions.instance()
defs.types = wsdl.types.instance(_any=get_root(self.schema))
+ messages = defs.message = []
+ port = wsdl.portType.instance(name=self.name)
+ operations = port.operation = []
+ defs.portType = [port]
+
+ for name in self.methods:
+ nameRequest = '%sRequest' % name
+ nameResponse = '%sResponse' % name
+
+ messages.append(wsdl.message.instance(name=nameRequest,
+ part=wsdl.part.instance(name='parameters', element='tns:%s' % name)))
+
+ messages.append(wsdl.message.instance(name=nameResponse,
+ part=wsdl.part.instance(name='parameters', element='tns:%s' % nameResponse)))
+
+ operations.append(wsdl.operation.instance(name=name,
+ input=wsdl.input.instance(message=nameRequest),
+ output=wsdl.output.instance(message=nameResponse)))
+
return etree.tostring(get_root(defs))
def execute(self, xml):

0 comments on commit 160e397

Please sign in to comment.