[ 
https://issues.apache.org/jira/browse/AXIS2-2578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495484
 ] 

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

Let me explain you the idea behind the XmlbeansDatabindingTemplate.xsl.
Axis2 codegeneration supports many databinding frameworks. eg. 
adb,xmlbeans,jibx,jaxbri
if we take a class like message Receiver (eg. APIMessageReceiverInOut) have a 
part from general template and part from data binidng specifiec framwork.
if you take two methods 

 private  org.apache.axiom.om.OMElement  
toOM(api.op_messages.xsd.GetDetailedMonitoringStagesDocument param, boolean 
optimizeContent){
            org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new 
org.apache.axiom.om.impl.builder.StAXOMBuilder
            (org.apache.axiom.om.OMAbstractFactory.getOMFactory(),new 
org.apache.axis2.util.StreamWrapper(param.newXMLStreamReader())) ;
            org.apache.axiom.om.OMElement documentElement = 
builder.getDocumentElement();

            

            
((org.apache.axiom.om.impl.OMNodeEx)documentElement).setParent(null);
            return documentElement;
            }

public org.apache.xmlbeans.XmlObject fromOM(
        org.apache.axiom.om.OMElement param,
        java.lang.Class type,
        java.util.Map extraNamespaces){
        try{
        

            if 
(api.op_messages.xsd.GetDetailedMonitoringStagesDocument.class.equals(type)){
            if (extraNamespaces!=null){
            return 
api.op_messages.xsd.GetDetailedMonitoringStagesDocument.Factory.parse(
            param.getXMLStreamReaderWithoutCaching(),
            new 
org.apache.xmlbeans.XmlOptions().setLoadAdditionalNamespaces(extraNamespaces));
            }else{
            return 
api.op_messages.xsd.GetDetailedMonitoringStagesDocument.Factory.parse(
            param.getXMLStreamReaderWithoutCaching());
            }
            }

always toOM and fromOM methods comes from the data binidng specific template. 
(i.e. XmlBeansDatabindingTemplate.xsl) So basically we have to concentrate on 
the fromOM and toOM methods of this template. Others are for unwrapping which 
is not using in this case.

the code generates the om element as follows, in toOM method.

org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new 
org.apache.axiom.om.impl.builder.StAXOMBuilder
            (org.apache.axiom.om.OMAbstractFactory.getOMFactory(),new 
org.apache.axis2.util.StreamWrapper(param.newXMLStreamReader())) ;
            org.apache.axiom.om.OMElement documentElement = 
builder.getDocumentElement();

if the param.newXMLStreamReader() generates the correct events, then the 
problem must be with the  StreamWrapper or the StAXOMBuilder class.




> Problems with ADB Client and XMLBeans Service
> ---------------------------------------------
>
>                 Key: AXIS2-2578
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2578
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.1.1
>         Environment: Windows XP SP2, Java 1.5.0-11, Eclipse Codegenerator 
> plugin 1.2.1
>            Reporter: Jorge Fernández
>         Assigned To: Amila Chinthaka Suriarachchi
>         Attachments: API.wsdl, APISkeleton.java, APISkeletonXmlBeans.java, 
> Client.java, ClientXmlBeans.java
>
>
> This JIRA is related with the message from the mailing list "Issue with ADB 
> and parsing a response message (namespaces)"
> I couldn't reproduce the problem I described in that email but when I fixed 
> that problem I found another one and this is which I'm reporting.
> First, some introduction.
> In my response message there is an array of  Stages which have one or more 
> Configurations. Each Configuration has AbstractParameters and 
> PrimitiveParameters (that inherit from Parameter). Also each Parameter may 
> depend on other so the class Parameter has an array of Parameter called 
> dependencies.
> My problem happens only if I have ADB at client side and XMLBeans at service 
> side. Any other combination works perfectly. (I attach the wsdl and client 
> and service for both databindings).
> When my ADB client parses the response message, it enters Stage.Factory.parse 
> method, then it enters, Configuration.Factory.parse method. Next, 
> AbstractParameter.Factory.parse method (because the first parameter is 
> abstract) and later it want to parse the dependencies of this parameter so it 
> enters Parameter.Factory.parse method. Here, there is a PrimitiveParameter 
> with no dependencies on oher parameters so it enters Signal.Factory.parse 
> method for getting signal dependencies. It returns ok
> Finally, the problem comes out when after getting SignalDependencies from 
> this PrimitiveParameter, it gets the Type element which is in the Parameter 
> class and now there is the gain element that is part of PrimitiveParameter 
> and not of his parent. so it throws an exception because it didn't expect it.
> Hope this explanation could be useful but if not, the wsdl could be.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to