Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CXF: Unmarshalling error: unexpected elements, what {} means?

I get error while connecting to my web service:

javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: unexpected element (uri:"", local:"OrderID"). Expected elements are <{}Login>,<{}CrewId>,<{}OrderID >,<{}OrderNumber >

Service is exposed using org.apache.cxf.transport.servlet.CXFServlet and jaxws:endpoint annotation. The client is generated using CXF. Firstly, suprising for me is that I'm using the same technology on both ends and the solution is not working, secondly, this mysterious {} in error messages.

So, what is wrong and how to understand this {}?

like image 788
Danubian Sailor Avatar asked May 15 '12 12:05

Danubian Sailor


2 Answers

Have you noted space between OrderID and '>'? Expected is <{}OrderID > and you send >"OrderID". Check if you don't have spaces in your element names.

While the above answer from Stepan Vihor helped you get what you needed, let me answer your question of what the "{}" means:

It means that the JAX-B Unmarshaller is expecting your OrderID element to have no namespace, i.e. the namespace uri for that element needs to be equal to "".

See here for a brief intro on XML Namespaces

like image 64
icyitscold Avatar answered Sep 21 '22 05:09

icyitscold


Have you noted space between OrderID and '>'? Expected is <{}OrderID > and you send "OrderID". Check if you don't have spaces in your element names.

like image 31
Stepan Vihor Avatar answered Sep 20 '22 05:09

Stepan Vihor