RE: Problem with complex classes in POJO
Hi, Neil Trying to change class "PollForNotificationsResponse" to something else. The reason may be when you generate client stub code, it may create same class name again. Also, I notice that you have "private boolean more". Try to use "private Boolean more". By the way, what version of axis2 do you use? I don't have any problem with the latest version. Let's me know if you still have problems From: Neil Youngman [mailto:neil.young...@wirefast.com] Sent: Tuesday, February 03, 2009 4:08 AM To: axis-user@ws.apache.org Subject: Problem with complex classes in POJO I'm trying to deploy a small service as a POJO. A method called getNotifications() should return an array of Strings and a boolean. Everything works just fine if I only return an array of Strings. To add a boolean I have created a bean that has the String array and the boolean as properties. This does not return any useful data. The Version that works looks like public String [] PollForNotifications( String account, String user, String password, int maxResults ) throws Exception, SQLException { ... String [] results = new String[notifications.size()]; notifications.toArray( results ); return results; } To add the boolean I create the following bean class public class PollForNotificationsResponse { private String[] notifications; private boolean more; public PollForNotificationsResponse() { notifications = new String [0]; more = false; } public String[] getNotifications() { return notifications; } public boolean isMore() { return more; } public void setNotifications( String[] p_Notifications ) { notifications = p_Notifications; } public void setMore( boolean p_More ) { more = p_More; } } and change the method to public PollForNotificationsResponse PollForNotifications( String account, String user, String password, int maxResults ) throws Exception, SQLException { ... String [] results = new String[notifications.size()]; notifications.toArray( results ); PollForNotificationsResponse response = new PollForNotificationsResponse(); response.setNotifications( results ); response.setMore( more > 0 ); return response; } and I no longer get any data back the result looks like Should this work? As far as I can see from the article http://www.developer.com/java/other/article.php/10936_3726461_2, I think it should work? Can anyone tell me why it might not work and how I can fix or trace the problem. Neil Neil Youngman Developer Wirefast Limited Wirefast provides secure corporate messaging services. See our messaging solutions at http://www.wirefast.com/ Please consider the environment. Does this email or attachment need to be printed? This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this email. Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system. Email transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of email transmission. Wirefast Limited is registered in England & Wales Company number: 03865860 Registered Office: 7/10 Chandos Street, Cavendish Square, London, W1G 9DQ <>
RE: Problem with complex classes in POJO
Deepal Jayasinghe has now provided the answer to this one. Axis2 (v1.4) does not support inner classes. I had declared the bean used to return the results as an inner class. Making it a regular class solved the problem. I hope this helps anyone else who encounters this problem. Neil Youngman -Original Message- From: Neil Youngman Sent: Tue 03-Feb-09 09:08 To: axis-user@ws.apache.org Subject: Problem with complex classes in POJO I'm trying to deploy a small service as a POJO. A method called getNotifications() should return an array of Strings and a boolean. Everything works just fine if I only return an array of Strings. To add a boolean I have created a bean that has the String array and the boolean as properties. This does not return any useful data. The Version that works looks like public String [] PollForNotifications( String account, String user, String password, int maxResults ) throws Exception, SQLException { ... String [] results = new String[notifications.size()]; notifications.toArray( results ); return results; } To add the boolean I create the following bean class public class PollForNotificationsResponse { private String[] notifications; private boolean more; public PollForNotificationsResponse() { notifications = new String [0]; more = false; } public String[] getNotifications() { return notifications; } public boolean isMore() { return more; } public void setNotifications( String[] p_Notifications ) { notifications = p_Notifications; } public void setMore( boolean p_More ) { more = p_More; } } and change the method to public PollForNotificationsResponse PollForNotifications( String account, String user, String password, int maxResults ) throws Exception, SQLException { ... String [] results = new String[notifications.size()]; notifications.toArray( results ); PollForNotificationsResponse response = new PollForNotificationsResponse(); response.setNotifications( results ); response.setMore( more > 0 ); return response; } and I no longer get any data back the result looks like Should this work? As far as I can see from the article http://www.developer.com/java/other/article.php/10936_3726461_2, I think it should work? Can anyone tell me why it might not work and how I can fix or trace the problem. Neil Neil Youngman Developer Wirefast Limited Wirefast provides secure corporate messaging services. See our messaging solutions at http://www.wirefast.com/ Please consider the environment. Does this email or attachment need to be printed? This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this email. Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system. Email transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of email transmission. Wirefast Limited is registered in England & Wales Company number: 03865860 Registered Office: 7/10 Chandos Street, Cavendish Square, London, W1G 9DQ <>
Problem with complex classes in POJO
I'm trying to deploy a small service as a POJO. A method called getNotifications() should return an array of Strings and a boolean. Everything works just fine if I only return an array of Strings. To add a boolean I have created a bean that has the String array and the boolean as properties. This does not return any useful data. The Version that works looks like public String [] PollForNotifications( String account, String user, String password, int maxResults ) throws Exception, SQLException { ... String [] results = new String[notifications.size()]; notifications.toArray( results ); return results; } To add the boolean I create the following bean class public class PollForNotificationsResponse { private String[] notifications; private boolean more; public PollForNotificationsResponse() { notifications = new String [0]; more = false; } public String[] getNotifications() { return notifications; } public boolean isMore() { return more; } public void setNotifications( String[] p_Notifications ) { notifications = p_Notifications; } public void setMore( boolean p_More ) { more = p_More; } } and change the method to public PollForNotificationsResponse PollForNotifications( String account, String user, String password, int maxResults ) throws Exception, SQLException { ... String [] results = new String[notifications.size()]; notifications.toArray( results ); PollForNotificationsResponse response = new PollForNotificationsResponse(); response.setNotifications( results ); response.setMore( more > 0 ); return response; } and I no longer get any data back the result looks like Should this work? As far as I can see from the article http://www.developer.com/java/other/article.php/10936_3726461_2, I think it should work? Can anyone tell me why it might not work and how I can fix or trace the problem. Neil Neil Youngman Developer Wirefast Limited Wirefast provides secure corporate messaging services. See our messaging solutions at http://www.wirefast.com/ Please consider the environment. Does this email or attachment need to be printed? This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this email. Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system. Email transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of email transmission. Wirefast Limited is registered in England & Wales Company number: 03865860 Registered Office: 7/10 Chandos Street, Cavendish Square, London, W1G 9DQ <>