9 Replies Latest reply on Mar 1, 2006 1:50 PM by jason.greene

    Issues with WSDL and mapping

      got this one

      14:17:23,546 ERROR [SOAPFaultExceptionHelper] SOAP request exception
      org.jboss.ws.WSException: Attribute {urn:oasis:names:tc:wsrp:v1:types}lang found
       in jaxrpc-mapping but not in the schema: {urn:oasis:names:tc:wsrp:v1:types}Prop
      erty
       at org.jboss.ws.jaxb.JAXBUnmarshallerImpl.processXmlAttributeName(JAXBUn
      marshallerImpl.java:468)
       at org.jboss.ws.jaxb.JAXBUnmarshallerImpl.processNonArrayType(JAXBUnmars
      hallerImpl.java:432)
       at org.jboss.ws.jaxb.JAXBUnmarshallerImpl.processJavaXmlTypeMapping(JAXB
      UnmarshallerImpl.java:389)
       at org.jboss.ws.jaxb.JAXBUnmarshallerImpl.bindSchemaToJava(JAXBUnmarshal
      lerImpl.java:361)
       at org.jboss.ws.jaxb.JAXBUnmarshallerImpl.initSchemaBinding(JAXBUnmarsha
      


      Any idea ?

        • 1. Re: Issues with WSDL and mapping
          thomas.diesler

          Can you show use the relavant parts of the schema + jaxrpc-mapping?

          • 2. Re: Issues with WSDL and mapping
            claprun

            Here's the jaxrpc-mapping part:

            <java-xml-type-mapping>
            <java-type>org.jboss.portal.wsrp.core.Property</java-type>
            <root-type-qname xmlns:typeNS="urn:oasis:names:tc:wsrp:v1:types">typeNS:Property</root-type-qname>
            <qname-scope>complexType</qname-scope>
            <variable-mapping>
            <java-variable-name>name</java-variable-name>
            <xml-attribute-name>name</xml-attribute-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>lang</java-variable-name>
            <xml-attribute-name>lang</xml-attribute-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>stringValue</java-variable-name>
            <xml-element-name>stringValue</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>_any</java-variable-name>
            <xml-wildcard/>
            </variable-mapping>
            </java-xml-type-mapping>
            


            Here's the schema definition for Property:

            <complexType name="Property">
             <sequence>
             <!-- Would prefer this to be a choice ... Axis and JAX-RPC failed to handle that -->
             <element name="stringValue" type="xsd:string" minOccurs="0"/>
             <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
             <!-- end prefer this to be a choice -->
             </sequence>
             <attribute name="name" type="xsd:string" use="required"/>
             <attribute ref="xml:lang"/>
             </complexType>
            


            There seems to be a mixed-up with standard xml:lang. Maybe it's a bug with wscompile? Shouldn't it have somehow marked xml:lang as being part of the 'standard' XML attributes? On the other hand, this seems like to big a bug (if that's the case) for it to be the only reason why our stuff fails... So maybe there's something wrong with our configuration?

            • 3. Re: Issues with WSDL and mapping
              anil.saldhana

              JBossXB layer has correctly modeled the TypeBinding with a map as

              xml:lang = typebinding
              name=typebinding
              


              But the jaxrpc layer is lost because:
              <variable-mapping>
              <java-variable-name>name</java-variable-name>
              <xml-attribute-name>name</xml-attribute-name>
              </variable-mapping>
              <variable-mapping>
              <java-variable-name>lang</java-variable-name>
              <xml-attribute-name>lang</xml-attribute-name>
              </variable-mapping>
              


              It cannot figure out that the lang is a namespace qualified attrib name with prefix xml, so it asks for a typebinding for "lang" and the JBossXB layer cannot return the typebinding for it.

              My guess is that wscompile should have the following:
              <variable-mapping>
              <java-variable-name>lang</java-variable-name>
              <xml-attribute-name>xml:lang</xml-attribute-name>
              </variable-mapping>
              

              because ws4ee spec defines the xml-attribute-name as:
              The xml-attribute-name element defines name attribute value
              of a WSDL attribute element within a root type. The value
              of an xml-attribute-name element must match the value of
              the ref attribute if mapping an attribute reference.
              


              • 4. Re: Issues with WSDL and mapping
                claprun

                I was suspecting as much but it is kind of weird that this problem is not more well-known... WSRP4J goes around the issue by modifying the WSDL file like so:

                <!-- <attribute ref="xml:lang" use="required"/> -->
                <attribute name="lang" type="xsd:string" use="required"/>
                

                So it does seem like something's up with handling of xml:lang (and probably other standard XML attributes.

                • 5. Re: Issues with WSDL and mapping
                  anil.saldhana

                  The corresponding change that needs to happen is:
                  package org.jboss.ws.jaxb.JAXBUnmarshallerImpl

                  private void processXmlAttributeName(TypeBinding typeBinding, VariableMapping varMapping)
                   {
                   String xmlAttrName = varMapping.getXmlAttributeName();
                   log.trace("processXmlAttributeName: " + xmlAttrName);
                  
                   QName xmlName = new QName(xmlAttrName);
                   AttributeBinding attr = typeBinding.getAttribute(xmlName);
                   if (attr == null)
                   {
                   // attributeFormDefault="qualified"
                   String nsURI = typeBinding.getQName().getNamespaceURI();
                   if (Constants.SOAP11_ATTR_MUST_UNDERSTAND.equals(xmlAttrName) || Constants.SOAP11_ATTR_ACTOR.equals(xmlAttrName) || Constants.SOAP11_ATTR_ROLE.equals(xmlAttrName))
                   {
                   nsURI = Constants.NS_SOAP11_ENV;
                   }
                   xmlName = new QName(nsURI, xmlAttrName);
                   attr = typeBinding.getAttribute(xmlName);
                   }
                  
                   /**
                   * Case when the xml-attribute-name may be referring to xml:xxx
                   * like xml:lang
                   */
                   if(attr == null && xmlAttrName.contains("xml:"))
                   {
                   xmlName= new QName(Constants.NS_XML, xmlAttrName.substring("xml:".length()));
                   attr = typeBinding.getAttribute(xmlName);
                   }
                  
                   if (attr == null)
                   {
                   QName typeQName = typeBinding.getQName();
                   throw new WSException("Attribute " + xmlName + " found in jaxrpc-mapping but not in the schema: " + typeQName);
                   }
                  
                   String javaVariableName = varMapping.getJavaVariableName();
                   PropertyMetaData prop = new PropertyMetaData();
                   prop.setName(javaVariableName);
                   attr.setPropertyMetaData(prop);
                  
                   if (log.isTraceEnabled())
                   log.trace("Bound attribute " + xmlName + " to property " + prop.getName());
                   }
                  


                  The section that is shown below is the change:
                   /**
                   * Case when the xml-attribute-name may be referring to xml:xxx
                   * like xml:lang
                   */
                   if(attr == null && xmlAttrName.contains("xml:"))
                   {
                   xmlName= new QName(Constants.NS_XML, xmlAttrName.substring("xml:".length()));
                   attr = typeBinding.getAttribute(xmlName);
                   }
                  


                  • 6. Re: Issues with WSDL and mapping
                    thomas.diesler
                    • 7. Re: Issues with WSDL and mapping
                      jason.greene

                      This issue is not specific to xml:lang, but a general JSR109 problem with namespaced attributes and elements. So adding a hack for xml:lang is a bad idea. I have emailed the EG in hopes they will clarify or fix the jaxrpc-mapping schema.

                      -Jason

                      • 8. Re: Issues with WSDL and mapping
                        claprun

                        I'd say it only applies to elements and attributes in the xml namespace. As far as I can tell, the mapping deal properly with elements and attributes that have an explicit namespace definition (which is not the case for the standard XML attributes).
                        Either way, this seems like a major oversight...

                        • 9. Re: Issues with WSDL and mapping
                          jason.greene

                          It applies to any element that has a namespace that is different than its containing type.

                          -Jason