users@jaxb.java.net

Re: Strange problem, please help

From: Alejandro Escalante Medina <alex.escalante_at_gmail.com>
Date: Wed, 15 Apr 2009 11:58:46 -0700

I see that I wasn't completely clear... the problem is not on "how the
classes look", but on the way the marshaller works with these classes...

I would expect that the marshaller and the classes would correctly parse an
xml instance *whithout* the <arg0> element. But JAXB refuses to parse xml
instances unless they have this <arg0> element present.

More information: I am developing a web service with this code. And when
SoapUI parses the generated WSDL and creates a sample request, this request
comes with the <arg0> enclosing element present... Why? I think JAXB (could
it be JAX-WS? I don't think so) somehow believes the schema implies it.

But nobody else than JAXB expects that element to be present.

Was I clear enough? :D

Version for the xjc binary I am using:

xjc version "hudson-jaxb-ri-2.1-792"

Thanks...


Alejandro Escalante Medina
Visita mi página personal en http://weblocked.blogsome.com/


On Wed, Apr 15, 2009 at 4:22 AM, Wolfgang Laun <wolfgang.laun_at_gmail.com>wrote:

> If I compile the schema snippet with xjc 2.1.3 (with JDK 1.6) I get a class
> for Notify containing two List fields (one with NotificationMessage elements
> and another one with Object elements) , and that's the way it should be.
>
> From what information do you derive the necessity of the "wrapper" <arg0>?
>
> Could you please post the generated code for Notify.java, and make sure to
> keep the xjc version which is in a comment.
>
> -W
>
>
>
>
> On 4/14/09, Alejandro Escalante Medina <alex.escalante_at_gmail.com> wrote:
>>
>> Well, maybe I wasn't very clear in my last message, so I will re-state my
>> problem here.
>>
>> I have this schema fragment from OASIS WS-I Notification spec (
>> http://docs.oasis-open.org/wsn/b-2.xsd):
>>
>> <!-- ================== Message Helper Types ===================== -->
>> <xsd:complexType name="NotificationMessageHolderType" >
>> <xsd:sequence>
>> <xsd:element ref="wsnt:SubscriptionReference"
>> minOccurs="0" maxOccurs="1" />
>> <xsd:element ref="wsnt:Topic"
>> minOccurs="0" maxOccurs="1" />
>> <xsd:element ref="wsnt:ProducerReference"
>> minOccurs="0" maxOccurs="1" />
>> <xsd:element name="Message">
>> <xsd:complexType>
>> <xsd:sequence>
>> <xsd:any namespace="##any" processContents="lax"
>> minOccurs="1" maxOccurs="1"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:element>
>> </xsd:sequence>
>> </xsd:complexType>
>>
>> <xsd:element name="NotificationMessage"
>> type="wsnt:NotificationMessageHolderType"/>
>>
>> <!-- ========== Message Types for NotificationConsumer =========== -->
>> <xsd:element name="Notify" >
>> <xsd:complexType>
>> <xsd:sequence>
>> <xsd:element ref="wsnt:NotificationMessage"
>> minOccurs="1" maxOccurs="unbounded" />
>> <xsd:any namespace="##other" processContents="lax"
>> minOccurs="0" maxOccurs="unbounded"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:element>
>>
>>
>> A valid fragment for this schema could be the following:
>>
>> <ns1:Notify xmlns:ns1="http://docs.oasis-open.org/wsn/b-2">
>> <ns1:NotificationMessage>
>> <ns1:SubscriptionReference>
>> ...
>>
>> However, the code generated by xjc won't parse such a thing, instead, it
>> wants an extra element between <Notify> and <NotificationMessage>:
>>
>> <b:Notify>
>> <arg0>
>> <b:NotificationMessage>
>> <b:SubscriptionReference>
>>
>> ... the question is, obviously: why?
>>
>> Also note that the "ghost tag" doesn't have any namespace. I am not an
>> expert but this seems strange.
>>
>> So, I can't find the way for the generated classes to parse the first
>> fragment, which is the correct one according to the spec and to at least one
>> schema validator I tried.
>>
>> Any ideas?
>>
>> Please, any help will be appreaciated...
>>
>>
>> Alejandro Escalante Medina
>> Visita mi página personal en http://weblocked.blogsome.com/
>>
>
>