【发布时间】:2017-10-14 16:44:37
【问题描述】:
我有以下 SOAP 请求,我应该能够处理:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<LogoutNotification xmlns="urn:mace:shibboleth:2.0:sp:notify" type="global">
<SessionID>
_d5628602323819f716fcee04103ad5ef
</SessionID>
</LogoutNotification>
</s:Body>
</s:Envelope>
SessionID 只是 RPC 参数。这很容易处理。
但是如何在 spyne 中为 type 属性建模? type 是“全局”或“本地”。
我目前有以下内容(并且禁用了验证以便能够简单地忽略该属性):
class LogoutNotificationService(Service):
@rpc(MandatoryUnicode, _returns=OKType,
_in_variable_names={'sessionid': 'SessionID'},
_out_variable_name='OK',
)
def LogoutNotification(ctx, sessionid):
pass # handle the request
为了完整起见,这里是使用的模型:
class OKType(ComplexModel):
pass
class MandatoryUnicode(Unicode):
class Attributes(Unicode.Attributes):
nullable = False
min_occurs = 1
架构是online。但是没有包含该属性的官方 WSDL。
【问题讨论】: