You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Jose Antonio (JIRA)" <ji...@apache.org> on 2007/09/07 13:55:31 UTC

[jira] Created: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Databinding cannot parse itself (Unexpected subelement)
-------------------------------------------------------

                 Key: AXIS2-3184
                 URL: https://issues.apache.org/jira/browse/AXIS2-3184
             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


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(B.name,factory);
B.parse(elem);

But I got an exception saying:
Unexpected subelement b

where b B.name.localpart.

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(RegistrationContextType.java:1103)
       at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
       at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
Caused by: org.apache.axis2.databinding.ADBException: Unexpected
subelement registrationContext
       at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
       ... 2 more

Which is strange since registrationContext is the local name of
RegistrationContext class.

I cannot use the getPullParser method because of this bug:
https://issues.apache.org/jira/browse/AXIS2-3028
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528700 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-3184:
-----------------------------------------------------

For the begin class problem, yes it would give you an error since it can not determine the element belongs to the any element or the type element.
is this the case for the Registrationcontext (I could not find this type) class as well?

> Databinding cannot parse itself (Unexpected subelement)
> -------------------------------------------------------
>
>                 Key: AXIS2-3184
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3184
>             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: Begin.java, wsctx-specification.zip
>
>
> 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(B.name,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b B.name.localpart.
> 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(RegistrationContextType.java:1103)
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
>        at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> https://issues.apache.org/jira/browse/AXIS2-3028
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jose Antonio updated AXIS2-3184:
--------------------------------

    Attachment: wscf.zip

> Databinding cannot parse itself (Unexpected subelement)
> -------------------------------------------------------
>
>                 Key: AXIS2-3184
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3184
>             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: Begin.java, wscf.zip, wsctx-specification.zip
>
>
> 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(B.name,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b B.name.localpart.
> 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(RegistrationContextType.java:1103)
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
>        at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> https://issues.apache.org/jira/browse/AXIS2-3028
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525690 ] 

Jose Antonio commented on AXIS2-3184:
-------------------------------------

I've attached a WSDL and XSD file of one of the specifications that I'm implementing. Generating a stub for the "context service"  service and then trying to invoke it I get the following input SOAP message:

<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
         <ns3:begin xmlns:ns3="http://docs.oasis-open.org/ws-caf/2005/10/wsctx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:begin">
            <ns3:type>http://org.objectweb.wscaf.wsctx/contextType</ns3:type>
         </ns3:begin>
      </soapenv:Body>
   </soapenv:Envelope>

Which is correct but in the server I get the following exception:


<soapenv:Envelope
	xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
	<soapenv:Body>
		<soapenv:Fault>
			<faultcode>soapenv:Server</faultcode>
			<faultstring>
				org.apache.axis2.databinding.ADBException: Unexpected
				subelement begin
			</faultstring>
			<detail>
				<Exception>
					org.apache.axis2.AxisFault:
					org.apache.axis2.databinding.ADBException:
					Unexpected subelement begin at
					org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
					at
					org.oasis.wscaf.middleware.wsctx.service.ContextServiceMessageReceiverInOut.fromOM(ContextServiceMessageReceiverInOut.java:407)
					at
					org.oasis.wscaf.middleware.wsctx.service.ContextServiceMessageReceiverInOut.invokeBusinessLogic(ContextServiceMessageReceiverInOut.java:43)
					at
					org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
					at
					org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
					at
					org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
					at
					org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
					at
					org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
					at
					javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
					at
					javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
					at
					org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
					at
					org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
					at
					org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
					at
					org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
					at
					org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
					at
					org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
					at
					org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
					at
					org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
					at
					org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
					at
					org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
					at
					org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
					at java.lang.Thread.run(Thread.java:619)Caused by:
					java.lang.Exception:
					org.apache.axis2.databinding.ADBException:
					Unexpected subelement begin at
					org.oasis.wscaf.types.wsctx.Begin$Factory.parse(Begin.java:588)
					at
					org.oasis.wscaf.middleware.wsctx.service.ContextServiceMessageReceiverInOut.fromOM(ContextServiceMessageReceiverInOut.java:348)
					... 20 moreCaused by:
					org.apache.axis2.databinding.ADBException:
					Unexpected subelement begin at
					org.oasis.wscaf.types.wsctx.Begin$Factory.parse(Begin.java:559)
					... 21 more
				</Exception>
			</detail>
		</soapenv:Fault>
	</soapenv:Body>
</soapenv:Envelope>

> Databinding cannot parse itself (Unexpected subelement)
> -------------------------------------------------------
>
>                 Key: AXIS2-3184
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3184
>             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
>
> 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(B.name,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b B.name.localpart.
> 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(RegistrationContextType.java:1103)
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
>        at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> https://issues.apache.org/jira/browse/AXIS2-3028
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amila Chinthaka Suriarachchi resolved AXIS2-3184.
-------------------------------------------------

    Resolution: Won't Fix

here actually it is not possible to determine whether the element intended to xs:any or the type. So with adb always you have to use the xs:any at last if minOccurs is 0.

> Databinding cannot parse itself (Unexpected subelement)
> -------------------------------------------------------
>
>                 Key: AXIS2-3184
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3184
>             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: Begin.java, wscf.zip, wsctx-specification.zip
>
>
> 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(B.name,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b B.name.localpart.
> 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(RegistrationContextType.java:1103)
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
>        at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> https://issues.apache.org/jira/browse/AXIS2-3028
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jose Antonio updated AXIS2-3184:
--------------------------------

    Attachment: wsctx-specification.zip

The WSDL I'm using. I'm invoking the ContextService service.

> Databinding cannot parse itself (Unexpected subelement)
> -------------------------------------------------------
>
>                 Key: AXIS2-3184
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3184
>             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
>         Attachments: wsctx-specification.zip
>
>
> 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(B.name,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b B.name.localpart.
> 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(RegistrationContextType.java:1103)
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
>        at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> https://issues.apache.org/jira/browse/AXIS2-3028
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deepal Jayasinghe updated AXIS2-3184:
-------------------------------------

    Assignee: Amila Chinthaka Suriarachchi

> Databinding cannot parse itself (Unexpected subelement)
> -------------------------------------------------------
>
>                 Key: AXIS2-3184
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3184
>             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: Begin.java, wsctx-specification.zip
>
>
> 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(B.name,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b B.name.localpart.
> 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(RegistrationContextType.java:1103)
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
>        at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> https://issues.apache.org/jira/browse/AXIS2-3028
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528724 ] 

Jose Antonio commented on AXIS2-3184:
-------------------------------------

Yes, it's the same case for RegistrationContext since it extends Context and Context has some optional xsd:any elements at the end, so mandatory elements from RegistrationContext are considered optional Context elements.

XMLBeans doesn't have this problem. The same pseudo-XML fragment is correctly parsed when using any of the two types. For example, the fragment

<context>
  <context-identifier>id1</>
  <registration-service>reg</>
</context>

is parsed by Context as a ContextType with context-identifier=id1 and and optional any element named registration-context with value reg
On the other hand, when the following fragment is parsed by RegistrationContext class

<registrationContext>
  <context-identifier>id1</>
  <registration-service>reg</>
</registrationContext>

It's parsed as a RegistrationContextType with context-identifier=id1and a mandatory element registration-service=reg

> Databinding cannot parse itself (Unexpected subelement)
> -------------------------------------------------------
>
>                 Key: AXIS2-3184
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3184
>             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: Begin.java, wscf.zip, wsctx-specification.zip
>
>
> 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(B.name,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b B.name.localpart.
> 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(RegistrationContextType.java:1103)
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
>        at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> https://issues.apache.org/jira/browse/AXIS2-3028
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540418 ] 

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: https://issues.apache.org/jira/browse/AXIS2-3184
>             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: Begin.java, wscf.zip, wsctx-specification.zip
>
>
> 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(B.name,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b B.name.localpart.
> 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(RegistrationContextType.java:1103)
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
>        at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> https://issues.apache.org/jira/browse/AXIS2-3028
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3184) Databinding cannot parse itself (Unexpected subelement)

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jose Antonio updated AXIS2-3184:
--------------------------------

    Attachment: Begin.java

I've been playing with the generated Begin class and debugging how it works.

In the XSD, Begin is defined as:

<xs:complexType name="AssertionType">
        <xs:sequence>
            <xs:any minOccurs="0" namespace="##other" processContents="lax"/>
        </xs:sequence>
        <xs:attribute ref="wsu:Id" use="optional"/>
    </xs:complexType>
    <xs:element name="begin">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="tns:AssertionType">
                    <xs:sequence>
                        <xs:element name="type" type="xs:QName"/>
                        <xs:element name="expiresAt" minOccurs="0">
                            <xs:simpleType>
                                <xs:union memberTypes="xs:dateTime">
                                    <xs:simpleType>
                                        <xs:restriction base="xs:token">
                                            <xs:enumeration value=""/>
                                        </xs:restriction>
                                    </xs:simpleType>
                                </xs:union>
                            </xs:simpleType>
                        </xs:element>
                    </xs:sequence>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

So it has a mandatory element "type" and an optional "any" element. 
This is the generated parse method:

public static Begin parse(javax.xml.stream.XMLStreamReader reader)
				throws java.lang.Exception {
			Begin object = new Begin();

			int event;
			java.lang.String nillableValue = null;
			java.lang.String prefix = "";
			java.lang.String namespaceuri = "";
			try {

				while (!reader.isStartElement() && !reader.isEndElement())
					reader.next();

				if (reader.getAttributeValue(
						"http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
					java.lang.String fullTypeName = reader
							.getAttributeValue(
									"http://www.w3.org/2001/XMLSchema-instance",
									"type");
					if (fullTypeName != null) {
						java.lang.String nsPrefix = null;
						if (fullTypeName.indexOf(":") > -1) {
							nsPrefix = fullTypeName.substring(0, fullTypeName
									.indexOf(":"));
						}
						nsPrefix = nsPrefix == null ? "" : nsPrefix;

						java.lang.String type = fullTypeName
								.substring(fullTypeName.indexOf(":") + 1);

						if (!"begin".equals(type)) {
							// find namespace for the prefix
							java.lang.String nsUri = reader
									.getNamespaceContext().getNamespaceURI(
											nsPrefix);
							return (Begin) org.oasis_open.docs.ws_caf._2005._10.wsctx.ExtensionMapper
									.getTypeObject(nsUri, type, reader);
						}

					}

				}

				// Note all attributes that were handled. Used to differ normal
				// attributes
				// from anyAttributes.
				java.util.Vector handledAttributes = new java.util.Vector();

				// handle attribute "Id"
				java.lang.String tempAttribId =

				reader
						.getAttributeValue(
								"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd",
								"Id");

				if (tempAttribId != null) {
					java.lang.String content = tempAttribId;

					object
							.setId(org.apache.axis2.databinding.utils.ConverterUtil
									.convertToID(tempAttribId));

				} else {

				}
				handledAttributes.add("Id");
*****************************************************************************
				reader.next();

				while (!reader.isStartElement() && !reader.isEndElement())
					reader.next();

				if (reader.isStartElement()) {

					// use the QName from the parser as the name for the builder
					javax.xml.namespace.QName startQname1 = reader.getName();

					// We need to wrap the reader so that it produces a fake
					// START_DOCUMENT event
					// this is needed by the builder classes
					org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(
							new org.apache.axis2.util.StreamWrapper(reader),
							startQname1);
					object.setExtraElement(builder1.getOMElement());

					reader.next();

				} // End of if for expected property start element

				else {

				}
***************************************************************************************
				while (!reader.isStartElement() && !reader.isEndElement())
					reader.next();

				if (reader.isStartElement()
						&& new javax.xml.namespace.QName(
								"http://docs.oasis-open.org/ws-caf/2005/10/wsctx",
								"type").equals(reader.getName())) {

					java.lang.String content = reader.getElementText();

					int index = content.indexOf(":");
					if (index > 0) {
						prefix = content.substring(0, index);
					} else {
						prefix = "";
					}
					namespaceuri = reader.getNamespaceURI(prefix);
					object
							.setType(org.apache.axis2.databinding.utils.ConverterUtil
									.convertToQName(content, namespaceuri));

					reader.next();

				} // End of if for expected property start element

				else {
					// A start element we are not expecting indicates an invalid
					// parameter was passed
					throw new org.apache.axis2.databinding.ADBException(
							"Unexpected subelement " + reader.getLocalName());
				}

				while (!reader.isStartElement() && !reader.isEndElement())
					reader.next();

				if (reader.isStartElement()
						&& new javax.xml.namespace.QName(
								"http://docs.oasis-open.org/ws-caf/2005/10/wsctx",
								"expiresAt").equals(reader.getName())) {

					object
							.setExpiresAt(org.oasis_open.docs.ws_caf._2005._10.wsctx.ExpiresAt_type1.Factory
									.parse(reader));

					reader.next();

				} // End of if for expected property start element

				else {

				}

				while (!reader.isStartElement() && !reader.isEndElement())
					reader.next();

				if (reader.isStartElement())
					// A start element we are not expecting indicates a trailing
					// invalid property
					throw new org.apache.axis2.databinding.ADBException(
							"Unexpected subelement " + reader.getLocalName());

			} catch (javax.xml.stream.XMLStreamException e) {
				throw new java.lang.Exception(e);
			}

			return object;
		}

I've marked the problem. It reads the first element and assigns its value to the ExtraElement, which is optional, and then tries to read the mandatory "type" element. In that case, that element could be the only element in the begin message and in that case, it is assigned to the extraElement field, instead of its type element.

Changing the marked code to the end and deleting the code:
// A start element we are not expecting indicates an invalid
					// parameter was passed
					throw new org.apache.axis2.databinding.ADBException(
							"Unexpected subelement " + reader.getLocalName());

from the else section in the "type" read statement works for that class.

> Databinding cannot parse itself (Unexpected subelement)
> -------------------------------------------------------
>
>                 Key: AXIS2-3184
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3184
>             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
>         Attachments: Begin.java, wsctx-specification.zip
>
>
> 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(B.name,factory);
> B.parse(elem);
> But I got an exception saying:
> Unexpected subelement b
> where b B.name.localpart.
> 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(RegistrationContextType.java:1103)
>        at org.oasis.wscaf.types.wscf.RegistrationContext$Factory.parse(RegistrationContext.java:307)
>        at org.oasis.wscaf.tests.DatabindingTest.main(DatabindingTest.java:52)
> Caused by: org.apache.axis2.databinding.ADBException: Unexpected
> subelement registrationContext
>        at org.oasis.wscaf.types.wscf.RegistrationContextType$Factory.parse(RegistrationContextType.java:907)
>        ... 2 more
> Which is strange since registrationContext is the local name of
> RegistrationContext class.
> I cannot use the getPullParser method because of this bug:
> https://issues.apache.org/jira/browse/AXIS2-3028
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org