R
R
Roman zhuravskiy2016-08-10 20:34:51
Python
Roman zhuravskiy, 2016-08-10 20:34:51

How to get parent type in wsdl using suds?

Tell me how can I create the correct xml to send via sudl wsdl.
My problem is that I can't figure out how to get
type="tns:ItemType" from methods. because when creating client.factory.create(types)
, the following elements are created:

ParcelType: (ParcelType){
   item[] = <empty>
   _barcode = ""
   _weight = ""
   _volume = ""
 }

ItemType: (ItemType){
   _sku = ""
   _barcode = ""
 }

As we can see, in order to create a ParcelType we have to create an ItemType and then shove them
into item[].
I would like to get type="tns:Type" information so that I can create a type tree and
go from the deepest to the topmost type. Tell me how to get
this information in suds.
....
      <read:notifyRequest>
         <read:export date="?" state="?" nr="?">
            <!--1 or more repetitions:-->
            <read:pallet nr="?">
               <!--1 or more repetitions:-->
               <read:order nr="?">
                  <!--1 or more repetitions:-->
                  <read:parcel scancode="?" weight="1" height="1">
                     <!--1 or more repetitions:-->
                     <read:item id="?" scancode="?"/>
                     <read:item id="?" scancode="?"/>
                     <read:item id="?" scancode="?"/>
                  </read:parcel>
               </read:order>
            </read:pallet>
         </read:export>
      </read:notifyRequest>
.....

<types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://app.ru/some">
  <xsd:complexType name="ItemType">
    <xsd:attribute name="id" type="xsd:string" use="required"/>
    <xsd:attribute name="scancode" type="xsd:string"/>
  </xsd:complexType>
  <xsd:complexType name="ParcelType">
    <xsd:sequence>
      <xsd:element maxOccurs="unbounded" minOccurs="1" name="item" type="tns:ItemType"/>
    </xsd:sequence>
    <xsd:attribute name="scancode" type="xsd:string" use="required"/>
    <xsd:attribute name="weight" type="xsd:string" use="optional"/>
    <xsd:attribute name="height" type="xsd:string" use="optional"/>
  </xsd:complexType>
  <xsd:complexType name="OrderType">
    <xsd:sequence>
      <xsd:element maxOccurs="unbounded" minOccurs="1" name="parcel" type="tns:ParcelType"/>
    </xsd:sequence>
    <xsd:attribute name="nr" type="xsd:string" use="required"/>
  </xsd:complexType>
  <xsd:complexType name="PalletType">
    ......
  </xsd:complexType>
  <xsd:complexType name="ExportType">
    ......
  </xsd:complexType>
  <xsd:element name="notifyRequest">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="export" type="tns:ExportType"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="notifyResponse">
    <xsd:complexType>
      <xsd:sequence/>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
</types>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question