JAX-WS 问题

发布于 2024-11-27 01:10:45 字数 2414 浏览 1 评论 0原文

我有几个关于 JAX-WS 的问题。

  1. 使用 wsimport 生成的对象 Factory 的功能是什么?它与 Web 服务架构有何关系?

  2. 我有我编写的 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 ?

  1. 如何将Java中的注释与wsdl标准相关联?有没有用 Java 注释映射解释 wsdl 元素的教程?

  2. 这个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;  
    }  

} 
  1. JAX-WS Web 服务的 Web 服务端点(服务端点实现)的客户端调用流程是什么?

  2. 据我所知,有几种方法可以调用 Web 服务实现。

  3. 存根代码

扩展服务类 @WebServiceReference 用于使用 UDDI 查找 Web 服务。 使用 service.getServicePort 代理来调用服务端点实现公开的接口。这是正确的吗?还有其他解释吗?

  1. 代理
  2. JAX-WS 调度 API

这些有什么区别?这与 Web 服务架构有何关系?

请帮我。

谢谢。

i have a couple of question regarding JAX-WS.

  1. What is the functionality of object Factory generated using wsimport ? How does it relate to web service architecture ?

  2. 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 ?

  1. How to relate the annotation in Java to wsdl standard ? Any tutorial that explain wsdl elements with Java annotation mapping ?

  2. 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;  
    }  

} 
  1. What is client invocation flow to web service endpoint (service endpoint implementation) for JAX-WS web service ?

  2. As far as i know, there are couples of methods to invoke web service implementation.

  3. 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 ?

  1. Proxy
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十年九夏 2024-12-04 01:10:45

调用 Web 服务有两种方法:

  1. 代理存根代码
  2. 调度 API

There are two approaches to invoke web service:

  1. Proxy Stub code
  2. Dispatch API
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文