You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by MRneedHelp <ma...@freenet.de> on 2016/09/23 07:18:02 UTC

Unmarshalling Error: unexpected element

Hi,

now that I have cxf working, i tried to play around with it a bit. I got the
following exception, when I deleted one attribute of my response class from
server:

Unmarshalling Error: unexpected element (URI:"", lokal:"Uname"). expected
elements are
<{}Vorna>,<{}Street>,<{}KostlTxt>,<{}Gbdat>,<{}Kostl>,<{}Mobil>, .... etc.

I know, this exception comes from the fact, that I deleted the attribute
"uname" from my class. I did this, because I wanted to know, what happens,
when the SAP server ( to which I connect and request some personal
information) put a new attribute to its response, like a room number or what
ever.

So my question is: Is there a way to ignore that extra attribute and dont
get the "Unmarshalling Error" at runtime, so that my program does not crash?
I would send me an email, if an attribute is added, so that I can add it
then to my code, to consider it.

Thank you in advance.

Matthew



--
View this message in context: http://cxf.547215.n5.nabble.com/Unmarshalling-Error-unexpected-element-tp5772977.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Unmarshalling Error: unexpected element

Posted by MRneedHelp <ma...@freenet.de>.
Thank you, it was not as complicated as intended.

I took the MyCostumHandler from 
https://issues.apache.org/jira/secure/attachment/12614586/apacheCXF-trunk-CustomMarshallingEventValidator.patch
<https://issues.apache.org/jira/secure/attachment/12614586/apacheCXF-trunk-CustomMarshallingEventValidator.patch>  
and modified it a bit.

Then I added it to the properties.

One thing, that i noticed: is it correct, that it is completely no matter
what you give the "set-jaxb-validation-event-handler" as second param.

outProps.put("set-jaxb-validation-event-handler", new Object());
outProps.put("set-jaxb-validation-event-handler", "hallo");
This works exactly the same for me as
outProps.put("set-jaxb-validation-event-handler", "false");

Only outProps.put("set-jaxb-validation-event-handler", "true") does not
deactivate the validation.

Matthew



--
View this message in context: http://cxf.547215.n5.nabble.com/Re-Unmarshalling-Error-unexpected-element-tp5772986p5772995.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Unmarshalling Error: unexpected element

Posted by Daniel Kulp <dk...@apache.org>.
You may need to write your own javax.xml.bind.ValidationEventHandler and set the in via the "jaxb-reader-validation-event-handler” property.  Not sure how complex that might be.

Dan



> On Sep 23, 2016, at 4:30 AM, Matthias Rudingsdorfer <ma...@freenet.de> wrote:
> 
> Hi Dan,
> 
> Thank you. I found this solution in the web, too, and it works perfectly.
> But now the error is just ignored. Can I see somewhere whether the error occurred? So that i can send me an email?
> 
> Matthew
> 
> Gesendet mit AquaMail für Android
> http://www.aqua-mail.com <http://www.aqua-mail.com/>
> I believe if you set the property:
> 
> "set-jaxb-validation-event-handler”
> 
> to false, we wouldn’t install the event handler that generates this error and any unknown things just get ignored.
> 
> Dan
> 
> 
> 
>> On Sep 23, 2016, at 3:18 AM, MRneedHelp <matthias.rudingsdorfer@freenet.de <ma...@freenet.de>> wrote:
>> 
>> Hi,
>> 
>> now that I have cxf working, i tried to play around with it a bit. I got the
>> following exception, when I deleted one attribute of my response class from
>> server:
>> 
>> Unmarshalling Error: unexpected element (URI:"", lokal:"Uname"). expected
>> elements are
>> <{}Vorna>, <{}Street>,<{}KostlTxt>,<{}Gbdat>,<{}Kostl>,<{}Mobil>, .... etc.
>> 
>> I know, this exception comes from the fact, that I deleted the attribute
>> "uname" from my class. I did this, because I wanted to know, what happens,
>> when the SAP server ( to which I connect and request some personal
>> information) put a new attribute to its response, like a room number or what
>> ever.
>> 
>> So my question is: Is there a way to ignore that extra attribute and dont
>> get the "Unmarshalling Error" at runtime, so that my program does not crash?
>> I would send me an email, if an attribute is added, so that I can add it
>> then to my code, to consider it.
>> 
>> Thank you in advance.
>> 
>> Matthew
>> 
>> 
>> 
>> --
>> View this message in context: http://cxf.547215.n5.nabble.com/Unmarshalling-Error-unexpected-element-tp5772977.html <http://cxf.547215.n5.nabble.com/Unmarshalling-Error-unexpected-element-tp5772977.html>
>> Sent from the cxf-user mailing list archive at Nabble.com <http://nabble.com/>.
> 
> -- 
> Daniel Kulp
> dkulp@apache.org <ma...@apache.org> - http://dankulp.com/blog <http://dankulp.com/blog>
> Talend Community Coder - http://coders.talend.com <http://coders.talend.com/>

-- 
Daniel Kulp
dkulp@apache.org <ma...@apache.org> - http://dankulp.com/blog <http://dankulp.com/blog>
Talend Community Coder - http://coders.talend.com <http://coders.talend.com/>

Re: Unmarshalling Error: unexpected element

Posted by Matthias Rudingsdorfer <ma...@freenet.de>.
Hi Dan,

Thank you. I found this solution in the web, too, and it works perfectly.
But now the error is just ignored. Can I see somewhere whether the error 
occurred? So that i can send me an email?

Matthew

Gesendet mit AquaMail f�r Android
http://www.aqua-mail.com


I believe if you set the property:

"set-jaxb-validation-event-handler\u201d

to false, we wouldn\u2019t install the event handler that generates this error 
and any unknown things just get ignored.

Dan



> On Sep 23, 2016, at 3:18 AM, MRneedHelp <ma...@freenet.de> 
> wrote:
>
> Hi,
>
> now that I have cxf working, i tried to play around with it a bit. I got the
> following exception, when I deleted one attribute of my response class from
> server:
>
> Unmarshalling Error: unexpected element (URI:"", lokal:"Uname"). expected
> elements are
> <{}Vorna>,<{}Street>,<{}KostlTxt>,<{}Gbdat>,<{}Kostl>,<{}Mobil>, .... etc.
>
> I know, this exception comes from the fact, that I deleted the attribute
> "uname" from my class. I did this, because I wanted to know, what happens,
> when the SAP server ( to which I connect and request some personal
> information) put a new attribute to its response, like a room number or what
> ever.
>
> So my question is: Is there a way to ignore that extra attribute and dont
> get the "Unmarshalling Error" at runtime, so that my program does not crash?
> I would send me an email, if an attribute is added, so that I can add it
> then to my code, to consider it.
>
> Thank you in advance.
>
> Matthew
>
>
>
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/Unmarshalling-Error-unexpected-element-tp5772977.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org <ma...@apache.org> - http://dankulp.com/blog 
<http://dankulp.com/blog>
Talend Community Coder - http://coders.talend.com <http://coders.talend.com/>

Re: Unmarshalling Error: unexpected element

Posted by Daniel Kulp <dk...@apache.org>.
I believe if you set the property:

"set-jaxb-validation-event-handler”

to false, we wouldn’t install the event handler that generates this error and any unknown things just get ignored.

Dan



> On Sep 23, 2016, at 3:18 AM, MRneedHelp <ma...@freenet.de> wrote:
> 
> Hi,
> 
> now that I have cxf working, i tried to play around with it a bit. I got the
> following exception, when I deleted one attribute of my response class from
> server:
> 
> Unmarshalling Error: unexpected element (URI:"", lokal:"Uname"). expected
> elements are
> <{}Vorna>,<{}Street>,<{}KostlTxt>,<{}Gbdat>,<{}Kostl>,<{}Mobil>, .... etc.
> 
> I know, this exception comes from the fact, that I deleted the attribute
> "uname" from my class. I did this, because I wanted to know, what happens,
> when the SAP server ( to which I connect and request some personal
> information) put a new attribute to its response, like a room number or what
> ever.
> 
> So my question is: Is there a way to ignore that extra attribute and dont
> get the "Unmarshalling Error" at runtime, so that my program does not crash?
> I would send me an email, if an attribute is added, so that I can add it
> then to my code, to consider it.
> 
> Thank you in advance.
> 
> Matthew
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Unmarshalling-Error-unexpected-element-tp5772977.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org <ma...@apache.org> - http://dankulp.com/blog <http://dankulp.com/blog>
Talend Community Coder - http://coders.talend.com <http://coders.talend.com/>