Hi Bob
this sample from sample.addressbook.rpcclient.AddressBookRPCClient.java
displays a name called William Tecumseh Sherman which must be found in bean
class Entry
import sample.addressbook.entry.Entry;
//can we assume your published service has a method called getHistory ???
// QName opGetHistory =new QName("http://ws.alerthistorysvc.cps.app.com/xsd",
"getHistory");
QName opFindEntry = new QName("http://service.addressbook.sample/xsd",
"findEntry");
//we need to find a name
String name = "William Tecumseh Sherman";
//your getHistoryArgs has no name ..we dont know if we should find sherman,
grant or someone else
//Object[] opGetHistoryArgs = new Object[] { };
Object[] opFindEntryArgs = new Object[] { name };
//return an array of entry beans
Class[] returnTypes = new Class[] { Entry.class };
//use serviceClient to find name of Abby Cadabby from beans and return array of
entry
Object[] response = serviceClient.invokeBlocking(opFindEntry,
opFindEntryArgs, returnTypes);
//get the first one
Entry result = (Entry) response[0];
if (result == null) {
System.out.println("No entry found for " + name);
return;
}
//use the accessors of the returned bean to access the values of the attributes
System.out.println("Name :" + result.getName());
System.out.println("Street :" + result.getStreet());
System.out.println("City :" + result.getCity());
System.out.println("State :" + result.getState());
System.out.println("Postal Code :" + result.getPostalCode());
HTH/
Martin
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: Bob Rhodes
To: [email protected]
Sent: Friday, May 11, 2007 9:23 AM
Subject: Newbie pojo Complex type question
I'm new here so forgive my ignorance for a moment. I have followed the Axis2
pojo examples and have created and deployed my own service and client
(RPCClient). For simple things like getting and setting properties on a pretty
dumb little pojo, things seem ok, but I'm having issues now that I'm trying to
implement axis2 into one of my webapps.
In summary, my service creates an instance of a class called History that
goes to the db and gets some data,the puts that data in instances of a class
called HistoryItem which get put into a List. The service class method List
getHistory() calls history.getHistory() to do the work and returns the List of
HistoryItem objects. This all works fine up to the point the list is about to
be returned. I'm getting an error when I run the client that says
"org.apache.axis2.AxisFault: Mapping qname not fond for the package:
com.app.csp.alerthistorysvc.beans"
Q 1. How do I define a custom type mapping, and do I need to do this? The
AlertHistory object is just a plain old data object with strings and
gettters/setters.
Q 2. Do I have a problem because I'm defining my return types properly?
See example:
QName opGetHistory =
new QName("http://ws.alerthistorysvc.cps.app.com/xsd", "getHistory");
Object[] opGetHistoryArgs = new Object[] { };
Class[] returnTypes = new Class[] { List.class }; // should this be
List.class,HistoryItem.class ?
Object[] response =
serviceClient.invokeBlocking(opGetHistory,opGetHistoryArgs, returnTypes); //
exception happens here.
Object result = response[0];
Other calls to the service, before this one, work without a hitch.
Any ideas?
Thanks!
B
_____________________________________________________
You can't wait for inspiration. You have to go after it with a club.
Jack London
------------------------------------------------------------------------------
The information contained in this e-mail message is intended only for the
personal and confidential use of the recipient(s) named above. This message may
be an attorney-client communication and/or work product and as such is
privileged and confidential. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended recipient,
you are hereby notified that you have received this document in error and that
any review, dissemination, distribution, or copying of this message is strictly
prohibited. If you have received this communication in error, please notify us
immediately by e-mail, and delete the original message.