我有这样的网络服务:
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))
我可以Uuid
用作参数,但是当我尝试其强制版本时,服务器响应错误:
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
为什么我不能自定义Uuid
类型?如果我从其定义中删除模式,那么一切都很好,但无论如何都必须有 UUID 的模式。有什么解决方法吗?也许另一个肥皂框架?