Hey there,
I'm just in the process of building a SOAP interface. While any SOAP
interface may return different ComplexTypes, I want all of them to provide
a ``status`` object as well.
Given my (variable) Payload ComplexType's name is "Subscriber":
FooInterfaceResponse:
> > Status
> >> Code
> >> Message
> > PayLoad
> >> Subscriber
> >>> Name
> >>> Surname
> >>> ..
My definition:
class SubscriberComplexType(DjangoComplexModel):
> class Attributes(DjangoComplexModel.Attributes):
> django_model = Subscriber
>
> class StatusComplexType(ComplexModel):
> code = UnsignedInteger16()
> message = Unicode()
> more_info = Unicode()
>
> class SubscriberReturnComplexType(ComplexModel):
> status = StatusComplexType()
> data = SubscriberComplexType()
>
> class SubscriberReadOnlyService(ServiceBase):
> @rpc(Unicode, _returns=SubscriberReturnComplexType)
> def getSubscriberByID(self, subscriber_id):
> """ Returns One Subscriber matching the given ID """
> response = SubscriberReturnComplexType()
> try:
> subscriber =
> Subscriber.objects.get(subscriber_id=subscriber_id)
> except Subscriber.DoesNotExist:
> response.status.code = 404
> response.status.message = unicode(_(u'Subscriber with ID
> ``%(subscriber_id)s`` does not exist.' % {'subscriber_id': subscriber_id}))
> return response
> response.data = response.data.init_from(subscriber)
> response.status.code = 200
> response.status.message = 'OK'
> return response
But this gives me an empty response:
<senv:Envelope xmlns:tns="devicementor" xmlns:senv="
> http://schemas.xmlsoap.org/soap/envelope/">
> <senv:Body>
> <tns:getSubscriberByIDResponse>
> <tns:getSubscriberByIDResult/>
> </tns:getSubscriberByIDResponse>
> </senv:Body>
> </senv:Envelope>
Any idea what I am missing?
Thank you!
Fabian
_______________________________________________
Soap mailing list
[email protected]
https://mail.python.org/mailman/listinfo/soap