问题描述
我正在尝试使用 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 - b "bindings.txt" "wsdl"
You have to create a binding file as below, this will get applied globally and use it as wsdl2java - b "bindings.txt" "wsdl"
<jaxb:bindings version="2.1" xmlns:jaxb="http://www.51sjk.com/Upload/Articles/1/0/337/337242_20221117112640066.jpg" xmlns:xjc="http://www.51sjk.com/Upload/Articles/1/0/337/337242_20221117112640066.jpg/xjc" xmlns:xs="http://www.51sjk.com/Upload/Articles/1/0/337/337242_20221117112641333.jpg"> <jaxb:globalBindings generateElementProperty="false"/> </jaxb:bindings>