2

I have a 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;
    }
}

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

user1282545
  • 167
  • 4
  • 11

1 Answers1

3

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 - Reference Implementation

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.

Other JAX-WS Providers

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.

Note

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

bdoughan
  • 147,609
  • 23
  • 300
  • 400
  • 1
    Within my JAX WS RI based client I needed to annotate one of my bean's attributes with the Eclipse MOXY's XmlCDATA annotation. The problem was that the JAX WS runtime didn't use MOXy although the JAXBContextFactory was correctly specified in the jaxb.properties. The whole problem was in an old com.sun.xml.ws:jaxws-tools package to generate the classses. I had 2.1.4 and then upgraded to 2.2.7. Also I had to add com.sun.xml.ws:jaxws-eclipselink-plugin:2.2.7 package which did the trick of using my XmlCDATA annotation. – Bohumir Zamecnik Mar 04 '13 at 10:39