JAX-WS 问题
我有几个关于 JAX-WS 的问题。
使用 wsimport 生成的对象 Factory 的功能是什么?它与 Web 服务架构有何关系?
我有我编写的 Web 服务服务端点实现类,其方法签名如下:
查看 plaincopy 到剪贴板打印?
@WebMethod(operationName = "deleteOrder")
@Oneway // No return value
public void deleteOrder(@WebParam(name = "myCustorder") Custorder myCustorder) {
myCustOrder.deleteOrder(myCustorder);
}
Custorder 的参数源自数据库,其中包为 Entity.Custorder,但当我使用 wsimport 生成 JAXB 映射类时,它具有不同的类型,即 ServiceClient.Custorder。
最重要的是,我使用 netbeans IDE 和此方法签名拖放服务客户端调用。
查看纯文本复制到剪贴板打印?
private int createOrder(ServiceClient.Custorder myCustorder) {
ServiceClient.OrderWebService port = service.getOrderWebServicePort();
return port.createOrder(myCustorder);
}
据我所知,@WebParam注释用于自动将SOAP消息转换为java对象。因此,我想知道在服务端点实现签名中使用哪一个(ServiceClient.Custorder 或 Entity.Custorder)。
如果我使用 ServiceClient.Custorder (JAXB 生成),那么如何转换为 Entity.Custorder (JPA 生成)?
根据我的经验,我开发了带有实体类的 RESTFul Web 服务,它可以转换为 xml 并映射到数据库表。上一篇,我使用 @XMLRootElement 和 @Entity
如何实现可以在 JAX-WS 中转换为 XML 和数据库实体的 POJO ?
如何将Java中的注释与wsdl标准相关联?有没有用 Java 注释映射解释 wsdl 元素的教程?
这个createOrder.java是如何使用wsimport生成与SOAP消息相关的?
查看纯文本复制到剪贴板打印?
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "createOrder", propOrder = {
"myCustorder"
})
public class CreateOrder {
protected Custorder myCustorder;
/**
* Gets the value of the myCustorder property.
*
* @return
* possible object is
* {@link Custorder }
*
*/
public Custorder getMyCustorder() {
return myCustorder;
}
/**
* Sets the value of the myCustorder property.
*
* @param value
* allowed object is
* {@link Custorder }
*
*/
public void setMyCustorder(Custorder value) {
this.myCustorder = value;
}
}
JAX-WS Web 服务的 Web 服务端点(服务端点实现)的客户端调用流程是什么?
据我所知,有几种方法可以调用 Web 服务实现。
- 存根代码
扩展服务类 @WebServiceReference 用于使用 UDDI 查找 Web 服务。 使用 service.getServicePort 代理来调用服务端点实现公开的接口。这是正确的吗?还有其他解释吗?
- 代理
- JAX-WS 调度 API
这些有什么区别?这与 Web 服务架构有何关系?
请帮我。
谢谢。
i have a couple of question regarding JAX-WS.
What is the functionality of object Factory generated using wsimport ? How does it relate to web service architecture ?
I have web service Service endpoint implementation class written by me with the method signature like this :
view plaincopy to clipboardprint?
@WebMethod(operationName = "deleteOrder")
@Oneway // No return value
public void deleteOrder(@WebParam(name = "myCustorder") Custorder myCustorder) {
myCustOrder.deleteOrder(myCustorder);
}
The parameter for the Custorder is derived from database where the package is Entity.Custorder but when i used the wsimport to generate the JAXB Mapped class, it has different type which is ServiceClient.Custorder.
On top of that, I drag and drop the service client invocation using netbeans IDE and with this method signature.
view plaincopy to clipboardprint?
private int createOrder(ServiceClient.Custorder myCustorder) {
ServiceClient.OrderWebService port = service.getOrderWebServicePort();
return port.createOrder(myCustorder);
}
As far as i know, the @WebParam annotation is used to automatically convert the SOAP message to java object. Therefore, I wonder which one (ServiceClient.Custorder or Entity.Custorder) to use in the service endpoint implementation signature.
If i use the ServiceClient.Custorder (JAXB generated), then how to convert to Entity.Custorder (JPA generated) ?
From my experience, i have developed RESTFul web service with entity class which can convert to xml and mapped to database table. Previous, i using @XMLRootElement and @Entity
How to implement a POJO which can convert to XML and database entity in JAX-WS ?
How to relate the annotation in Java to wsdl standard ? Any tutorial that explain wsdl elements with Java annotation mapping ?
How does this createOrder.java generated using wsimport related to SOAP message ?
view plaincopy to clipboardprint?
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "createOrder", propOrder = {
"myCustorder"
})
public class CreateOrder {
protected Custorder myCustorder;
/**
* Gets the value of the myCustorder property.
*
* @return
* possible object is
* {@link Custorder }
*
*/
public Custorder getMyCustorder() {
return myCustorder;
}
/**
* Sets the value of the myCustorder property.
*
* @param value
* allowed object is
* {@link Custorder }
*
*/
public void setMyCustorder(Custorder value) {
this.myCustorder = value;
}
}
What is client invocation flow to web service endpoint (service endpoint implementation) for JAX-WS web service ?
As far as i know, there are couples of methods to invoke web service implementation.
- Stubs code
Extends service class
The @WebServiceReference is used to find the web service using UDDI.
Used service.getServicePort proxy to call the interface exposed by Service endpoint implementation. Is this correct and any other explanation ?
- Proxy
- JAX-WS Dispatch API
What is the difference between all these ? How does this relate to the web service architecture ?
Please help me.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调用 Web 服务有两种方法:
There are two approaches to invoke web service: