Hi group,

I am currently wondering, if I misuse the API or if I've found a bug in the 
Axis2 API.

We are implementing the PLM Services standard and have generated classes for 
this with ADB. The xml data schema of PLM Services makes use of inheritance a 
lot.
We have a generic web service client for all kind of services which works in 
the way that it generates the soap body content as OMElement and uses the 
OperationClient API to execute the web service call.
In order to get OMElements out of the ADB classes we use the getOMElement() 
method which is generated for each ADBBean.

When Axis2 tries to serialize it, it fails to declare the namespace in all the 
correct places, see the following example.
<plms:query xmlns:ns13="urn:omg.org/plm20/computational/query/proxy" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="ns13:Proxy_query">
            <Next_query xmlns="urn:omg.org/plm20/computational/query/utility" 
xmlns:ns9="urn:omg.org/plm20/computational/query/specific" 
xsi:type="ns9:Associated_approval_query">
                        
<ns9:Relating_type_name>Item_version</ns9:Relating_type_name>
            </Next_query>
            <Next_query xmlns="urn:omg.org/plm20/computational/query/utility" 
xsi:type="ns9:Alias_identification_query">
                        <ns9:Relating_type_name 
xmlns:ns9="urn:omg.org/plm20/computational/query/specific">Item_version</ns9:Relating_type_name>
            </Next_query>
            <ns13:uid>iv--ECNt45uwIQ8pCA</ns13:uid>
</plms:query>

In the second "Next_query", you can see the Alias_identification_query declared 
with the prefix ns9 which is not declared in this context. While debugging, I 
found that the MTOMAwareOMBuilder searches for the prefix in the wrong context. 
It searches for this prefix in the whole message instead of the current xml 
hierarchy.

When I simply serialize the classes myself (using the following code), it 
generates the xml correctly, so that the namespace prefix is declared for each 
"Next_query".
adbBean.getOMElement(new QName("urn:omg.org/plm20/computational/query/proxy", 
"query"), OMAbstractFactory.getOMFactory()).toString();

Am I doing something wrong? Is this a bug?
Hoping for help,
Matthias.

Reply via email to