-
1. Re: wsconsume generates JAXBelement<String> instead of just String for xs:string
ropalka Apr 22, 2010 1:40 AM (in response to vgarmash)This is the question for JAXB project team on java.net because JBossWS is reusing Sun tools.
-
2. Re: wsconsume generates JAXBelement<String> instead of just String for xs:string
vgarmash Apr 22, 2010 4:12 PM (in response to ropalka)you are right - this is binding customization problem. the issue was fixed when I used customized binding file customForMaps.xml (attached) with following content:
<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>
I've added option --binding=<path/to/customForMap.xml> to the command line and finally got correctly generated xs:string properties as lava.lang.String (see attachment)
-
customForMaps.xml 198 bytes
-
Credentials.java.zip 796 bytes
-
-
3. Re: wsconsume generates JAXBelement<String> instead of just String for xs:string
felix-friedrich May 13, 2010 10:21 AM (in response to vgarmash)Hej hej,
in some cases your solution solved my problem. But I still have some cases where the JAXBElement occures in the Java code.
This definition in the WSDL...
<element name="Name" type="tv:NameType"/>
<complexType name="NameType">
<sequence minOccurs="1" maxOccurs="unbounded">
<element name="begin" type="xsd:time" minOccurs="1" maxOccurs="1"/>
<element name="end" type="xsd:time" minOccurs="1" maxOccurs="1"/>
</sequence>
<attribute name="begin" type="tv:AnotherType" use="required"/>
<attribute name="end" type="tv:AnotherType" use="optional"/>
</complexType>... will be this Java code:
@XmlElementRefs({
@XmlElementRef(name = "begin", namespace = "http://...", type = JAXBElement.class),
@XmlElementRef(name = "end", namespace = "http://...", type = JAXBElement.class)
})
protected List<JAXBElement<XMLGregorianCalendar>> beginAndEnd;
@XmlAttribute(required = true)
protected AnotherType begin;
@XmlAttribute
protected AnotherType end;I do not know why there is still this occurence of the JAXBElement and it is not very nice to use in the code. Any suggestions/explanations?
Thanks,
F.
-
4. Re: wsconsume generates JAXBelement<String> instead of just String for xs:string
jim.ma May 13, 2010 10:37 PM (in response to felix-friedrich)Do you really need the maxOccurs="unbounded" in the <sequence minOccurs="1" maxOccurs="unbounded"> ? This attribute makes JAXB generate the JAXBElement list .
If the maxOccurs="unbounded" is what you have to define, then you can try to create another type element for the begin and end sequence to see if this will resolve your problem .
-
5. Re: wsconsume generates JAXBelement<String> instead of just String for xs:string
felix-friedrich May 20, 2010 5:05 AM (in response to jim.ma)Hej,
thanks for your answer, but changing the .wsdl is unfortunately not an option for me.
Felix