简体   繁体   English

JAX-WS问题

[英]JAX-WS Question

i have a couple of question regarding JAX-WS. 我对JAX-WS有几个问题。

  1. What is the functionality of object Factory generated using wsimport ? 使用wsimport生成的对象Factory的功能是什么? How does it relate to web service architecture ? 它与Web服务体系结构有何关系?

  2. I have web service Service endpoint implementation class written by me with the method signature like this : 我有一个我编写的Web服务Service端点实现类,带有方法签名,如下所示:

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. Custorder的参数派生自数据库,其中包是Entity.Custorder,但是当我使用wsimport生成JAXB Mapped类时,它具有不同的类型,即ServiceClient.Custorder。

On top of that, I drag and drop the service client invocation using netbeans IDE and with this method signature. 最重要的是,我使用netbeans IDE和此方法签名拖放了服务客户端调用。

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. 据我所知,@WebParam批注用于自动将SOAP消息转换为Java对象。 Therefore, I wonder which one (ServiceClient.Custorder or Entity.Custorder) to use in the service endpoint implementation signature. 因此,我想知道在服务端点实现签名中使用哪一个(ServiceClient.Custorder或Entity.Custorder)。

If i use the ServiceClient.Custorder (JAXB generated), then how to convert to Entity.Custorder (JPA generated) ? 如果我使用ServiceClient.Custorder(由JAXB生成),那么如何转换为Entity.Custorder(由JPA生成)?

From my experience, i have developed RESTFul web service with entity class which can convert to xml and mapped to database table. 根据我的经验,我开发了具有实体类的RESTFul Web服务,该实体类可以转换为xml并映射到数据库表。 Previous, i using @XMLRootElement and @Entity 以前,我使用@XMLRootElement和@Entity

How to implement a POJO which can convert to XML and database entity in JAX-WS ? 如何在JAX-WS中实现可转换为XML和数据库实体的POJO?

  1. How to relate the annotation in Java to wsdl standard ? 如何将Java中的注释与wsdl标准相关联? Any tutorial that explain wsdl elements with Java annotation mapping ? 是否有任何使用Java注释映射解释wsdl元素的教程?

  2. How does this createOrder.java generated using wsimport related to SOAP message ? 使用与SOAP消息相关的wsimport生成的createOrder.java如何生成?

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 ? 什么是JAX-WS Web服务到Web服务端点(服务端点实现)的客户端调用流?

  2. As far as i know, there are couples of methods to invoke web service implementation. 据我所知,有几种方法可以调用Web服务实现。

  3. Stubs code 存根代码

Extends service class The @WebServiceReference is used to find the web service using UDDI. 扩展服务类@WebServiceReference用于使用UDDI查找Web服务。 Used service.getServicePort proxy to call the interface exposed by Service endpoint implementation. 使用service.getServicePort代理来调用Service端点实现公开的接口。 Is this correct and any other explanation ? 这是正确的,还有其他解释吗?

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

What is the difference between all these ? 这些之间有什么区别? How does this relate to the web service architecture ? 这与Web服务体系结构有何关系?

Please help me. 请帮我。

Thanks. 谢谢。

There are two approaches to invoke web service: 有两种方法可以调用Web服务:

  1. Proxy Stub code 代理存根代码
  2. Dispatch API 调度API

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

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