Here's what I did to solve this problem.

1) Upgraded to JAXB v2.1.3.  You can find the 3 required jar files
(jaxb-api, jaxb-impl, & jaxb-xjc) here: https://jaxb.dev.java.net/2.1.3/ . 
JAXB v2.1.3 allows you to specify generateElementProperty=false so that
Strings will be referenced as Strings and not JAXBElements.  Only 2.1.x
supports this, I believe.

2) Created a jaxb bindings file that specifies the generateElementProperty. 
I did it at the globalBindings level.  My bindings file (let's call it
"myjaxb-bindings.xjb") looks like this:

<jxb:bindings version="2.0"
              xmlns:jxb="http://java.sun.com/xml/ns/jaxb";
              xmlns:xs="http://www.w3.org/2001/XMLSchema";>
        <jxb:globalBindings generateElementProperty="false" />
</jxb:bindings>

3)  Specify this binding file as an external binding for the client
generator WSGen.  In an ant file, you would add:
externalBindings="myjaxb-bindings.xjb" to the wsgen task.  Or,  if you use
WSGen from the command line, add "-externalBindings myjaxb-bindings.xjb" to
the command.

Once I did those things I got true Strings instead of JAXBElements.


>>Is there a way that I can alter the wsgen code generation so that
>>getUsername() will return a String instead of a JAXBElement<String>?
> Thanks.
>>  
>>
> 
> 
> --
> Dan Diephouse
> (616) 971-2053
> Envoi Solutions LLC
> http://netzooid.com
> 
> 


-- 
View this message in context: 
http://www.nabble.com/unexpected-code-generation-with-wsgen-and-jaxb-binding-tf2598336.html#a10686184
Sent from the XFire - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to