Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Web Services
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Web Services
return complex typ
argol diomolpol
Greenhorn
Posts: 16
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I want to return
java
class in web service but web service return null. This is what i have done.
@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Users",namespace="http://webServices.ejb/" ,propOrder = { "userid","name","surname","login","password","status","email" }) @XmlRootElement(namespace="http://webServices.ejb/", name = "test") public class Users implements Serializable{ @XmlElement(namespace="http://webServices.ejb/",name="userid") private int userid; @XmlElement(namespace="http://webServices.ejb/") private String name; @XmlElement(namespace="http://webServices.ejb/") private String surname; @XmlElement(namespace="http://webServices.ejb/") private String login; @XmlElement(namespace="http://webServices.ejb/") private String password; @XmlElement(namespace="http://webServices.ejb/") private int status; @XmlElement(namespace="http://webServices.ejb/") private String email; @XmlTransient private Set addresses = new HashSet(0); @XmlTransient private Set accounts = new HashSet(0); // GETTERS SETTRES
@Stateless(mappedName = "UsersOperations") @WebService(name = "UsersOperations") public class UsersOperations implements UsersOperationsEjbRemote, UsersOperationsEjbLocal { /** * Default constructor. */ public UsersOperations() { // TODO Auto-generated constructor stub } @WebMethod public Users test(@WebParam(name = "userid") int userid){ // Hibernate query Users u = queryUserDetails(userid); System.out.println(u.getLogin()); return u; } }
CLIENT
@WebService(name = "UsersOperations", targetNamespace = "http://webServices.ejb/") @XmlSeeAlso({bankDB.Users.class}) public interface UsersOperations { @WebMethod @WebResult(targetNamespace = "http://webServices.ejb/") public Users test(@WebParam(name = "userid") int userid); }
@WebServiceClient(name = "UsersOperationsService", targetNamespace = "http://webServices.ejb/", wsdlLocation = "http://127.0.0.1:8080/Bank-BankEJB/UsersOperations?wsdl") public class UsersOperationsService extends Service { private final static URL UsersOperationsService_WSDL_LOCATION; static { URL url = null; try { url = new URL("http://127.0.0.1:8080/Bank-BankEJB/UsersOperations?wsdl"); } catch (MalformedURLException e) { e.printStackTrace(); } UsersOperationsService_WSDL_LOCATION = url; } public UsersOperationsService(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } public UsersOperationsService() { super(UsersOperationsService_WSDL_LOCATION, new QName("http://webServices.ejb/", "UsersOperationsService")); } /** * * @return * returns Notification */ @WebEndpoint(name = "UsersOperationsPort") public UsersOperations getUsersOperationsPort() { return (UsersOperations)super.getPort(new QName("http://webServices.ejb/", "UsersOperationsPort"), UsersOperations.class); } }
// invoke web service in client UsersOperationsService service = newUsersOperationsService(); UsersOperations ejb = service.getUsersOperationsPort(); Users u = ejb.test(2);
I should do anything else please help. Thanks in advance for help
[ August 05, 2008: Message edited by: argol diomolpol ]
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Where is the code that catches exceptions and reports them?
If this was my problem I would use TCPMON to examine the exact text of request and response. Client side code can easily hide the real problem.
Bill
argol diomolpol
Greenhorn
Posts: 16
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Whene i invoke web service in client i have java.lang.NullPointerException.
I ma using
Jboss
and i have uncomment logging
SOAP
messages. In this message there are values and this values are correct so somthing must be wrong with client but what?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to create Web service using JAX-WS in Jboss
Please Help regarding error while create *Service class by using wsimport glassfish v2
Calculator example
How to connect two Web services to each other
Web Services with Axis2
More...