I’m a C# developer, but recently I had to rewrite a version of my app in Java.
The C# app works with a WCF host/client transmitting custom objects. Since Java is not my specialty I struggled a little to create a working web service that communicated with my WCF host, but I managed to do it. In the process of parsing the WCF custom objects, apparently, Java does most of the work for me, creating all the classes and objects.
However, in any String property of my custom object, it defined it as an JAXBElement. Each of the others properties in this generated class are saved to an XML file, except for those created as “JAXB” properties.
Searching the web I found several articles declaring that the following code would prevent the generation of such property type (leaving only the original property type, in my case String)
<jaxb:bindings version="2.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:bindings schemaLocation="schema-importedby-wcfsvcwsdl"
node="/xs:schema">
<jaxb:globalBindings generateElementProperty="false"/>
</jxb:bindings>
The only problem is that it doesn’t say where do I put this code. In my project I have several wsdl and xml files, and though I tried it in a few, none seems to work.
Thanks
Add parameter to generation tool – xjc.
in console / tool add parameter :
xjc -verbose -b bindings.xml -wsdl my_wsdl_from_c_sharp.wsdl …
or if you use wsdl2java: wsdl2java -b bindings.xml …