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

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> 

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

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

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

 

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

相关文章:

  • 2021-10-06
  • 2021-08-05
  • 2021-07-17
  • 2021-05-29
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
猜你喜欢
  • 2021-07-25
  • 2021-07-07
  • 2021-08-08
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-09-29
相关资源
相似解决方案