MobileBen
Posts: 0
Joined: Sat Aug 10, 2013 7:56 pm

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

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.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

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

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.

MobileBen
Posts: 0
Joined: Sat Aug 10, 2013 7:56 pm

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

Hi Alena,

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

Thanks,
Ben

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

MobileBen
Posts: 0
Joined: Sat Aug 10, 2013 7:56 pm

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

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

MobileBen
Posts: 0
Joined: Sat Aug 10, 2013 7:56 pm

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

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.

MobileBen
Posts: 0
Joined: Sat Aug 10, 2013 7:56 pm

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

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

MobileBen
Posts: 0
Joined: Sat Aug 10, 2013 7:56 pm

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

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

MobileBen
Posts: 0
Joined: Sat Aug 10, 2013 7:56 pm

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

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

Return to “Issues”