Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-121

Schema with no global element definitions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jbossws-1.0EA
    • None
    • jbossws-native
    • None

      The WSDL contained schema may come without global element definitios, like this

      <schema targetNamespace="http://org.jboss.ws/marshall/rpclit/types/arrays/java/math" xmlns:tns="http://org.jboss.ws/marshall/rpclit/types/arrays/java/math" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.w3.org/2001/XMLSchema">
      <complexType name="BigDecimalArray">
      <sequence>
      <element name="value" type="decimal" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
      </sequence>
      </complexType>
      </schema>

      Instead the root element name is defined by the WSDL message part name, like this

      <message name="StandardTypes_bigDecimalArrayTest">
      <part name="arrayOfBigDecimal_1" type="ns8:BigDecimalArray"/>
      </message>

      I can see two possible solutions to this problem:

      A) The WS layer generates a schema that contains element definitions for all root elements

      B) The root element name can be given to the marshalling layer

      Currently the second appraoch is beeing favoured, like this

      if (value != null)

      { // Get the xsdSchema for the given type URL xsdURL = getSchemaLocationURL(serContext, xmlName, xmlType); // In this case the xmlName is not NS qualified. This may be the case when it is derived from // the WSDL message part name. All gloabal elements in the WSDL containd schema and in generated schema // are NS qualified, so we use the type's namespace as the most likely NS for the xmlName if (xmlName.getNamespaceURI().equals("")) xmlName = new QName(xmlType.getNamespaceURI(), xmlName.getLocalPart()); jaxbMarshaller.setProperty(MarshallerImpl.JAXB_NAMESPACE_REGISTRY, serContext.getNamespaceRegistry()); jaxbMarshaller.setProperty(MarshallerImpl.JAXB_SCHEMA_LOCATION, xsdURL); jaxbMarshaller.setProperty(MarshallerImpl.JAXB_ROOT_QNAME, xmlName); }

      StringWriter strwr = new StringWriter();
      jaxbMarshaller.marshal(value, strwr);

      String xmlFragment = strwr.toString();
      return xmlFragment;

      This needs to be discussed

            olubyans@redhat.com Alexey Loubyansky
            tdiesler@redhat.com Thomas Diesler
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: