Search code examples
soappython-2.7django-1.5spyne

Cannot use mandatory uuid (or other pattern-related must-be type) as rpc argument


I have webservice like this:

class ExampleService(ServiceBase):
    __tns__ = 'http://xml.company.com/ns/example/'

    @rpc(Mandatory.Uuid, _returns=Unicode)
    def say_my_uuid(ctx, uuid):
        return 'Your UUID: %s' % uuid

    @classmethod
    def dispatch(cls):
        application = Application([cls],
            tns=cls.__tns__,
            interface=Wsdl11(),
            in_protocol=Soap11(validator='lxml'),
            out_protocol=Soap11(cleanup_namespaces=True)
        )
        return csrf_exempt(DjangoApplication(application))

I can use Uuid as an argument, but when I'm trying its mandatory version then server response with error:

XMLSchemaParseError at /
simple type 'MandatoryUuid', attribute 'base': The QName value '{http://www.w3.org/2001/XMLSchema}MandatoryString' does not resolve to a(n) simple type definition., line 12
Exception Location: D:\Program Files\Python27\lib\site-packages\spyne\interface\xml_schema\_base.py in build_validation_schema, line 183

Why I can't customize Uuid type? If I remove pattern from its definition then everything is ok, but there must be a pattern for UUID anyway. Is there any workaround? Maybe another soap framework?


Solution

  • I have just released Spyne-2.9.5 which contains the fix for this issue.