简体   繁体   中英

Python & Suds. How can I get all required parameters of a webservice using suds?

I want to invoke a webservice. It has four parameters. The "param1" and "param2" don't have the attribute minOccurs="0", so these two are required.The "param3" and "param4" have the attribute minOccurs="0", so these two are optional.My questions is how to get this information through suds or can we get this information just through a XML parser?

<xsd:element name="param1" type="xsd:string"/>
<xsd:element name="param2" type="xsd:string"/>
<xsd:element name="param3" minOccurs="0" type="xsd:string"/>
<xsd:element name="param4" minOccurs="0" type="xsd:string"/>

I understood that you need details of arguments and functions. It can be achieved using below code

    url = YOUR WDSL URL
    user = 'admin'
    pw = 'admin'
    t = HttpAuthenticated(username=user, password=pw)
    client = Client(url, transport=t)

    print client #This will print detail about WSDL i.e. function names, argment, argument types, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM