Hi guys,
Tried several approaches with adding binding information to wsdl2java
command but no improvements.
I don't mind playing with JAXBElement objects but I can't get my values out
of it. Here's my java code:
...
QUPAMT101103CAPersonName wPersonName = pCandidatesReqWS
.getQUPAIN101103CA().getControlActProcess()
.getQueryByParameter().getValue().getPersonName();
PN wPn = wPersonName.getValue();
StringBuffer wCandidateName = new StringBuffer();
for (Serializable wSerializable :
wPersonName.getValue().getContent()) {
System.out.println(wSerializable);
}
...
The for loop is actually looping on JAXBElements. The object is there but
all attributes are null! When I debug in eclipse and inspect the objects, I
can't see my values (toto and tata) that I have in my xml.
...
toto
tata
...
Is there a helper class to unmarshal the value out of a JAXBElement object?
- Erick
Glen Mazza-3 wrote:
>
> On 10.03.2011 16:28, KARR, DAVID (ATTSI) wrote:
>>> -----Original Message-----
>>> From: eaudet [mailto:[email protected]]
>>> Sent: Thursday, March 10, 2011 1:23 PM
>>> To: [email protected]
>>> Subject: How to get String values out of a JAXBElement object
>>>
>>> Hi,
>>>
>>> I am facing an issue with wsdl2java tool. I read in several other
>>> threads
>>> that you can use a binding to get rid of JAXBElement classes. My wsdl
>>> is
>>> using a complex HL7 schema. wsdl2java generates all the classes
>> without
>>> problems. All classes reflects the schema but at some points, the
>>> element
>>> is a JAXBElement. For some reason, wsdl2java did not generate a class
>>> Value
>>> with children Family and Given classes. Can someone help in getting
>> rid
>>> of
>>> those JAXBElement classes or can tell me how to get the value "toto"
>>> and
>>> "tata" from my objects?
>> In my experience, the reason xjc "punts" on the code generation is when
>> it finds constructs that can't map directly from schema to Java. For
>> instance, it's legal inside an XML schema element to define two elements
>> with the same name. Once you do that, however, xjc cannot generate
>> strongly-typed properties in the class representing that element. I
>> suppose it's possible you could integrate xjc bindings that would
>> override this, but I'm not sure.
>
> Information on JAXB customizations (if that turns out to be the solution):
> http://www.jroller.com/gmazza/entry/customizing_jaxb_artifacts
>
> Glen
>
> --
> Glen Mazza
> Software Engineer, Talend (http://www.talend.com)
> blog: http://www.jroller.com/gmazza
>
Glen Mazza-3 wrote:
>
> On 10.03.2011 16:28, KARR, DAVID (ATTSI) wrote:
>>> -----Original Message-----
>>> From: eaudet [mailto:[email protected]]
>>> Sent: Thursday, March 10, 2011 1:23 PM
>>> To: [email protected]
>>> Subject: How to get String values out of a JAXBElement object
>>>
>>> Hi,
>>>
>>> I am facing an issue with wsdl2java tool. I read in several other
>>> threads
>>> that you can use a binding to get rid of JAXBElement classes. My wsdl
>>> is
>>> using a complex HL7 schema. wsdl2java generates all the classes
>> without
>>> problems. All classes reflects the schema but at some points, the
>>> element
>>> is a JAXBElement. For some reason, wsdl2java did not generate a class
>>> Value
>>> with children Family and Given classes. Can someone help in getting
>> rid
>>> of
>>> those JAXBElement classes or can tell me how to get the value "toto"
>>> and
>>> "tata" from my objects?
>> In my experience, the reason xjc "punts" on the code generation is when
>> it finds constructs that can't map directly from schema to Java. For
>> instance, it's legal inside an XML schema element to define two elements
>> with the same name. Once you do that, however, xjc cannot generate
>> strongly-typed properties in the class representing that element. I
>> suppose it's possible you could integrate xjc bindings that would
>> override this, but I'm not sure.
>
> Information on JAXB customizations (if that turns out to be the solution):
> http://www.jroller.com/gmazza/entry/customizing_jaxb_artifacts
>
> Glen
>
> --
> Glen Mazza
> Software Engineer, Talend (http://www.talend.com)
> blog: http://www.jroller.com/gmazza
>
--
View this message in context:
http://cxf.547215.n5.nabble.com/How-to-get-String-values-out-of-a-JAXBElement-object-tp3424129p3583222.html
Sent from the cxf-user mailing list archive at Nabble.com.