Hello ,
I am doing Performance testing on HP Load Runner using java over http protocol . I need to fetch the xml elements we got in the response xml using lr2.feildGetter() function . My xml has a List from which I need to get the value of the elements . I am attaching the screen shot of the xml ( as the xml is too big) . I need to find the value of first or last zeilenOid in the list( see the screen shot of the xml ,zeilenOid is at the last) . I have got the value of other elements in the xml which are not in the list but not able to fetch the list elements .
Below is the snippet of the code where I am getting the value of the other elements in the xml :
//This is autogenerated script of Load runner
////////////////////// requestBody22.xml //////////////////////
RemoteInvocation RemoteInvocation_ladeListeInfo22 = (RemoteInvocation) JavaHTTP.readObject(RemoteInvocationBA18);
RemoteInvocationResult RemoteInvocationResult_ListeInfo22 = (RemoteInvocationResult) JavaHTTP.sendSerialized(RemoteInvocation_ladeListeInfo22, 22,
"ObjectsDeserializerDefaultImpl",
"ListenEditorAgent_5",
"URL={http}{hostName}/smaragd.tcm.server/remoting/ListenEditorAgent",
new String[]{
"Method=POST",
"Resource=0",
"RecContentType=application/x-java-serialized-object",
"Referer=",
"Mode=HTML",
"EncType=application/x-java-serialized-object",
LAST});// 22 is the number of the header file, record time response is at file responseBody22.xml
// Below code I have added to get the value of elements from the xml
ListeInfo resultObject = (ListeInfo) RemoteInvocationResult_ListeInfo22.getValue();
String nameEn = (String) lr2.fieldGetter(resultObject, "super.nameEn");
List lnkZeileList = (List) lr2.fieldGetter(resultObject, "super.lnkMatrix.lnkZeile");
//Till this I am getting the value of List object , but now while trying to get the elements of the list I am getting error with the below line :
long zOid = (long) lr2.fieldGetter(resultObject, "super.lnkMatrix.lnkZeile.zeilenOid");
// error I got at this line while replay:
Error: System.err: java.lang.NoSuchFieldException:zeilenOid Error
System.err: at lrapi.lr2.fieldGetter lr2.java:63) Error
System.err: at Actions.action(Actions.java:1055) Error
I can understand that to get the value from list , we need to give the index number of the element but that is also not working here. Can somebody tell me that how to retrieve the element from the list while using lr2.feildGetter() method?