Python&;suds-如何获取有关方法参数类型的信息?

Python&;suds-如何获取有关方法参数类型的信息?,python,soap,suds,Python,Soap,Suds,我使用sud从Python代码中调用SOAP API中的方法。我试图通过编程确定将哪些信息作为参数发送到API中的方法。我正在研究的WSDL之一是 该WSDL中定义了一个具有以下签名的方法: GetActiveDirectoryObjects(FilterOptions filterOptions) 我可以使用suds为这个WSDL创建一个客户端,然后我可以使用client.factory.create()方法,如下所示: from suds.client import Client clie

我使用sud从Python代码中调用SOAP API中的方法。我试图通过编程确定将哪些信息作为参数发送到API中的方法。我正在研究的WSDL之一是

该WSDL中定义了一个具有以下签名的方法:

GetActiveDirectoryObjects(FilterOptions filterOptions)
我可以使用suds为这个WSDL创建一个客户端,然后我可以使用client.factory.create()方法,如下所示:

from suds.client import Client
client = Client('https://controlpanel.msoutlookonline.net/WebServices/ActiveDirectory/ActiveDirectoryService.asmx?WSDL')
client.factory.create('FilterOptions')
输出为:

(FilterOptions){
   AttributesToRead =
      (ArrayOfString){
         string[] = <empty>
      }
   SortBy = None
   SortDirection =
      (SortDirection){
         value = None
      }
   ResultSize = None
   Filter =
      (AndOperation){
         ExtensionData = None
      }
   SearchBase = None
 }
(过滤器选项){
属性读取=
(ArrayOfString){
字符串[]=
}
SortBy=无
排序=
(排序方向){
值=无
}
结果大小=无
滤器=
(和操作){
ExtensionData=None
}
SearchBase=None
}
我搞不清楚的是,我如何使用sud来确定“SortBy”是想被分配一个字符串还是int或boolean,或者什么。我知道'AttributesToRead'需要分配一个'ArrayOfString'。我知道'SortDirection'想要分配一个'SortDirection'类型的对象。但是SearchBase呢?结果大小?我的程序如何确定自动生成的表单是否应该包含一个字段,该字段将验证int、boolean或字符串

查看WSDL XML,我看到以下内容:

<s:complexType name="FilterOptions">
    <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="AttributesToRead" type="tns:ArrayOfString"/>
        <s:element minOccurs="0" maxOccurs="1" name="SortBy" type="s:string"/>
        <s:element minOccurs="1" maxOccurs="1" name="SortDirection" type="tns:SortDirection"/>
        <s:element minOccurs="0" maxOccurs="1" name="ResultSize" type="s:string"/>
        <s:element minOccurs="0" maxOccurs="1" name="Filter" type="tns:AndOperation"/>
        <s:element minOccurs="0" maxOccurs="1" name="SearchBase" type="s:string"/>
    </s:sequence>
</s:complexType>

因此,通过手动读取XML,我知道'SortBy'希望被分配一个字符串——但是我如何使用sud以编程方式解决这个问题呢?我不想花上几天的时间编写解析XML的代码来找出这一点,因为编写肥皂水的人已经严格遵守了SOAP规范——但让肥皂水告诉我“SortBy”应该是“string”类型的秘密是什么呢?

我想答案是肯定的。priv_el.name priv_el.type