peter wong ka chon wrote:1. What is the functionality of object Factory generated using wsimport ? How does it relate to web service architecture ?
My free books and tutorials: http://www.slideshare.net/krizsan
Ivan Krizsan wrote:
The object factory/factories are JAXB object factories generated by XJC, which in turn is invoked by wsimport in one way or another.
Usually, you do not need to use these classes when using client stubs.
Best wishes!
peter wong ka chon wrote:
What is the functionality of this JAXB object factory ? Is it instantiated the request/response wrapper bean ?
When do need to use this class directly besides client stubs approach ?
My free books and tutorials: http://www.slideshare.net/krizsan
Ivan Krizsan wrote:
If you want to use JAXB to transform a Java object structure to XML data, then you would use the object factory directly, creating instances of JAXB beans in which you then insert data.
If you want to know about the functionality of the object factory I suggest you open such a generated class up and have a look! :-)
Yes, the request/response beans are usually JAXB beans and thus the object factory can create such instances.
Best wishes!
My free books and tutorials: http://www.slideshare.net/krizsan
Ivan Krizsan wrote:Hi!
The way I would use to transfer data from a JAXB bean to an entity (and vice versa) is to write code - a kind of transformer, if you wish.
The transformer calls a getter method on, for instance, a JAXB bean and then a setter method on the entity object.
Best wishes!
My free books and tutorials: http://www.slideshare.net/krizsan
aIvan Krizsan wrote:Hi!
My experience tells me that the database representation may change independently of the data transferred by the web service and vice versa.
When I have tried to avoid additional work, merging these two things into one, it has often caused even more work later on.
However, the system you are developing may be different from the ones I have developed, so your suggestion may be more appropriate in your case.
Best wishes!
My free books and tutorials: http://www.slideshare.net/krizsan
My free books and tutorials: http://www.slideshare.net/krizsan
Ivan Krizsan wrote:Hi!
So you have two different representations of the same concept (Order) in your domain model?
This is something of a drawback - if the two order types are fundamentally different, then perhaps two different entities, with different names, may be warranted.
If the client and server is to share the Order entity, then containing it in some kind of shared library may be a good idea.
You will need to write code that re-packages data received in a JAXB-generated bean (assuming you use this) to be contained in an instance of the Order entity class from the common library. The reverse procedure, taking data from an Order entity and inserting it into a JAXB-generated bean, will be necessary if your code is to send out representations of Order entities.
Best wishes!
peter wong ka chon wrote:
Ivan Krizsan wrote:Hi!
So you have two different representations of the same concept (Order) in your domain model?
This is something of a drawback - if the two order types are fundamentally different, then perhaps two different entities, with different names, may be warranted.
If the client and server is to share the Order entity, then containing it in some kind of shared library may be a good idea.
You will need to write code that re-packages data received in a JAXB-generated bean (assuming you use this) to be contained in an instance of the Order entity class from the common library. The reverse procedure, taking data from an Order entity and inserting it into a JAXB-generated bean, will be necessary if your code is to send out representations of Order entities.
Best wishes!
I think i need to rewrite the Web Service Server to accept ServiceClient.Order then i will convert to Order Entity when persist to database. This is just a theory. Thanks by the way.
I got a question from here
http://stackoverflow.com/questions/7281913/import-war-to-another-project-in-netbeans
Thanks.
peter wong ka chon wrote:
I think i need to rewrite the Web Service Server to accept ServiceClient.Order then i will convert to Order Entity. This is just a theory.
My free books and tutorials: http://www.slideshare.net/krizsan