ruoyu82 发表于 2009-6-3 10:34:28

脚本只能运行一遍,运行两边遍时就出错,请问是什么原因呢?

录制的脚本如下:
Action()
{
        web_service_call( "StepName=SearchRestaurants_103",
                "SOAPMethod=ContentService.IContentService.SearchRestaurants",
                "ResponseParam=response",
                "WSDL=http://10.10.50.65/LBCMSLite?WSDL",
                "UseWSDLCopy=1",
                "Snapshot=t1243933951.inf",
                BEGIN_ARGUMENTS,
                "Culture=en-GB",
                "MaximumResults=100",
                "StartIndex=0",
                "xml:Search=<Search><For><CompanyNumber>C-001</CompanyNumber></For>"
                                "<ReturnDeleted>1</ReturnDeleted><ReturnDisabled>1</ReturnDisabled></Search>",
                END_ARGUMENTS,
                BEGIN_RESULT,
                "Restaurant/Id=Param_Id",
                END_RESULT,
                LAST);
        lr_think_time(3);
        return 0;
}
奇怪的是如果用两个用户迭代一次或者一个用户迭代两次执行,都会报错:提示不能输入多个companynumber(程序里设计的只能传递一个)。当用一个用户迭代一次就没有问题,是不是有缓存需要清除?还是别的什么原因,希望大家给予一些帮助,谢谢啦~

ruoyu82 发表于 2009-6-3 11:04:29

:'( 怎么没有人回答呀?

iori 发表于 2009-6-3 11:40:14

回放日志看看

ruoyu82 发表于 2009-6-3 12:24:46

Log如下,不知道问什么第二次迭代时就会报:红色部分显示的错
Virtual User Script started
Starting action vuser_init.
Ending action vuser_init.
Running Vuser...
Starting iteration 1.Starting action Action.
Action.c(6): Web service call "SearchRestaurants_103" started
Action.c(6): Using working copy of the WSDL file "http://10.10.50.65/LBCMSLite?WSDL"
Action.c(6): Using client emulation General
Action.c(6): Removed Web headers not matching the emulated client
Action.c(6): Notice: "CompanyNumber" was selected as the optional <choice> element.Action.c(6): t=1385ms: 148-byte response headers for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
Action.c(6):   HTTP/1.1 200 OK\r\n
Action.c(6):   Content-Length: 2472\r\n
Action.c(6):   Content-Type: text/xml; charset=utf-8\r\n
Action.c(6):   Server: Microsoft-HTTPAPI/1.0\r\n
Action.c(6):   Date: Wed, 03 Jun 2009 04:03:57 GMT\r\n
Action.c(6):   \r\n
Action.c(6): t=1434ms: 2472-byte response body for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
Action.c(6):   <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body xmlns:xsi="http://
Action.c(6):   www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SearchRe
Action.c(6):   staurantResponse xmlns="http://schemas.livebookings.net/services/cms/1/0/"><Restaurant><Id
Action.c(6):   >88</Id(此处省略了一些数据信息)
Action.c(6): Web service call "SearchRestaurants_103" was successful
Ending action Action.
Ending iteration 1.
Starting iteration 2.Starting action Action.
Action.c(6): Web service call "SearchRestaurants_103" started
Action.c(6): Using working copy of the WSDL file "http://10.10.50.65/LBCMSLite?WSDL"
Action.c(6): Using client emulation General
Action.c(6): Removed Web headers not matching the emulated client
Action.c(6): Error: More than one element was selected for <choice>. You can choose only one element. Defaulting to a soap_request.Action.c(6): t=2233ms: 167-byte response headers for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
Action.c(6):   HTTP/1.1 500 Internal Server Error\r\n
Action.c(6):   Content-Length: 4480\r\n
Action.c(6):   Content-Type: text/xml; charset=utf-8\r\n
Action.c(6):   Server: Microsoft-HTTPAPI/1.0\r\n
Action.c(6):   Date: Wed, 03 Jun 2009 04:03:57 GMT\r\n
Action.c(6):   \r\n
Action.c(6): t=2308ms: 4480-byte response body for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
Action.c(6):   <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcod
Action.c(6):   e xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatc
Action.c(6):   her">a:InternalServiceFault</faultcode><faultstring xml:lang="zh-CN">Error in deserializin
Action.c(6):   g body of request message for operation 'SearchRestaurants'.</faultstring><detail><Excepti
Action.c(6):   onDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http
Action.c(6):   ://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException><HelpLink i
Action.c(6):   :nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException i:nil="true"/><Messag
Action.c(6):   e>Start element 'For' does not match end element 'Search'. Line 1, position 424.</Message>
Action.c(6):   <StackTrace>   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader read
Action.c(6):   er, String res, String arg1, String arg2, String arg3)&#xD;\n
Action.c(6):      at System.Xml.XmlExceptionHelper.ThrowTagMismatch(XmlDictionaryReader reader, String ex
Action.c(6):   pectedPrefix, String expectedLocalName, String foundPrefix, String foundLocalName)&#xD;\n
Action.c(6):      at System.Xml.XmlUTF8TextReader.ReadEndElement()&#xD;\n
Action.c(6):      at System.Xml.XmlUTF8TextReader.Read()&#xD;\n
Action.c(6):      at System.Xml.XmlBaseReader.ReadStartElement()&#xD;\n
Action.c(6):      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIContentService.
Action.c(6):   Read5_Item(Boolean isNullable, Boolean checkType)&#xD;\n
Action.c(6):      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIContentService.
Action.c(6):   Read6_SearchRestaurantRequestSearch(Boolean isNullable, Boolean checkType)&#xD;\n
Action.c(6):      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIContentService.
Action.c(6):   Read58_SearchRestaurantRequest()&#xD;\n
Action.c(6):      at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer5.Deserialize(X
Action.c(6):   mlSerializationReader reader)&#xD;\n
Action.c(6):      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encod
Action.c(6):   ingStyle, XmlDeserializationEvents events)</StackTrace><Type>System.Xml.XmlException</Type
Action.c(6):   ></InnerException><Message>There is an error in XML document (1, 424).</Message><StackTrac
Action.c(6):   e>   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String enc
Action.c(6):   odingStyle, XmlDeserializationEvents events)&#xD;\n
Action.c(6):      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encod
Action.c(6):   ingStyle)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDi
Action.c(6):   ctionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescri
Action.c(6):   ption returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean
Action.c(6):      isRequest)</StackTrace><Type>System.InvalidOperationException</Type></InnerException><Mes
Action.c(6):   sage>Error in deserializing body of request message for operation 'SearchRestaurants'.</Me
Action.c(6):   ssage><StackTrace>   at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.Des
Action.c(6):   erializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer,
Action.c(6):      MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] p
Action.c(6):   arameters, Boolean isRequest)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDi
Action.c(6):   ctionaryReader reader, MessageVersion version, String action, MessageDescription messageDe
Action.c(6):   scription, Object[] parameters, Boolean isRequest)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message me
Action.c(6):   ssage, Object[] parameters, Boolean isRequest)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message
Action.c(6):   , Object[] parameters)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc
Action.c(6):   &amp; rpc)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;
Action.c(6):   rpc)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&a
Action.c(6):   mp; rpc)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&a
Action.c(6):   mp; rpc)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&a
Action.c(6):   mp; rpc)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&a
Action.c(6):   mp; rpc)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&a
Action.c(6):   mp; rpc)&#xD;\n
Action.c(6):      at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</St
Action.c(6):   ackTrace><Type>System.ServiceModel.CommunicationException</Type></ExceptionDetail></detail
Action.c(6):   ></s:Fault></s:Body></s:Envelope>
Action.c(6): Warning: HTTP status code 500 returned by the server
Action.c(6): Error: The reason for the SOAP fault is:        "Error in deserializing body of request message for operation 'SearchRestaurants'."
Action.c(6): Error: Web service call "SearchRestaurants_103" execution failed
Ending action Action.
Ending iteration 2.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.

Corelli 发表于 2009-6-3 15:54:26

Action.c(6): Error: More than one element was selected for <choice>. You can choose only one element. Defaulting to a soap_request.Action.c(6): t=2233ms: 167-byte response headers for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
Action.c(6):   HTTP/1.1 500 Internal Server Error\r\n

从这基本可以确定是参数问题,确认一下你的参数值的规则和参数来源吧,即你的这个参数同一个值能否重复使用,及你的参数值是服务器给你的还是你自己定义的。

ruoyu82 发表于 2009-6-4 11:17:59

回复 6# 的帖子

感谢您的回复,choice类型是要求一次只能传递一个参数的。参数的值是我设置的。
我觉得好像第二次迭代时,应该是loadrunner传了两个companyNumber,所以才会给出这样的提示。
我重新定义了参数:改为unique+each iteration类型,定义了两个值C-001和c-002。运行后log如下:
g iteration 1.
Starting action Action.
Action.c(5): Web service call "SearchRestaurants_101" started
Action.c(5): Using working copy of the WSDL file "D:/CMS/LBCMSLite.wsdl"
Action.c(5): Using client emulation General
Action.c(5): Removed Web headers not matching the emulated client
Action.c(5): Notify: Parameter Substitution: parameter "NewParam" ="C-001"
Action.c(5): Notice: "CompanyNumber" was selected as the optional <choice> element.
........
Action.c(5): Web service call "SearchRestaurants_101" was successful
Ending action Action.
Ending iteration 1.
Starting iteration 2.
t=3885ms: Closed connection to 10.10.50.65:80 after completing 1 request       
Notify: Next row for parameter NewParam = 2 .
Notify: Getting new value for parameter 'NewParam': table = 'NewParam.dat' column = '0' row = '2'.
Starting action Action.
Action.c(5): Web service call "SearchRestaurants_101" started
Action.c(5): Using working copy of the WSDL file "D:/CMS/LBCMSLite.wsdl"
Action.c(5): Using client emulation General
Action.c(5): Removed Web headers not matching the emulated client
Action.c(5): Notify: Parameter Substitution: parameter "NewParam" ="c-002"
Action.c(5): Error: More than one element was selected for <choice>. You can choose only one element. Defaulting to a soap_request.
从log里看第二次迭代开始的时候定位参数的取值,然后给参数取了c-002,但是如果仅是一个参数的话,不应该会报error的呀,应该是把第一次迭代的companyNumber也试图传递给服务器造成的吧,但是为什么要传第一次迭代的companyNumber呢?不太明白,希望大家不吝赐教...
页: [1]
查看完整版本: 脚本只能运行一遍,运行两边遍时就出错,请问是什么原因呢?