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
This commit is contained in:
Sławek Ehlert 2015-01-05 10:33:01 +01:00
parent 1ecf6478fc
commit b4ef065a4c
2 changed files with 7 additions and 4 deletions

View File

@ -2,7 +2,7 @@
A SOAP implementation for wsme. A SOAP implementation for wsme.
Parts of the code were taken from the tgwebservices soap implmentation. 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 pkg_resources
import datetime import datetime
@ -383,6 +383,9 @@ class SoapProtocol(Protocol):
return kw return kw
msg = context.soap_message msg = context.soap_message
for param in msg: 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:] name = param.tag[len(self.typenamespace) + 2:]
arg = context.funcdef.get_arg(name) arg = context.funcdef.get_arg(name)
value = fromsoap(arg.datatype, param, { value = fromsoap(arg.datatype, param, {

View File

@ -110,7 +110,7 @@ class WSDLGenerator(object):
type=self.soap_type(farg.datatype, True) type=self.soap_type(farg.datatype, True)
) )
if not farg.mandatory: if not farg.mandatory:
element.set('minOccurs', 0) element.set('minOccurs', '0')
response_el = ET.Element( response_el = ET.Element(
xs_ns('element'), xs_ns('element'),
@ -152,7 +152,7 @@ class WSDLGenerator(object):
binding = ET.Element( binding = ET.Element(
wsdl_ns('binding'), wsdl_ns('binding'),
name='%s_Binding' % self.service_name, name='%s_Binding' % self.service_name,
type='%s_PortType' % self.service_name type='tns:%s_PortType' % self.service_name
) )
ET.SubElement( ET.SubElement(
binding, binding,
@ -224,7 +224,7 @@ class WSDLGenerator(object):
) )
ET.SubElement( ET.SubElement(
operation, operation,
wsdl_ns('operation'), soap_ns('operation'),
soapAction=soap_fname soapAction=soap_fname
) )
ET.SubElement( ET.SubElement(