Hi!
I have this WSDL:
<
wsdl:definitionsxmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/add...
<wsdl:types>
<xs:schematargetNamespace="lamoda"elementFormDefault="qualified">
<xs:complexTypename="put_subscriberResponse">
<xs:sequence>
<xs:elementname="put_subscriberResult"type="tns:FSubscriber"/>
</xs:sequence>
</xs:complexType>
<xs:complexTypename="FSubscriber">
<xs:sequence>
<xs:elementname="id"type="xs:integer"/>
<xs:elementname="creator_id"type="xs:integer"/>
<xs:elementname="created_time"type="xs:dateTime"/>
<xs:elementname="editor_id"type="xs:integer"/>
<xs:elementname="edited_time"type="xs:dateTime"/>
<xs:elementname="customer_id"type="xs:integer"/>
<xs:elementname="email"type="xs:string"/>
<xs:elementname="status"type="xs:string"/>
<xs:elementname="sms_status"type="xs:string"/>
<xs:elementname="change_status_at"type="xs:dateTime"/>
<xs:elementname="confirm_code"type="xs:string"/>
<xs:elementname="gender"type="xs:string"/>
<xs:elementname="auto_gender"type="xs:string"/>
<xs:elementname="location"type="xs:string"/>
<xs:elementname="utm_source"type="xs:string"/>
<xs:elementname="utm_medium"type="xs:string"/>
<xs:elementname="utm_campaign"type="xs:string"/>
<xs:elementname="utm_content"type="xs:string"/>
<xs:elementname="utm_term"type="xs:string"/>
<xs:elementname="utm_keyword"type="xs:string"/>
<xs:elementname="url"type="xs:string"/>
<xs:elementname="referer"type="xs:string"/>
<xs:elementname="domain"type="xs:string"/>
<xs:elementname="name"type="xs:string"/>
<xs:elementname="year_of_birth"type="xs:integer"/>
<xs:elementname="region"type="xs:string"/>
<xs:elementname="city"type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexTypename="put_subscriber">
<xs:sequence>
<xs:elementname="subscriber"type="tns:Subscriber"/>
</xs:sequence>
</xs:complexType>
<xs:complexTypename="Subscriber">
<xs:sequence>
<xs:elementname="id"type="xs:integer"minOccurs="0"nillable="true"/>
<xs:elementname="creator_id"type="xs:integer"minOccurs="0"nillable="true"/>
<xs:elementname="created_time"type="xs:dateTime"minOccurs="0"nillable="true"/>
<xs:elementname="editor_id"type="xs:integer"minOccurs="0"nillable="true"/>
<xs:elementname="edited_time"type="xs:dateTime"minOccurs="0"nillable="true"/>
<xs:elementname="customer_id"type="xs:integer"minOccurs="0"nillable="true"/>
<xs:elementname="email"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="status"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="sms_status"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="change_status_at"type="xs:dateTime"minOccurs="0"nillable="true"/>
<xs:elementname="confirm_code"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="gender"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="auto_gender"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="location"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="utm_source"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="utm_medium"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="utm_campaign"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="utm_content"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="utm_term"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="utm_keyword"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="url"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="referer"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="domain"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="name"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="year_of_birth"type="xs:integer"minOccurs="0"nillable="true"/>
<xs:elementname="region"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="city"type="xs:string"minOccurs="0"nillable="true"/>
</xs:sequence>
</xs:complexType>
<xs:elementname="Subscriber"type="tns:Subscriber"/>
<xs:elementname="put_subscriber"type="tns:put_subscriber"/>
<xs:elementname="FSubscriber"type="tns:FSubscriber"/>
<xs:elementname="put_subscriberResponse"type="tns:put_subscriberResponse"/>
</xs:schema>
</wsdl:types>
<wsdl:messagename="put_subscriber">
<wsdl:partname="put_subscriber"element="tns:put_subscriber"/>
</wsdl:message>
<wsdl:messagename="put_subscriberResponse">
<wsdl:partname="put_subscriberResponse"element="tns:put_subscriberResponse"/>
</wsdl:message>
<wsdl:servicename="SubscriptionService">
<wsdl:portname="Application"binding="tns:Application">
<soap:addresslocation="http://127.0.0.1:8000/api/newsletter/"/>
</wsdl:port>
</wsdl:service>
<wsdl:portTypename="Application">
<wsdl:operationname="put_subscriber"parameterOrder="put_subscriber">
<wsdl:documentation>
Create a new or update an existing subscriber. If `id` is None or not
passed and new subscription is created, otherwise the existing
subscription is updated.
</wsdl:documentation>
<wsdl:inputname="put_subscriber"message="tns:put_subscriber"/>
<wsdl:outputname="put_subscriberResponse"message="tns:put_subscriberResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:bindingname="Application"type="tns:Application">
<
soap:bindingstyle="document"transport="http://schemas.xmls...
<wsdl:operationname="put_subscriber">
<soap:operationsoapAction="put_subscriber"style="document"/>
<wsdl:inputname="put_subscriber">
<soap:bodyuse="literal"/>
</wsdl:input>
<wsdl:outputname="put_subscriberResponse">
<soap:bodyuse="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
And suds gets this response (taken from logs):
<senv:Envelope xmlns:tns="lamoda"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">
<senv:Body>
<tns:put_subscriberResponse>
<tns:put_subscriberResult>
<tns:id>5346529</tns:id>
<tns:creator_id xsi:nil="true"/>
...
<tns:confirm_code></tns:confirm_code>
...
</tns:put_subscriberResult>
</tns:put_subscriberResponse>
</senv:Body>
</senv:Envelope>
On ipdb breakpoint:
ipdb> suds_obj
(Subscriber){
id = 5346529
creator_id = None
created_time = 2013-07-08 17:39:59
editor_id = None
edited_time = 2013-07-10 18:10:55.086515
customer_id = 1
email = "asdf"
status = "SUBSCRIBED"
sms_status = "SUBSCRIBED"
change_status_at = None
confirm_code = None
gender = None
auto_gender = None
location = None
utm_source = None
utm_medium = None
utm_campaign = None
utm_content = None
utm_term = None
utm_keyword = None
url = None
referer = None
domain = None
name = None
year_of_birth = 0
region = None
city = None
}
ipdb> suds_obj.__dict__
*** AttributeError: Metadata instance has no attribute '__metadata__'
Questions:
1. `confirm_code` is an empty string, but it is transformed to None.
I've seen this
https://lists.fedoraproject.org/pipermail/suds/2010-May/000882.html and
i made returned type fields to be mandatory, but this didn't help
2. In WSDL the returned complex type is called FSubscriber, but in the
console the suds obj representation starts with Subscriber.
I want confirm_code to be automatically transformed into '' instead of
None. How do i do this?
3. In the console i cannot introspect suds object: AttributeError:
Metadata instance has no attribute '__metadata__'
Thank you!
Victor Varvaryuk