Use configuration in CXF to avoid adding fields that cause clients to update issues
Http://www.iflym.com/index.php/code/201307310001.html
Use configuration in CXF to avoid adding fields that cause clients to update issues
2013/07/31 11:00:19
1 CommentTAGS:CXF, WebService Posted:Java Development, open source framework, programming development
When using CXF to implement WebService, the common problem is that if you modify the signature implementation of an interface on the server, such as adding a field, or deleting a field. In this case, in the default configuration, the following error message is reported:
1 |
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element . Expected elements are |
This error is that the client uses a transport object that does not match the field of the parameter received by the server. However, if you need to update the client every time you modify the implementation of the server, there will be some problems, such as in some cases, the client's update is not possible (such as not within their grasp, or the service can not be easily updated, or other plans).
If you avoid this problem, it is also very simple, is to disable the field information validation in CXF, if this validation is disabled, the corresponding field information will no longer be verified, and the field will not be automatically ignored. The entire solution only needs to add the following line configuration to add the following configuration entries in the Cxf.xml (Spring integration file):
123 |
< cxf:properties > < entry key = "set-jaxb-validation-event-handler" value = "false" /> </ cxf:properties > |
This will disable data validation for all CXF, and in most cases this will meet our requirements (unless you have additional and CXF integrated data validation requirements).
Use configuration in CXF to avoid adding fields that cause clients to update issues