如何在Web服务中使用Moxy XPath带注释的bean? [英] How to use Moxy XPath annotated beans in web services?

查看:95
本文介绍了如何在Web服务中使用Moxy XPath带注释的bean?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个bean

@XmlRootElement(name = "alpha")
public class MyBean {
    private String thetaValue;

    @XmlPath("beta/theta/text()")
    public String getThetaValue() {
        return this.thetaValue;
    }

    public void setThetaValue(String thetaValue) {
        this.thetaValue = thetaValue;
    }
}

这是使用eclipselink moxy jaxb注释的。我想使用相同的bean和Xpath来托管Web服务。我该怎么做呢? Web服务将托管在tomcat 6或7上

This is annotated using eclipselink moxy jaxb. I want to use the same bean and Xpath to host a web service. How do I do this? the web service will be hosted on tomcat 6 or 7

推荐答案

JAX-WS(JSR-224) JAXB(JSR-222) 实施。这意味着支持 EclipseLink MOXy ,因为JAXB提供程序依赖在JAX-WS实现上(见下面的注释)。

There isn't a standards based integration point between JAX-WS (JSR-224) and JAXB (JSR-222) implementations. This means support for EclipseLink MOXy as the JAXB provider is dependent upon the JAX-WS implementation (see note below).

JAX-WS Provider - 参考实现

支持MOXy直接进入JAX-WS参考实现。这意味着利用足够新版本的JAX-WS RI的任何环境都应该能够利用MOXy作为JAXB提供程序。我需要了解更多有关这方面的细节。

Support for MOXy is baked right into the JAX-WS reference implementation. This means any environment leveraging a new enough version of the JAX-WS RI should be able to leverage MOXy as the JAXB provider. I need to find out more about the specifics to do this.

  • http://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-eclipselink-plugin

其他JAX-WS提供商

您可以利用 javax.xml.ws.Provider 接口而不是传统的服务端点接口。 Provider 使您可以访问实际的XML消息。通过访问XML消息,您可以使用MOXy直接与它进行交互。

You could leverage the javax.xml.ws.Provider interface instead of the traditional service endpoint interface. Provider gives you access to the actual XML message. With access to the XML message you can interact with it directly using MOXy.

  • http://blog.bdoughan.com/2013/02/leveraging-moxy-in-your-web-service-via.html

注意

您可以创建传统的JAX-WS Web服务,在以下环境中利用MOXy的扩展注释:

You can create traditional JAX-WS Web Services that leverage MOXy's extends annotations in the following environments:

  • WebLogic (12.1.1 and above) - EclipseLink MOXy is the JAXB Provider in WebLogic Server 12c
  • GlassFish (3.1.2 and above) - GlassFish 3.1.2 is Full of MOXy (EclipseLink JAXB)

这篇关于如何在Web服务中使用Moxy XPath带注释的bean?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆