webservice interface test third-party libraries and select the interface test Novice python3

First, the use python3 do webervice interface testing of third-party libraries to select suds-jurko library, you can download directly pip commands directly, can also be compressed in pypi official website to download the manual install

Second, after installation, import Client: from suds.client import Client. Send a request

Client suds.client Import from 

URL = 'http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl' 
Client Client = (URL) 
# webservice interface information print all 
print (client)

But the error may occur:

Traceback (most recent call last):
  File "E:/PycharmProjects/lianxiUItestSelenium/***.py", line 53, in <module>
    client = Client('http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl')
  File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\client.py", line 115, in __init__
    self.wsdl = reader.open(url)
  File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\reader.py", line 150, in open
    d = self.fn(url, self.options)
  File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\wsdl.py", line 159, in __init__
    self.build_schema()
  File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\wsdl.py", line 220, in build_schema
    self.schema = container.load(self.options)
  File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\xsd\schema.py", line 94, in load
    child.dereference()
  File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\xsd\schema.py", line 319, in dereference
    midx, deps = x.dependencies()
  File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\xsd\sxbasic.py", line 437, in dependencies
    e = self.__deref()
  File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\xsd\sxbasic.py", line 483, in __deref
    raise TypeNotFound(self.ref)
suds.TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'

Third, only need to filter out what address it. Import and Import can ImportDoctor

from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import

imp = Import('http://www.w3.org/2001/XMLSchema',location='http://www.w3.org/2001/XMLSchema.xsd')
imp.filter.add('http://WebXml.com.cn/')
doctor = ImportDoctor(imp)
client = Client('http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl',doctor=doctor)
print(client)

Output:

(WeatherWebServiceSoap)
   Methods (5):
        getSupportCity(xs:string byProvinceName)
        getSupportDataSet()
        getSupportProvince()
        getWeatherbyCityName(xs:string theCityName)
        getWeatherbyCityNamePro(xs:string theCityName, xs:string theUserID)

 

Guess you like

Origin www.cnblogs.com/vevian/p/11518943.html