Reading array of objects in web api
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reading array of objects in web api
I'm having a response of web_api with array of objects.
It seems "ParseResponse" couldn't read end objects any help would appreciate.
Below is my inspection on parsed response variable...
There should be 2 contact_phone details objects include in response (as per SoapUI test)
method parameters are as below
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Check sample project from the <Users>\Public\Documents\TestComplete 12 Samples\Common\Web Service Testing\Functional Testing\ folder. It contains example of processing array returned as a result.
Does it help?
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks @AlexKaras
it is not straight forward. But could decipher after an hour and half.
If anybody comes across same problem below is the code
function test123(){ var wsCall, CnPhDetArray ; WebServices.XXXwsSoap.getContactPhone(28); wsCall = WebServices.CreateWebServiceInfoFromItem('XXXwsSoap'); var CnPhDetArray = wsCall.ParseResponse("getContactPhone",WebServices.XXXwsSoap.LastResponse); for(var i = 0; i <= VarArrayHighBound(CnPhDetArray.list.Contact_PhoneDetail, 1); i++) Log.Message("Array[" + aqConvert.IntToStr(i) + "] = " + CnPhDetArray.list.Contact_PhoneDetail(i).Phone_Number ); }
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Hm... I expected it to be more user-friendly... I did not provide code sample as I did not have TestComplete with Web Services project at hand at that moment, but I would try something like this:
-- As your service has more than one output parameter, call it as per https://support.smartbear.com/testcomplete/docs/app-testing/web/services/out-parameters-methods.html recommendations;
-- Assuming that returned data are in the Contact_PhoneDetail parameter (which is an array), I would expect this code:
Contact_PhoneDetail[i].Phone_Number;
(Though the above should be verified in debugger|code evaluation window)
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
