i have a server running django and spyne, i want to configure spyne to accept xml like below:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE"
xmlns:loc="http://ift.tt/1noaANI">
<soapenv:Header/>
<soapenv:Body>
<loc:sendSms>
<loc:addresses>[addresses]</loc:addresses>
<loc:senderName>[senderName]</loc:senderName>
<loc:message>[message]</loc:message>
<loc:receiptRequest>
<endpoint></endpoint>
<interfaceName></interfaceName>
<correlator></correlator>
</loc:receiptRequest>
</loc:sendSms>
<loc:sendSms>
<loc:addresses>[addresses]</loc:addresses>
<loc:senderName>[senderName]</loc:senderName>
<loc:message>[message]</loc:message>
<loc:receiptRequest>
<endpoint></endpoint>
<interfaceName></interfaceName>
<correlator></correlator>
</loc:receiptRequest>
</loc:sendSms>
.
.
.
</soapenv:Body>
</soapenv:Envelope>
is it possible? how should i do so?
and changing the client is impossible, so i have to work with this format.
EDIT:
what i have done till now:
model:
class ReceiptRequestItem(ComplexModel):
__namespace__ = 'http://ift.tt/1noaANI'
endpoint = Unicode()
interfaceName = Unicode()
correlator = Unicode()
service:
class MOMessageService(ServiceBase):
@rpc(Unicode, Unicode, Unicode, ReceiptRequestItem,
_returns=Unicode,
_in_variable_names={'sender_name': 'senderName',
'receipt_request': 'receiptRequest'},
_operation_name='sendSms')
def send_sms(ctx, addresses, sender_name, message, receipt_request):
print addresses, sender_name, message, receipt_request
return
application:
mo_message_app = Application([MOMessageService],
'http://ift.tt/1noaANI',
in_protocol=Soap11(validator='soft'),
out_protocol=Soap11(), )
mo_message_service = csrf_exempt(DjangoApplication(mo_message_app))
this works when there is just one
<loc:sendSms>
though there is a problem with namespaces and lxml validator will result in error.
the question is have to change the code to accept multiple tags.
P.S: also i will be grateful if someone tell me have to fix my problem with namespaces. :)
Aucun commentaire:
Enregistrer un commentaire