Meaningless Drivel is fun!*
The moose likes Web Services and the fly likes Programming web services with  JAX WS approach Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Programming web services with  JAX WS approach" Watch "Programming web services with  JAX WS approach" New topic
Author

Programming web services with JAX WS approach

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi

I am planning to write a web service based on jax ws .

My basic requirement is that , i need to accept a District or Region name as my Text Input , and in return i need to return all the names of the people of that for that Particular Organization .

I am having a query here , i am using EJB 3.0 Session Beans as my service End Point , please tell me can i store the contents in a ArrayList and return that ??

Please share your ideas . Thank you .


Save India From Corruption - Anna Hazare.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
As have been said here before, it is better to return an array of items from a method in a web service endpoint implementation class, since it is easier to represent an array in XML.
Best wishes!
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you very much .
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi
As i said , i am trying to return all the Peoples data of that region by returning an Object Array as you mentioned .
(An Array consisting all the People details).

This is my sample code of it .
All this is inside my EJB Implementation code


This is the way i am going to implement , please suggest me if there is anything wrong , as i have seen some code which is making use of @WebResult and i am not making use of it .

Please tell me whether using any @WebResult is necessary ??

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I suggest that you return an array of Customer, instead of an array of Object.
If you are doing java-first development, then I suspect that there is no reason for using @WebResult, since, at development time, you have neither WSDL nor associated XML schemas.
If you are not happy with the default result of compiling the Java bean class Customer to an XML schema performed by JAX-WS, you may want to consider using JAXB annotations in the Customer class.
Best wishes!
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234


Thank you very much .
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Programming web services with JAX WS approach
 
Similar Threads
Having Problem in sending mail
Creating JAX-WS Client in J2ME
Suggestion for novice to Web Service
Proper Exception handling in WebServices
EJB 3 as web service