I have received such a soap message from a soap client. But i do not know how to define a service based on spyne to handle this soap message.
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sde1="http://www.aglaia-gmbh.de/xml/BaSS_SOAPd/"
xmlns:sde2="http://www.aglaia-gmbh.de/xml/2013/05/17/BaSS_SOAPd.xsd">
<SOAP-ENV:Body>
<sde2:notification_message>
<sde2:startup_notification
mac_address="00:0B:91:A0:0C:34"
notification_ID="1"
serverTask_ID="0"
timestamp="2022-01-01T04:05:38.675327+00:00"
ip_address="192.168.90.201"
xml_version="http://www.aglaia-gmbh.de/xml/2013/05/17/BaSS_SOAPd.xsd"
paramset_version="">
</sde2:startup_notification>
</sde2:notification_message>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
from spyne import (Application, rpc, ServiceBase, Iterable, Integer, Unicode, ComplexModel, XmlAttribute)
from spyne.protocol.soap import Soap11, Soap12
from spyne.server.wsgi import WsgiApplication
class Request(ComplexModel):
startup_notification = Unicode
mac_address = XmlAttribute(Unicode)
notification_ID = XmlAttribute(Integer)
serverTask_ID = XmlAttribute(Integer)
timestamp = XmlAttribute(Unicode)
ip_address = XmlAttribute(Unicode)
xml_version = XmlAttribute(Unicode)
paramset_version = XmlAttribute(Unicode)
class HelloWorldService(ServiceBase):
@rpc(Unicode, Integer, _returns=Iterable(Unicode))
def SayHello(self, name, times):
for i in range(times):
yield 'Hello, %s' % name
@rpc(Request, _returns=Unicode, _body_style='bare')
def notification_message(self, startup_notification):
print(startup_notification)
return 'OK'
application = Application([HelloWorldService],
tns='targetNamespace',
in_protocol=Soap12(validator='soft'),
out_protocol=Soap12()
)
wsgi_app = WsgiApplication(application)
it does not work. And as they say, how do I define the parameters of this receive function?