views:

15

answers:

2

Java EE 6, NetBeans 6.9.1.

Part of my project is a SOAPy web service. I've written the server-side part of it, and that seems to work OK because GlassFish 3.0.1 is correctly generating WSDL files for the web services.

The web service sends and receives JPA entity classes, which the client operates on. I used NetBeans' "New > Web Service Client" wizard to generate the source code for the resource classes that represent the entities when they get sent by the web service — these resources have the same fields as the entity classes, getters and setters for those fields, and certain annotations from javax.xml.bind.annotation (e.g., @XmlAccessorType, @XmlType, @XmlElement), but they lack the other methods, etc. of the entity classes.

Once my web service client receives these resources, how do I get back the proper entity objects? I'd rather not manually reconstruct every entity, considering how many classes I have and how complicated their relationships are, this would be a lot of work.

Thank you! :)

P.S. I'm not sure what these resources classes are called; if anyone knows, it would help me write a more descriptive title.

+1  A: 

You need to convert your XML Schema classes to your entity manually by writing some converter classes

org.life.java
Thank you. That's disappointing. Java EE has such a nice stack of technologies, but time and time again it's a pain in the ass to try to get them to work together.
Nick
+1  A: 

One option would be to use a JAXB and JPA combo with something like HyperJAXB 3. Have a look at:

Or using a JAXB implementation providing JPA support through extensions like MOXy:

Pascal Thivent