Results 1 to 3 of 3

Thread: Problems with AbstractMarshallingPayloadEndpoint and JAXB2

  1. #1
    Join Date
    Jun 2007
    Posts
    20

    Default 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. #2
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    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.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3
    Join Date
    Sep 2010
    Posts
    7

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •