快生活 - 生活常识大全

请求接口


  搞了一天差点累死,最后让一个朋友给帮忙搞了下入口,记录一下
  总体总结 被这个关键字搞死了,卡了一天:(Add Doctor Import)
  google如下:
  http://stackoverflow.com/questions/4719854/soap-suds-and-the-dreaded-schema-type-not-found-error
  具体内容如下:
  由于上面这个关键字,发送webservice请求,老报TypeNotFound 下图:
  由于以前没有用rf做过这鸟玩意,都是lr来搞的,所以日志看着有点晕:最蛋疼的是这个还不用加头信息…加了还报错…
  具体脚本如下:
  *** Settings ***
  Library SudsLibrary(请求webservice的库)
  Library Collections
  Library test.py
  *** Test Cases ***
  test3
  Comment Add Doctor Import http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd filters=http://WebXml.com.cn/
  Create Soap Client http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?WSDL
  ${result}= Call Soap Method getSupportCity 上海
  Log ${result}
  ${result}= Call Soap Method getSupportProvince
  Log ${result}
  ${result}= Call Soap Method getWeatherbyCityName 上海
  Log ${result}
  这是post请求,get的请求直接根据http的接口来就行了,如果加请求头报错,就不要加试试
  还做了一个不用加入add doctor import关键字的webservice接口:
  脚本如下:
  *** Settings ***
  Library SudsLibrary
  Library Collections
  Library test.py
  *** Test Cases ***
  test
  Create Soap Client http://www.webservicex.net/Statistics.asmx?WSDL
  #只有wsdl定义为complextype才需要create wsdl object
  ${dblarray}= Create Wsdl Object ArrayOfDouble
  attribute ${dblarray}
  Append To List ${dbl array.double} 3.0
  Append To List ${dbl array.double} 2.0
  log ${dblarray}
  ${result}= Call Soap Method GetStatistics ${dblarray}
  attribute ${result}
  Should Be Equal As Numbers ${result.Average} 2.5
  Should Be Equal As Numbers ${result.Sums} 5.0
  创建了一个wsdl对象, 可以根据报错信息来判断参数的类型:
  话不多说,工作了…
网站目录投稿:友露