Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem when iterating a context-node

Hi Experts,

I have the following context-structure in my WebDynpro-View (generated by WebService-Wizard):

+ Context
-----+ filterApps (0..n)
---------+ ResponseFilterApps (0..1)
---------------+ ResultFilterApps (0..n)
--------------------+ hwCompFilterApps (0..1)
--------------------+ swCompFilterApps (0..1)
-------------------------+ anwendungstitel (String)
-------------------------+ bezeichnung (String)

The cardinalities respectively datatypes are given in brackets (btw: I do not have any idea why the cardinality of "filterApps" is (0..n) - in other applications I have developped this is (0..1) - but does not seem to be a problem because the node's size() is 1).

After calling my WebService I receive 85 results, so the size() of node "ResultFilterApps" is as expected 85.

But traversing the node makes problems (see below). Here is my code:

IResultFilterAppsNode source = wdContext.nodeResultFilterApps();
System.err.println("size = " + source.size());
Iterator iter = source.iterateChildNodes();
int ix = 0;
while (iter.hasNext()) {
   ISwCompFilterAppsNode myNode = (ISwCompFilterAppsNode);
   System.err.println("accessing element " + ix);

This code results in following output:

size = 85
accessing element 1

Why does the iterator only contain 1 element instead of 85 elements?

Surprisingly I can call


This gives me the content of value attribute "anwendungstitel" of the first result delivered by my WebService.



is ok, but calling


leads to an IndexOutOfBoundsException.

What goes wrong? I am working with 2004s.

Thanks for every hint,


Former Member
Not what you were looking for? View more on this topic or Ask a question