daijianfeng 发表于 2010-10-26 10:55:14

测试webservice时,运行脚本报错,求解决

1 Manage Services中我导入了wsdl的url;
2 Add Service Call中输入参数,此参数并非一个,而是一个数组(等于同时输入四个参数值)
运行脚本时,报错如下:
Virtual User Script started
Starting action vuser_init.
Web Services replay version 9.0.0 for WINXP; Toolkit: "Vugen"; build 1269
Run-Time Settings file: "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\noname3\\default.cfg"
Vuser directory: "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\noname3"
Vuser output directory: "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\noname3\"
LOCAL start date/time:2010-10-26 10:32:27
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(4): Notify: Parameter Substitution: parameter "NewParam" ="1,1,11,11"
Action.c(4): Web service call "saveLog_101" started
Action.c(4): Using working copy of the WSDL file "http://192.168.1.205:9080/ssolog/service/logput?wsdl"
Action.c(4): Using client emulation General
Action.c(4): Removed Web headers not matching the emulated client
Action.c(4): "Content-Type: text/xml; charset=utf-8" header registered for adding to requests from the immediately following Action function       
Action.c(4): "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.573)" header registered for adding to requests from the immediately following Action function       
Action.c(4): "SOAPAction: """ header registered for adding to requests from the immediately following Action function       
Action.c(4): t=601ms: Connecting to host 192.168.1.205:9080       
Action.c(4): t=604ms: Connected socket from 192.168.0.123:13227 to 192.168.1.205:9080 in 1 ms       
Action.c(4): t=605ms: 330-byte request headers for "http://192.168.1.205:9080/ssolog/service/logput" (RelFrameId=1, Internal ID=1)
Action.c(4):   POST /ssolog/service/logput HTTP/1.1\r\n
Action.c(4):   Content-Type: text/xml; charset=utf-8\r\n
Action.c(4):   Cache-Control: no-cache\r\n
Action.c(4):   User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.57
Action.c(4):   3)\r\n
Action.c(4):   SOAPAction: ""\r\n
Action.c(4):   Accept-Encoding: gzip, deflate\r\n
Action.c(4):   Accept: */*\r\n
Action.c(4):   Connection: Keep-Alive\r\n
Action.c(4):   Host: 192.168.1.205:9080\r\n
Action.c(4):   Content-Length: 342\r\n
Action.c(4):   \r\n
Action.c(4): t=626ms: 342-byte request body for "http://192.168.1.205:9080/ssolog/service/logput" (RelFrameId=1, Internal ID=1)
Action.c(4):   <?xml version="1.0"encoding="UTF-8" standalone="no"?><soap:Envelope xmlns:soap="http://s
Action.c(4):   chemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x
Action.c(4):   mlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><saveLog xmlns="http://action.log.t
Action.c(4):   rueway.cn/"><arg0>1,1,11,11</arg0></saveLog></soap:Body></soap:Envelope>
Action.c(4): t=679ms: 228-byte response headers for "http://192.168.1.205:9080/ssolog/service/logput" (RelFrameId=1, Internal ID=1)
Action.c(4):   HTTP/1.1 500 Internal Server Error\r\n
Action.c(4):   Content-Type: text/xml; charset=UTF-8\r\n
Action.c(4):   Content-Language: en-US\r\n
Action.c(4):   Transfer-Encoding: chunked\r\n
Action.c(4):   Connection: Close\r\n
Action.c(4):   Date: Tue, 26 Oct 2010 02:26:42 GMT\r\n
Action.c(4):   Server: WebSphere Application Server/6.1\r\n
Action.c(4):   \r\n
Action.c(4): t=698ms: 5-byte chunked response overhead for "http://192.168.1.205:9080/ssolog/service/logput" (RelFrameId=1, Internal ID=1)
Action.c(4):   142\r\n
Action.c(4): t=701ms: 2-byte chunked response overhead for "http://192.168.1.205:9080/ssolog/service/logput" (RelFrameId=1, Internal ID=1)
Action.c(4):   \r\n
Action.c(4): t=705ms: 322-byte chunked response body for "http://192.168.1.205:9080/ssolog/service/logput" (RelFrameId=1, Internal ID=1)
Action.c(4):   <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fau
Action.c(4):   lt><faultcode>soap:Client</faultcode><faultstring>Unmarshalling Error: unexpected element
Action.c(4):   (uri:"http://action.log.trueway.cn/", local:"arg0"). Expected elements are &lt;{}arg0> </f
Action.c(4):   aultstring></soap:Fault></soap:Body></soap:Envelope>
Action.c(4): t=712ms: 5-byte chunked response overhead for "http://192.168.1.205:9080/ssolog/service/logput" (RelFrameId=1, Internal ID=1)
Action.c(4):   0\r\n
Action.c(4):   \r\n
Action.c(4): t=722ms: Closing connection to server 192.168.1.205 - server indicated that the connection should be closed       
Action.c(4): t=723ms: Closed connection to 192.168.1.205:9080 after completing 1 request       
Action.c(4): t=725ms: Request done "http://192.168.1.205:9080/ssolog/service/logput"       
Action.c(4): Error: The reason for the SOAP fault is:        "Unmarshalling Error: unexpected element (uri:"http://action.log.trueway.cn/", local:"arg0"). Expected elements are &lt;{}arg0> "
Action.c(4): Notify: Saving Parameter "response = <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Unmarshalling Error: unexpected element (uri:"http://action.log.trueway.cn/", local:"arg0"). Expected elements are &lt;{}arg0> </faultstring></soap:Fault></soap:Body></soap:Envelope>"
Action.c(4): Error: Web service call "saveLog_101" execution failed
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.

daijianfeng 发表于 2010-10-26 11:04:48

本帖最后由 daijianfeng 于 2010-10-26 11:15 编辑

沙发自己坐,等答案……

msnshow 发表于 2010-10-26 21:08:21

看着晕

daijianfeng 发表于 2010-10-29 10:50:02

看着晕
msnshow 发表于 2010-10-26 21:08 http://bbs.51testing.com/images/common/back.gif
现在不报错了,
但是我调用webservice,数据写不进数据库

daijianfeng 发表于 2010-10-29 11:00:27

现在不报错了,
但是我调用webservice,数据写不进数据库
daijianfeng 发表于 2010-10-29 10:50 http://bbs.51testing.com/images/common/back.gif
数据为数组4个值

archonwang 发表于 2010-10-29 11:34:53

楼主,方便吧你的脚本和wsdl内容贴出来看下么?

daijianfeng 发表于 2010-10-29 11:44:10

楼主,方便吧你的脚本和wsdl内容贴出来看下么?
archonwang 发表于 2010-10-29 11:34 http://bbs.51testing.com/images/common/back.gif
wsdl内容:
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions name="LogPutImplService" targetNamespace="http://impl.action.log.trueway.cn/" xmlns:ns1="http://action.log.trueway.cn/" xmlns:ns2="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://impl.action.log.trueway.cn/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:import location="http://192.168.0.0:9080/ssolog/service/logput?wsdl=LogPut.wsdl" namespace="http://action.log.trueway.cn/" />
- <wsdl:binding name="LogPutImplServiceSoapBinding" type="ns1:LogPut">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="saveLog">
<soap:operation soapAction="" style="document" />
- <wsdl:input name="saveLog">
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output name="saveLogResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="LogPutImplService">
- <wsdl:port binding="tns:LogPutImplServiceSoapBinding" name="LogPutImplPort">
<soap:address location="http://192.168.0.0:9080/ssolog/service/logput" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Sevice Call脚本:
Action()
{

         

      web_service_call( "StepName=saveLog_106",
                "SOAPMethod=LogPutImplService.LogPut.saveLog",
                "ResponseParam=response",
                "Service=LogPutImplService",
                "Snapshot=t1288323314.inf",
                BEGIN_ARGUMENTS,
                "arg0={test}",
                END_ARGUMENTS,
                BEGIN_RESULT,
                END_RESULT,
                LAST);


}

我解释下:arg0这个变量其实是a,b,c,d四个变量,比如说把“a=51testing、 b=123、 c=123、 d=123”写入数据库

msnshow 发表于 2010-10-30 09:14:02

看一下应用程序的LOG中有没有错误提示

archonwang 发表于 2010-11-1 13:42:08

怀疑是参数的格式不正确。

      web_service_call( "StepName=saveLog_106",
                "SOAPMethod=LogPutImplService.LogPut.saveLog",
                "ResponseParam=response",
                "Service=LogPutImplService",
                "Snapshot=t1288323314.inf",
                BEGIN_ARGUMENTS,


                "arg0={test}",-------------这里的参数格式怀疑不正确,在调试时尝试使用全日志看下。让开发协助一起检查下。另外,似乎参数化时是不能进行变量嵌套的。


                END_ARGUMENTS,
                BEGIN_RESULT,
                END_RESULT,
                LAST);

qzj_test 发表于 2010-11-1 17:09:29

{:4_83:}

daijianfeng 发表于 2010-11-5 13:35:50

怀疑是参数的格式不正确。

      web_service_call( "StepName=saveLog_106",
                "SOAP ...
archonwang 发表于 2010-11-1 13:42 http://bbs.51testing.com/images/common/back.gif

我就是认为参数不对,我就是不知道怎么处理这个问题

ganlan 发表于 2010-11-5 15:29:02

参数格式不对的话,系统是处理失败的
但是返回的结果LR识别是正常的,所以不报错,此时应该看下应用系统的日志,看是什么报错。
页: [1]
查看完整版本: 测试webservice时,运行脚本报错,求解决