Roman_Zhuravskiy
@Roman_Zhuravskiy

Как получить родительский тип в wsdl используя suds?

Подскажите как мне создать корректный xml для отправки через sudl wsdl.
Моя проблема заключается в том что я не могу понять как достать
type="tns:ItemType" у методов. т.к при создании client.factory.create(types)
создаются такие элементы :
ParcelType: (ParcelType){
   item[] = <empty>
   _barcode = ""
   _weight = ""
   _volume = ""
 }

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


Как мы видим что для создания ParcelType мы должны создать ItemType и затем посунуть их
в item[].
Я хотел бы получить информацию type="tns:Type" что бы можно было создать дерево типов и
пройти от самого глубокого к самому верхнему типу. Подскажите как в 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>
  • Вопрос задан
  • 277 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы