Python 如何在spyne中建模SOAP远程过程属性?
我有以下SOAP请求,我应该能够处理:Python 如何在spyne中建模SOAP远程过程属性?,python,soap,spyne,Python,Soap,Spyne,我有以下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> _d5628602323819f716fcee
<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>
为完整起见,以下是使用的模型:
class OKType(ComplexModel):
pass
class MandatoryUnicode(Unicode):
class Attributes(Unicode.Attributes):
nullable = False
min_occurs = 1
模式是。但是没有包含该属性的正式WSDL。关键是使用裸体样式。然后,您可以并且需要对完整的输入和输出消息进行建模 我的工作代码如下所示:
class OKType(ComplexModel):
pass
class MandatoryUnicode(Unicode):
class Attributes(Unicode.Attributes):
nullable = False
min_occurs = 1
class LogoutRequest(ComplexModel):
__namespace__ = 'urn:mace:shibboleth:2.0:sp:notify'
SessionID = MandatoryUnicode
type = XmlAttribute(Enum("global", "local", type_name="LogoutNotificationType"))
class LogoutResponse(ComplexModel):
__namespace__ = 'urn:mace:shibboleth:2.0:sp:notify'
OK = OKType
class LogoutNotificationService(Service):
@rpc(LogoutRequest, _returns=LogoutResponse, _body_style='bare')
def LogoutNotification(ctx, req):
# do stuff, raise Fault on error
# sessionid is available as req.SessionID
return LogoutResponse
关于的不太相关的问题包含了很好的例子,并向我展示了如何解决这个问题
class OKType(ComplexModel):
pass
class MandatoryUnicode(Unicode):
class Attributes(Unicode.Attributes):
nullable = False
min_occurs = 1
class LogoutRequest(ComplexModel):
__namespace__ = 'urn:mace:shibboleth:2.0:sp:notify'
SessionID = MandatoryUnicode
type = XmlAttribute(Enum("global", "local", type_name="LogoutNotificationType"))
class LogoutResponse(ComplexModel):
__namespace__ = 'urn:mace:shibboleth:2.0:sp:notify'
OK = OKType
class LogoutNotificationService(Service):
@rpc(LogoutRequest, _returns=LogoutResponse, _body_style='bare')
def LogoutNotification(ctx, req):
# do stuff, raise Fault on error
# sessionid is available as req.SessionID
return LogoutResponse