I just started using CXF 2.4 to expose some methods in an existing web application. One of the methods returns an object of a complex type - Employee, which has an Address object as a property.
The employee object looks like this:
public class Employee implements Serializable { private String gid; private String name; private Address employeeAddress;
The method signature on the service interface looks like this:
Employee getEmployee(@WebParam(name="gid") String gid);
On the client side, I used the CXF WsdlToJava utility to create my client side stubs from the wsdl server address and happily used the Employee object in my client web application.
Today, an employee told me that I should not use objects created with webservice in my client application code. Instead, I have to create an Employee class specific to my client web application and copy the properties from the Employee object of the web service to the object of my Employee application so that the web service code does not end all over the code base.
This seems redundant to me, in essence I will create an Employee class plus an Address class and copy the properties between the objects of these types and the types of web services.
In my application, I show the details of the Employee object on the JSP page, but I do not do it anymore.
So, to summarize my question - when using webservice calls in CXF that return objects of a complex type, should you always use separate objects of the client application that copy the properties of the objects generated by the web service? Whether there is a rule to use or depends on how complex the returned objects are and what the client application intends to do with them (for example, just display them, edit and return, store them in the db client application.)
Thanks Darren
source share