Announcement Announcement Module
Collapse
No announcement yet.
Problems with AbstractMarshallingPayloadEndpoint and JAXB2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with AbstractMarshallingPayloadEndpoint and JAXB2

    Hi,

    I'm using version 1.0-rc2 to create a web service that marshalls/unmarshalls messages using JAXB2. I ran xjc against the schema and got classes like:

    Code:
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "MyClass_Type")
    public class MyClassType {
    ...
    }
    I was expecting an instance of MyClassType passed as a parameter to the invokeInternal(...) method of AbstractMarshallingPayloadEndpoint, instead I'm getting a JAXBElement<MyClassType>.

    Is this the intended behavior?

    Thx,

    --Alex

  • #2
    Yes, that's the way JAXB2 works. I don't think it's particularly pretty either. Note that you also have an ObjectFactory, which generates the JAXBElement for you.

    Comment


    • #3
      Hi,

      I also ran into this problem.

      With some experimenting I have found, that this behaviour depends on your shema. If XJC generates the @XmlRootElement annotation for you xml element, then JAXB marshaller is able to process it without the JaxbElement<T> hassle.

      See a related article:
      http://weblogs.java.net/blog/kohsuke...es_jaxb_p.html

      This article suggests an XSD annotation, which however did not solve my problem.

      regards
      R.

      Comment

      Working...
      X