问题描述
我正在尝试使用CXF创建一个Web服务客户端来使用WCF Web服务。
当我使用wsdl2java时,它使用JAXBElement类型而不是String生成对象。
I'm trying to create a web service client using CXF to consume a WCF web service.When I use wsdl2java it generates objects with JAXBElement types instead of String.
我读到了使用jaxb bindings.xml文件来设置generateElementProperty =false尝试修复问题,但我正在使用的Web服务包含7个导入的模式。
I read about using a jaxb bindings.xml file to set generateElementProperty="false" to try to fix the problem, but the web service I'm consuming contains 7 imported schemas.
如何指定 generateElementProperty =false所有七种模式都有
,或者有没有办法将它应用于所有模式?
How can I specify the generateElementProperty="false"
on all seven schemas, or is there a way to apply it to all schemas?
推荐答案
您必须创建一个绑定文件,如下所示,这将全局应用并将其用作
wsdl2java - bbindings.txtwsdl
You have to create a binding file as below, this will get applied globally and use it aswsdl2java - b "bindings.txt" "wsdl"
<jaxb:bindings version="2.1"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>
这篇关于如何防止JAXBElement< String>从在CXF Web服务客户端生成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!