Ivo van Dongen wrote:
Hi,
Thanks for the quick reply. If I remember correctly putting
nillable=true and minOccurs=0 together results in some strange
behaviour in Xfire. Instead of generating Strings you get
JAXBElement<String> or something or is this fixed in the current
release?
It seems to be. Tested it with 1.2.5 and it now generates a string,
tnx:). Sadly I can't use that release due to a bug causing a
StackOverFlowError in one of my other services (see my previous
mail). I'll file a jira issue for that.
Well, I've found a way to get rid of the StackOverFlowError but Xfire
still generates a JAXBElement<String> instead of String when
minoccurs="0" is combined with nillable="true". Any ideas why this
happens and how to prevent it?
Answering my own mail again (shouldn't be talking to myself...); There
is a way to prevent JAXB from generating JAXBElement<String>. It's done
with jaxb bindings like this:
<jaxb:bindings
node="//xs:[EMAIL PROTECTED]'getUserProfileRequest']//xs:complexType//xs:element">
<jaxb:property generateElementProperty="false" />
</jaxb:bindings>
According to the documentation found at [1] it should be possible to
specify this globally on globalBindings, but the xsd found at [2]
doesn't allow this and the generation fails.
Hope this is some to others.
Regards,
Ivo
[1]
http://java.sun.com/webservices/interop/reference/tutorial/doc/DataBinding5.html
[2] http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
IVo
Thanks,
Ivo
Regards,
Ivo van Dongen
Daniel Brake wrote:
Hi there,
You could add nillable="true" to your userId element. The generated
payload would then match the contract.
Dan
------------------------------------------------------------------------
*From:* Ivo van Dongen [mailto:[EMAIL PROTECTED]
*Sent:* 26 April 2007 14:03
*To:* [email protected]
*Subject:* [xfire-user] Xfire generates invalid messages
(xsi:nil="true")
Hi,
We use Xfire on our server and client side, but we ran into a
problem after turning validation on. We have an operation witch
takes the folloing element as a payload:
<xs:element name="getUserProfileRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="userId" type="xs:string"
minOccurs="0">
<xs:annotation>
<xs:documentation>You'll only have to
specify a userId if you want to read somebody else's profile
(assuming you have the authorization to do
this)</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
The message that is generated on the client side:
<ns2:getUserProfileRequest
xmlns:ns2="http://tesis.nl/webservices/types">
<userId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:nil="true" />
</ns2:getUserProfileRequest>
This leads to the following error message when validating:
Exception in startElement: cvc-elt.3.1: Attribute
'http://www.w3.org/2001/XMLSchema-instance,nil' must not appear on
element 'userId', because the {nillable} property of 'userId' is
false.
Is this expected behaviour? And if so is there a way to control this?
Thanks in advance,
Ivo van Dongen
--
Ivo van Dongen
Func. Internet Integration
Prins Hendrikkade 20-21, 1012 TL Amsterdam
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500
=======================================================================
Message has been scanned for viruses by MessageLabs Protect
This email and any files transmitted with it are intended only for
the person(s) or entity to which they are addressed and may contain
confidential information. Any review, retransmission,
dissemination, copying or other use of, this information by persons
or entities other than the intended recipient is prohibited. If you
have received this in error and/or, are not the named addressee,
please contact the sender and
delete the material from all computers.
Optimad does not accept any liability for the content of the email.
Although emails are routinely screened for viruses Optimad does not
accept responsibility for any damage caused.
Replies to this email and all emails sent to Optimad Media Systems
may be intercepted by Message Labs and screened for viruses.
Optimad excludes all liability (to the extent permitted by law) to
the senders of emails to Optimad for the access to emails granted
to Message Labs.
--
Ivo van Dongen
Func. Internet Integration
Prins Hendrikkade 20-21, 1012 TL Amsterdam
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email