Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Returning a Collection of "Foo" objects to PB from Java

11 views
Skip to first unread message

HG97TJ

unread,
Jul 21, 2008, 4:35:54 PM7/21/08
to Danie...@us.ing.com, howie....@us.ing.com
I have an object in Java, "Foo", that I can successfully return to my
PB Client app as a method return type using the EJBClient proxy. I
can also successfully call a method in the Java class from PB to
return a Collection of String values: getFooListSimple(). However
when I try to return a Collection of "Foo" objects from Java to PB I
get the following error message:

"Failed to find the proxy to represent the Java class: Foo.
It implements the following interfaces: java.io.Serializable.

So PB knows about the Foo object since it can return just a single
instance of the Foo object and return a List of Strings from the Foo
object, but why not a List of Foo's? The proxy clearly has a "Foo"
type defined in it's ejb_mapping. And I'm assuming since the
successful return of a single instance of Foo rules out any classpath
issues.

PB: version 9.01 b7066
jdk: 1.4

Any help is appreciated:


--------------------------------------------------------------------------------------------------------------------------------
Here's the code ...

//-----------------------
JAVA
//-----------------------

public class Foo implements Serializable {

private String firstName;
private String lastName;

public Foo (String first, String last) {
firstName = first;
lastName = last;
}

public String getLastName() {
return lastName;
}

public String getFirstName() {
return firstName;
}

public List getFooList() {
// *** this method call DOES NOT WORK from PB ***
List l = new ArrayList();
l.add(new Foo("Danny","Briere"));
l.add(new Foo("Simon","Gagne"));
l.add(new Foo("Martin","Biron"));
l.add(new Foo("Riley","Cote"));
return l;
}

public List getFooListSimple() {
// *** this method call DOES WORK from PB ***
List l = new ArrayList();
l.add("Danny Briere");
l.add("Simon Gagne");
l.add("Martin Biron");
l.add("Riley Cote");
return l;
}

}

//-----------------------
PB code
//-----------------------

lEJBConn = CREATE EJBConnection
lEJBConn.CreateJavaInstance(lConv, "Converter")

try
Foo f1, f2
List px_List
Iterator pbx_iterator
string firstName, lastName

f1 = lConv.getfoo()

px_List = f1.getfoolist()
pbx_iterator = px_List.iterator()

do while pbx_iterator.hasNext()
f2 = pbx_iterator.next_j()

firstName = f2.getfirstname()
lastName = f2.getlastname()
loop

catch (Exception e)
ls_cause = e.getmessage()
MessageBox("Exception", ls_cause)

end try

bede

unread,
Oct 10, 2008, 9:23:54 AM10/10/08
to
wrap the collection in a (single) class & provide public methods to manipulate the data


In article <1d3fed9d-a43f-445d...@d45g2000hsc.googlegroups.com>,
hgua...@yahoo.com says...

0 new messages