RESTful services must include a package-info.java to set the elementFormDefault
to QUALIFIED
--------------------------------------------------------------------------------------------
Key: CXF-952
URL: https://issues.apache.org/jira/browse/CXF-952
Project: CXF
Issue Type: Bug
Components: Core
Affects Versions: 2.0.1
Reporter: Adrian Trenaman
-- Extract from email sent to cxf-dev --
Hi all,
I've been playing with the RESTful service support and I've come across some
issues that really slowed me down :( I'm describing them here (and their
workarounds) in case any users find it useful. I'm also wondering if some of
these might be classified as bugs - please advise!
Here's what happened: based on the docu in the CXF wiki User Guide [1], I
developed a RESTful service: everything was going fine until I implemented a
PUT method for an update.
--- in play/Contacts.java ---
@Put
@HttpResource(location="/people/{id}")
void updatePerson(Person person);
---
First problem: I didn't realise that I needed to have a package-info.java in
the package. Without this, my Person object (which represents the payload of
the PUT) has null contents in the serverside code. Through a lot of trial and
error I discovered that I hadn't included package-info.java file in the Java
package (it's still not clear to me why I should need it...).
Also, I've found that elementFormDefault must be QUALIFIED - making this
UNQUALIFIED doesn't work (see package-info.java below)
--- package-info.java ---
@javax.xml.bind.annotation.XmlSchema(
namespace = "http://play/",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED
)
package play;
------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.