加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

如何在Web服务中使用Moxy XPath带注释的bean?

发布时间:2020-12-14 23:45:41 所属栏目:资源 来源:网络整理
导读:我有一个豆子 @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.thetaV
我有一个豆子
@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上

解决方法

JAX-WS (JSR-224)JAXB (JSR-222)实现之间没有基于标准的集成点.这意味着支持 EclipseLink MOXy,因为JAXB提供程序依赖于JAX-WS实现(请参阅下面的注释).

JAX-WS提供程序 – 参考实现

对MOXy的支持直接进入JAX-WS参考实现.这意味着利用足够新版本的JAX-WS RI的任何环境都应该能够利用MOXy作为JAXB提供程序.我需要找到更多关于这样做的具体细节.

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

其他JAX-WS提供商

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

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

注意

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

> WebLogic(12.1.1及更高版本) – EclipseLink MOXy is the JAXB Provider in WebLogic Server 12c
> GlassFish(3.1.2及以上) – GlassFish 3.1.2 is Full of MOXy (EclipseLink JAXB)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读