Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54357
| From | dieter <dieter@handshake.de> |
|---|---|
| Subject | Re: Suds and Complex Sequences |
| Date | 2013-09-18 08:16 +0200 |
| References | <CAF8U9yxAkG-zuGB0K+AaUwRCcKkzNYGa6Q6WFJDFgN8dzaOkSQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.103.1379484984.18130.python-list@python.org> (permalink) |
Greg Lindstrom <gslindstrom@gmail.com> writes:
> I am trying to use Suds, the very fine library allowing me to use SOAP, to
> query a service over the net. Part of the data structure defined be the
> WSDL calls for a sequence of SubscriberDataTypes (this application is used
> to test an insurance companys' rating service).
>
> (SubscriberDataType){
> SubscriberID = None
> SubscriberBirthDate = None
> Zip = None
> <snip>
> DependentData[] = <empty>
> }
>
> Which goes into
>
> (MedicalRatingRequest){
> MessageHeader =
> (MessageHeaderType){
> MessageName = None
> MessageID = None
> <snip>
> }
> RequestHeader =
> (RequestHeaderType){
> RequestType =
> (RequestTypeEnum){
> value = None
> }
> <snip>
> }
> <snip>
> SubscriberData[] = <empty>
> }
>
> Note that the Subscriber Data is a sequence of SubscriberDataType. I have
> not been able to find any documentation showing me how to do this. Does
> anyone out there know how I can generate the request?
A suds client as two major components: the "service" itself, and
the so called "factory". You can use the "factory" to create Python
objects corresponding to a type defined in the WSDL.
To pass a list of complex type, you use the factory to
create Python objects for the list components, set these objects'
attributes in any way appropriate and build of Python list of
them and assign the list or "append" them directly to the list
values attribute.
In your case, it may look somehow like:
sd = client.factory("SubscriberDataType") # create a SubscriberDataType Python object
sd.SubscriberID = ... # assign values for its attributes
....
mrr = client.factory("MedicalRatingRequest")
mrr.SubscriberData.append(sd) # append our "sd"
or
mrr.SubscriberData = [sd] # assign a list
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Suds and Complex Sequences dieter <dieter@handshake.de> - 2013-09-18 08:16 +0200
csiph-web