I am upgrading an old XFire webservice to the latest edition of CXF.
I am hoping I can do this with no changes to the web service interface
(WSDL).
I my XFire edition methods that return arrays resulted in a type e.g:
ArrayOfErrorCode:
<getErrorCodesResponse xmlns="http://namespace.dk">
<ErrorCodes>
<ErrorCode>BAD_INPUT</ErrorCode>
<ErrorCode>OTHER_ERROR</ErrorCode>
...
In CXF I don't get that wrapping:
<ns2:getErrorCodesResponse xmlns:ns2="http://namespace.dk/">
<ErrorCodes>BAD_INPUT</ErrorCodes>
<ErrorCodes>OTHER_ERROR</ErrorCodes>
....
I have tried wrapping the response in an ErrorCodes class that contains
the array:
public final class ErrorCodes {
private ErrorCode[] ErrorCode;
<ns2:getErrorCodesResponse xmlns:ns2="http://namespace.dk/">
<ErrorCodes>
<errorCode>BAD_INPUT</errorCode>
<errorCode>OTHER_ERROR</errorCode>
....
Almost there but notice the 'e' is not an 'E'.
So I added
@XmlElement(namespace="", name="ErrorCode")
private ErrorCode[] ErrorCode;
But then I get two elements in the response:
<ns2:getErrorCodesResponse
xmlns:ns2="http://ws.brugerinformation.dk/">
<ErrorCodes>
<ErrorCode>BAD_INPUT</ErrorCode>
<ErrorCode> OTHER_ERROR </ErrorCode>
<errorCode>BAD_INPUT</errorCode>
<errorCode> OTHER_ERROR </errorCode>
....
Which seems pretty odd to me.
Does anybody have any idea how to solve this? Perhaps there is a JAXB
annotation or a CXF configuration?
/Christian