axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Antonio (JIRA)" <>
Subject [jira] Commented: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)
Date Tue, 06 Nov 2007 11:13:51 GMT


Jose Antonio commented on AXIS2-3184:

Actually it is possible to determine it since both XmlBeans and JAXB generates code for that
schemas that works as intended. In that case, the mandatory elements are treated as members
of the base clase and the element that don't match any of the other elements is assigned to
the xs:any element.
The problem is that ADB will not parse its own generated classes while changing the order
in that they are read would solve this. Also, the provided schema is from an OASIS standard
so I can't touch it to make ADB happy since it will affect the interoperability.
Anyway, the resolution is won't fix so I guess I will have to live with my current XmlBeans
implementation until Axis2's JAXB integration is mature enough. 
Thank you anyway.

> Databinding cannot parse itself (Unexpected subelement)
> -------------------------------------------------------
>                 Key: AXIS2-3184
>                 URL:
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.3
>         Environment: JDK 1.5 and 1.6, Ubuntu Linux 7.04
>            Reporter: Jose Antonio
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments:,,
> Hello, I'm developing a web service specification with Axis2 1.3 and
> I've generated the code using ADB. That specification has a type B
> that extends type A and in some circumstances I want to convert an
> object of type A to B so I did something like:
> elem = A.getContent().getOMElement(,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b
> To get it better, I have the following code:
> RegistrationContext ctx = new RegistrationContext();
> RegistrationContextType ctxContent = new RegistrationContextType();
> ContextIdentifierType ctxId = new ContextIdentifierType();
> ctxId.setAnyURI(new URI("http://adapt20/0"));
> ctxContent.setContextIdentifier(ctxId);
> ServiceRefType regSrvc = new ServiceRefType();
> regSrvc.setExtraElement(AddressingUtils.eprToOM(new
> EndpointReference("http://localhost/registration")));
> ctxContent.setRegistrationService(regSrvc );
> ctx.setRegistrationContext(ctxContent);
> OMElement regCtxElem = ctx.getOMElement(null, OMAbstractFactory.getOMFactory());
> System.out.println("Created registration context element:");
> System.out.println(regCtxElem.toString());
> RegistrationContext newRegCtx =
> RegistrationContext.Factory.parse(regCtxElem.getXMLStreamReader());
> So what I'm doing is basically creating an object of type B, getting
> an OMElement from it and then parsing it through B.Factory.parse
> method. It should work but I get the following exception:
> java.lang.Exception: org.apache.axis2.databinding.ADBException:
> Unexpected subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(
>        at org.oasis.wscaf.tests.DatabindingTest.main(
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> So I'm doing this through the getOMElement method.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message