From b4ef065a4cf13f4f93c79a3ed44113cab40f705a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awek=20Ehlert?= Date: Mon, 5 Jan 2015 10:33:01 +0100 Subject: [PATCH] several fixes for SOAP protocol * fixed a small issue with binding * fix for python2.6 when iterating over input msg (if the processed element is a comment - skip it) * import print function (because it is used here in this form) * fix minOccurs for non mandatory arguments * operation namespace fix - https://bugs.launchpad.net/wsme/+bug/1235238 - https://groups.google.com/forum/#!topic/python-wsme/gVzogTZlC7w Change-Id: I2d237e04f27f8acd912cc8e2eb27d12ff72ebd04 --- wsmeext/soap/protocol.py | 5 ++++- wsmeext/soap/wsdl.py | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/wsmeext/soap/protocol.py b/wsmeext/soap/protocol.py index f40cac1..5478ef0 100644 --- a/wsmeext/soap/protocol.py +++ b/wsmeext/soap/protocol.py @@ -2,7 +2,7 @@ A SOAP implementation for wsme. Parts of the code were taken from the tgwebservices soap implmentation. """ -from __future__ import absolute_import +from __future__ import absolute_import, print_function import pkg_resources import datetime @@ -383,6 +383,9 @@ class SoapProtocol(Protocol): return kw msg = context.soap_message for param in msg: + # FIX for python2.6 (only for lxml) + if use_lxml and isinstance(param, ET._Comment): + continue name = param.tag[len(self.typenamespace) + 2:] arg = context.funcdef.get_arg(name) value = fromsoap(arg.datatype, param, { diff --git a/wsmeext/soap/wsdl.py b/wsmeext/soap/wsdl.py index 4f23b79..fad0ad7 100644 --- a/wsmeext/soap/wsdl.py +++ b/wsmeext/soap/wsdl.py @@ -110,7 +110,7 @@ class WSDLGenerator(object): type=self.soap_type(farg.datatype, True) ) if not farg.mandatory: - element.set('minOccurs', 0) + element.set('minOccurs', '0') response_el = ET.Element( xs_ns('element'), @@ -152,7 +152,7 @@ class WSDLGenerator(object): binding = ET.Element( wsdl_ns('binding'), name='%s_Binding' % self.service_name, - type='%s_PortType' % self.service_name + type='tns:%s_PortType' % self.service_name ) ET.SubElement( binding, @@ -224,7 +224,7 @@ class WSDLGenerator(object): ) ET.SubElement( operation, - wsdl_ns('operation'), + soap_ns('operation'), soapAction=soap_fname ) ET.SubElement(