Page 1 of 2

Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Mon Sep 09, 2013 11:24 pm
by MobileBen

I have a web service with an XML response mapped to a List element. Works great when the service returns more than 2 items. When the service returns 0 items, I get an error in appery.js (SCRIPT5007: Unable to get property 'length' of undefined or null reference appery.js, line 1000 character 21 ) and the service hangs. Note, when no items are returned, the XML response does not include the node for the array that is mapped to the List element.

When the service returns 1 item, the List item does not get populated either but no errors are logged. Have javascript on the list item and it is never invoked, thus assuming the mapping is not honored when one item is returned. The record Count attribute in the response and the XML response on the wire confirms the XML contains one item.

All of this worked when I had the service mapped to a Grid.

Is there something special about List elements when mapped to a service response?

What is expected behavior if XML response does not have the "array" that is mapped to the List element? I would expect the "code-behind JS" on the fields that do exist (such as a record count field in the XML response header) to be executed so that the situation can be properly dealt with. And in this case, expect the service
to return success or complete, as long as it returns and doesn't hang.

Thank you for your attention to this matter.


Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Mon Sep 09, 2013 11:43 pm
by Alena Prykhodko

Hello!

Could you please tell steps to reproduce (service URL, mapping screen shot)? If you don't want make it public email to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a.


Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Thu Sep 12, 2013 1:46 pm
by MobileBen

Hi Alena,

Can I share the app with you without sharing with the community?

Thanks,
Ben


Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Thu Sep 12, 2013 1:57 pm
by Kateryna Grynko

Hi,

Yes, please take a look at here: http://docs.appery.io/documentation/s...
You can add a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a on your share tab so only our team can access the app.


Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Fri Sep 13, 2013 1:25 pm
by MobileBen

I have shared the project with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a. Thank you.


Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Fri Sep 13, 2013 1:31 pm
by MobileBen

See the SearchService mapping on the searchScreen.

Enter the search term aa to see the proper behavior when more than 1 record is found.

Enter the search term qxqx to see the hang when no records are found.

Enter the search term 039800068194 to see the behavior of not populating the list item when one record is returned.

Thanks again.


Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Fri Sep 13, 2013 1:34 pm
by MobileBen

To try the searches above, tap the log in toggle, then tap the login button (no username/password currently required), then tap the "Shop" option and you'll see the search bar.


Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Fri Sep 13, 2013 6:52 pm
by Kateryna Grynko

Hi,

In case when search result is empty the response structure is corrupted. If this is your service then correct it please. If no you can try using Generic service.


Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Sat Sep 14, 2013 3:36 pm
by MobileBen

Hi Katya,

You are correct, the service response is corrupted. But the service call should not hang. I would expect the service call to fail with an error code. What do you think?

Thanks,
Ben


Service Response Mapped to List Element Fails When 0 or 1 Items Returned

Posted: Sat Sep 14, 2013 3:37 pm
by MobileBen

Also, any thoughts on the case when 1 item is returned?