0
我有Web服務這樣的:不能用強制的UUID(或其它圖案相關的必是類型)作爲RPC參數
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必須有一個模式。有什麼解決方法嗎?也許另一個肥皂框架?
嗨,創建了以下回購:https://github.com/plq/spyne-uuid-error讓我看看爲什麼會發生這種情況。 –
使用你的代碼我有這個相同的錯誤。看看https://www.dropbox.com/s/lwkbwwexqox20iu/uuid.html – kbec
請嘗試2.9.5候選人:https://github.com/arskom/spyne/tree/2_9。如果這可以解決您的問題,我會快速製作新版本。 –