|
使用 lr的2个ws函数, 测试 google web services api,都未成功,请教一下原因,这里都没有ui,都没有录制这1步~
请教一下测试web services的注意点,下面关键问题出在哪?
第1种方法:使用web_service_call函数
操作步骤
1 import wsdl->
2url --http://api.google.com/GoogleSearch.wsdl
3选择googlesearch
生成如下code
web_service_call( "StepName=doGoogleSearch_101",
"SOAPMethod=GoogleSearchService.GoogleSearchPort.doGoogleSearch",
"ResponseParam=response",
"WSDL=http://api.google.com/GoogleSearch.wsdl",
"Snapshot=t1130493553.inf",
BEGIN_ARGUMENTS,
"filter=true",
"ie=auto string",
"key=auto string",
"lr=auto string",
"maxResults=123456789",
"oe=auto string",
"q=auto string",
"restrict=auto string",
"safeSearch=true",
"start=123456789",
END_ARGUMENTS,
BEGIN_RESULT,
END_RESULT,
LAST);
4run code 出错
Error: server returned an incorrectly formatted SOAP response
Error: web_service_call "GetWeather_101" execution failed
第2种方法
直接采用
soap_request( "StepName=google",
"URL=http://api.google.com/search/beta2",
"SOAPEnvelope= "
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<soap:Envelope "
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\""
"xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\""
"xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">"
"<SOAP-ENV:Body>"
"<ns1:doGoogleSearch xmlns:ns1=\"urn:GoogleSearch\""
"SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<key xsi:type=\"xsd:string\">97GrH0RQFHJSfD4UmszftfzmEjtSPNya</key>"
"<q xsi:type=\"xsd:string\">shrdlu winograd maclisp teletype</q>"
"<start xsi:type=\"xsd:int\">0</start>"
"<maxResults xsi:type=\"xsd:int\">10</maxResults>"
"<filter xsi:type=\"xsd:boolean\">true</filter>"
"<restrict xsi:type=\"xsd:string\"></restrict>"
"<safeSearch xsi:type=\"xsd:boolean\">false</safeSearch>"
"<lr xsi:type=\"xsd:string\"></lr>"
"<ie xsi:type=\"xsd:string\">latin1</ie>"
"<oe xsi:type=\"xsd:string\">latin1</oe>"
"</ns1:doGoogleSearch>"
"</SOAP-ENV:Body>"
"</SOAP-ENV:Envelope>",
"Snapshot=t1.inf",
"ResponseParam=result",
LAST);
未报错~~返回 ~Warning: HTTP status code 500 returned by server(这个不知道是soap请求问题在哪?对web servics比较陌生) |
|