I am developing a plugin for nexus oss .My app creates a rest call response(to a request from server) . But when the server receives it , it throws error as follows
javax.xml.bind.UnmarshalException:
unexpected element (uri:"", local:"com.collabnet.teamforge.ia.types.GetConfigurationParametersResponse").
Expected elements are
\lt{http://www.collab.net/teamforge/integratedapp}CreateProjectConfigurationRequest\gt,
\lt{http://www.collab.net/teamforge/integratedapp}GetConfigurationParametersRequest\gt,
\lt{http://www.collab.net/teamforge/integratedapp}GetConfigurationParametersResponse\gt,
\lt{http://www.collab.net/teamforge/integratedapp}GetPageComponentParametersRequest>
I guess the reason behind this exception is that the response doesn't match with the expected because the uri ( this is just my guess , if it's wrong please correct me),that is the namespace in response is not set .
snip of the Code in my plugin is as follows
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"configurationParameter"
})
@XmlRootElement(name = "GetConfigurationParametersResponse", namespace = "http://www.collab.net/teamforge/integratedapp")
public class GetConfigurationParametersResponse
extends BaseResponse
{
Why is name space not picked up while creating response ?
Even correct me if the real reason for the exception is not the empty uri. If so what is the real reason behind this exception ? Please help .
Based on the error message the XML document being passed to JAXB is. It appears as though this XML is being created by something other than JAXB (I suspect XStream).
Your JAXB mappings are expecting an XML document like the following:
If you need to interact with the following XML:
Then you can change your mapping to be: