Hello,

I am trying to create a service to return a composite of response elements from 
other services.  I am able to successfully serialize the response by obtaining 
an OMElement like this:

                OMElement elem =
                    response.getOMElement(
                        GetDcDataResponse.MY_QNAME,
                        OMAbstractFactory.getOMFactory()
                        );
                String rspStr = elem.toString();
                System.out.println(rspStr);

This produces this output:

<ns5:getDcDataResponse xmlns:ns5="http://acme.com/dc/xsd";>
    <ns5:responseHeader>
        <ns1:responseCode 
xmlns:ns1="http://acme.com/xsd/v1_0";>0</ns1:responseCode>
        <ns1:responseDescription 
xmlns:ns1="http://acme.com/xsd/v1_0";></ns1:responseDescription>
    </ns5:responseHeader>
    <ns5:dcResponseData1>
        <Array1 xmlns="http://acme.com/dc/xsd/d1";>
            <Id>10</Id>
            <TypeCode>BT</TypeCode>
            <Amount>0.0</Amount>
        </Array1>
        <Array1 xmlns="http://acme.com/dc/xsd/d1";>
            <Id>10</Id>
            <TypeCode>RT</TypeCode>
            <Amount>0.0</Amount>
        </Array1>
        <ns3:ArrayCount 
xmlns:ns3="http://acme.com/dc/xsd/d1";>4</ns3:ctrbRateArrayCount>
    </ns5:dcResponseData1>
    <ns5:dcResponseData2>
        <Array2 xmlns="http://acme.com/dc/xsd/d2";>
            <Id>10</Id>
            <BrandCode>PB</BrandCode>
            <Amount>3232939.34</Amount>
        </Array2>
        <ns2:ArrayCount 
xmlns:ns2="http://acme.com/dc/xsd/d2";>2</ns2:dcBalArrayCount>
    </ns5:dcResponseData2>
</ns5:getDcDataResponse>

My issue is that even though this is perfectly valid XML, the 
MTOMAwareOMBuilder chokes on this response because it is maintaining a list of 
prefix to namespace mappings and it incorrectly thinks that the "" prefix is 
trying to be used for both http://acme.com/dc/xsd/d1 and 
http://acme.com/dc/xsd/d2.   It seems like part of the problem is that the 
dcResponseData1 and dcResponseData2 ADB beans do not declare a MY_QNAME - they 
instead rely on the parent QName (see below):

        public  class DcResponseData1
        implements org.apache.axis2.databinding.ADBBean{
        /* This type was generated from the piece of schema that had
                name = DcResponseData1
                Namespace URI = http://acme.com/dc/xsd/d2
                Namespace Prefix = ns2
                */


        public  class DcResponseData2
        implements org.apache.axis2.databinding.ADBBean{
        /* This type was generated from the piece of schema that had
                name = DcResponseData2
                Namespace URI = http://acme.com/dc/xsd/d1
                Namespace Prefix = ns3
                */

Is there a way to force ADB to always create MY_QNAME on all generated beans so 
that there are no "" prefixes in the serialized XML or is there a way for me to 
not use the MTOMAwareOMBuilder?

Thanks,
Wally Dennis

Reply via email to