You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Gauba, Naveen" <c_...@qualcomm.com> on 2011/04/01 19:57:31 UTC

Axi2 generated WS Impl looking for attribute namespace but attributeFormDefault=unqualified

Hi

I have mentioned attributeFormDefault="unqualified" in my WSDL schema definition. But the Axis2 generated Top down WS Impl class is expecting namespace for all attributes. See below the snippet from my WSDL.

<wsdl:types>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:oid:abcd" version="1" xmlns:xyz="urn:oid:abcd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="GlobalClass">
<xs:sequence>
<xs:element name="oid" type="xyz:oid"/>
            .
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>

This is the code snippet from one of the generated GlobalClass. I get an exception (saying Namespace URI may not be null) where the code calls the constuctor for org.apache.axiom.om.impl.dom.NamespaceImpl.


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

                        // now run through all any or extra attributes
                        // which were not reflected until now
                        for (int i = 0; i < reader.getAttributeCount(); i++) {
                              if (!handledAttributes.contains(reader
                                          .getAttributeLocalName(i))) {
                                    // this is an anyAttribute and we create
                                    // an OMAttribute for this
                                    org.apache.axiom.om.impl.llom.OMAttributeImpl attr = new org.apache.axiom.om.impl.llom.OMAttributeImpl(
                                                reader.getAttributeLocalName(i),
                                                new org.apache.axiom.om.impl.dom.NamespaceImpl(
                                                            reader.getAttributeNamespace(i), reader
                                                                        .getAttributePrefix(i)),
                                                reader.getAttributeValue(i),
                                                org.apache.axiom.om.OMAbstractFactory
                                                            .getOMFactory());

                                    // and add it to the extra attributes

                                    object.addExtraAttributes(attr);

                              }
                        }

I wanted to check if anybody else has seen similar issue. If yes then is there a workaround?

Regards

Naveen Gauba