Pranab Baishya created CXF-5427:
-----------------------------------
Summary: set-jaxb-validation-event-handler=false not working when
fault message is changed.
Key: CXF-5427
URL: https://issues.apache.org/jira/browse/CXF-5427
Project: CXF
Issue Type: Bug
Components: JAXB Databinding
Affects Versions: 2.6.2
Environment: CXF 2.6.2, JAXB2.2.4
Reporter: Pranab Baishya
Hello,
We have a requirement to consumed web services for non-breaking changes in the
producer web services so that we need not generate/ recompile CXF generated
clients code every time for some non breaking changes in the Web service
producer/server.
The changes that can happen in the producer web services or server are as
follows:
1.Changes to the Data Structures such as addition of a new element at the end
for both inbound and outbound messages.
This has an impact on the CXF client as if the data structure changes, in the
client code, we will get marshal and unmarshall error. To resolve the issue, we
did a small fix to add
@EndpointProperties({@EndpointProperty(key =
"set-jaxb-validation-event-handler", value="false")})
in the Service interfaces code generated by CXF . This fix seems to fix the
problem when the message are in request and response format.
But, the above fix is not taking care of the scenerio when the CXF client is
receiving a fault error message and there is a change in the structure of fault
error message say, a new field is added to the message which is not available
in the cxf generated code.
The XML structure of response in error scenario:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>s:eInvalidArguments</faultcode>
<faultstring xml:lang="en-US">eInvalidArguments</faultstring>
<detail>
<Error xmlns="<abc>"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<CorrelationId xmlns="<abc>">1234</CorrelationId>
<DateTime xmlns="<abc>">XXXX-XX-XXTXX:XX:XX.XXXXXXXX</DateTime>
<Description xmlns="<abc>">eInvalidArguments</Description>
<InternalDescription xmlns="<abc>">Access denied to this
user</InternalDescription>
<Type>eInvalidArguments</Type>
<UserToken xmlns:a="<abc>">
<a:Status>Ok</a:Status>
<a:Token>xyz</a:Token>
</UserToken>
<InternalErrorCode>1</InternalErrorCode>
</Error>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Here, internalErrorCode is a newly added element in the webservice which is
breaking our client code by throwing "unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element"
because the in the generated client code InternalErrorCode field doesnt exists.
We are not getting the marshal and unmarshall exception in case of proper
request and response message even though there is change in the inbound or
outbound message.
Can we fix the issue quickly or CXF provide any quick fix for the fault error
scenerio when there is a change in the error structure. Pleas suggest.
--
This message was sent by Atlassian JIRA
(v6.1#6144)