解决因为服务器调用删除或添加字段后CXF客户端未更新致使异常问题org.apache.cxf.interceptor.Fault: Unmarshalling Error: Unexpected el

采用CXF客户端调用Webservice服务,因为服务端时不时会对Webservice服务删除或添加一些字段,而CXF未及时更新客户端代码致使再次调用服务时报异常错误:php

Interceptor for {Mystifly.OnePoint}OnePoint#{Mystifly.OnePoint}AirRevalidate has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: 意外的元素 (uri:"http://schemas.datacontract.org/2004/07/Mystifly.OnePoint", local:"NameNumbers")。所需元素为<{http://schemas.datacontract.org/2004/07/Mystifly.OnePoint}Services> 

解决这个问题有二个方式:
一、根据最新的服务wsdl规范更新CXF客户端代码html

二、给CXF设置属性禁用CXF的Jabx对xml的检验apache

client.getRequestContext().put("set-jaxb-validation-event-handler", false);

 

转载:https://www.iflym.com/index.php/code/201307310001.htmlspa

相关文章
相关标签/搜索