简体   繁体   English

如何从NetBeans生成的类中获取原始对象以供JAX-WS传输?

[英]How do I get the original object back from a class generated by NetBeans for transfer by JAX-WS?

Java EE 6, NetBeans 6.9.1. Java EE 6,NetBeans 6.9.1。

Part of my project is a SOAPy web service. 我的项目的一部分是一个SOAPy Web服务。 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. 我已经编写了它的服务器端部分,这似乎工作正常,因为GlassFish 3.0.1正在为Web服务生成WSDL文件。

The web service sends and receives JPA entity classes, which the client operates on. Web服务发送和接收客户端操作的JPA实体类。 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 (eg, @XmlAccessorType, @XmlType, @XmlElement), but they lack the other methods, etc. of the entity classes. 我使用NetBeans的“新建> Web服务客户端”向导生成资源类的源代码,这些资源类代表Web服务发送的实体 - 这些资源与实体类,getter和setter的字段相同字段和来自javax.xml.bind.annotation的某些注释(例如,@ XmlAccessorType,@ XMLType,@ XMLElement),但它们缺少实体类的其他方法等。

Once my web service client receives these resources, how do I get back the proper entity objects? 一旦我的Web服务客户端收到这些资源,我该如何找回正确的实体对象? 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! 谢谢! :) :)

PS I'm not sure what these resources classes are called; PS我不确定这些资源类叫什么; if anyone knows, it would help me write a more descriptive title. 如果有人知道,这将有助于我写一个更具描述性的标题。

您需要通过编写一些转换器类手动将XML Schema类转换为您的实体

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM