7 Replies Latest reply on Dec 8, 2004 11:18 AM by Thomas Diesler

    Qualified names in SOAP messages

    Thomas Diesler Master

      Folkes,

      what are the rules for qualified names in SOAP messages?

      From the S1AS I recorded these two literal body fragments. Are they both legal?

       <env:Body>
       <ns0:FooAnonymousType>
       <ns0:fooAnonymous fooC="true">
       <ns0:fooA>foo</ns0:fooA>
       <ns0:fooB>1</ns0:fooB>
       </ns0:fooAnonymous>
       <ns0:fooAnonymous fooC="false">
       <ns0:fooA>bar</ns0:fooA>
       <ns0:fooB>0</ns0:fooB>
       </ns0:fooAnonymous>
       </ns0:FooAnonymousType>
       </env:Body>
      


       <env:Body>
       <ns0:EchoPersonRequest>
       <person>
       <name>ChildPerson</name>
       <age>10</age>
       <sex>F</sex>
       <adult>false</adult>
       <id>32767.0</id>
       </person>
       </ns0:EchoPersonRequest>
       </env:Body>
      


      cheers

        • 1. Re: Qualified names in SOAP messages
          Jason Greene Master

          Can you paste the WSDL blobs for message and types that you used to get those?

          • 2. Re: Qualified names in SOAP messages
            Thomas Diesler Master

             

             <message name="echoPersonRequest">
             <part element="ns3:EchoPersonRequest" name="parameters"/>
             </message>
            


            <schema
             xmlns="http://www.w3.org/2001/XMLSchema"
             targetNamespace="http://marshalltestservice.org/types3"
             xmlns:tns="http://marshalltestservice.org/types3"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
             <import namespace="http://www.w3.org/2002/06/soap-encoding"/>
             <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
             <complexType name="EchoEmployeeRequest">
             <sequence>
             <element name="employee" nillable="true" type="tns:Employee"/>
             </sequence>
             </complexType>
             <complexType name="EchoEmployeeResponse">
             <sequence>
             <element name="employee" nillable="true" type="tns:Employee"/>
             </sequence>
             </complexType>
             <complexType name="Person">
             <sequence>
             <element name="name" nillable="true" type="string"/>
             <element name="age" type="int"/>
             <element name="sex" type="string"/>
             <element name="adult" type="boolean"/>
             <element name="id" type="float"/>
             </sequence>
             </complexType>
             <complexType name="EchoPersonRequest">
             <sequence>
             <element name="person" nillable="true" type="tns:Person"/>
             </sequence>
             </complexType>
             <complexType name="EchoPersonResponse">
             <sequence>
             <element name="person" nillable="true" type="tns:Person"/>
             </sequence>
             </complexType>
             <complexType name="Employee">
             <sequence>
             <element name="person" nillable="true" type="tns:Person"/>
             <element name="salary" type="double"/>
             <element name="id" type="int"/>
             </sequence>
             </complexType>
             <complexType name="Document">
             <simpleContent>
             <extension base="string">
             <xsd:attribute
             name="ID"
             type="string"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
             </extension>
             </simpleContent>
             </complexType>
             <element name="EchoDocumentRequest" type="tns:Document"/>
             <element name="EchoDocumentResponse" type="tns:Document"/>
             <element name="EchoEmployeeRequest" type="tns:EchoEmployeeRequest"/>
             <element name="EchoEmployeeResponse" type="tns:EchoEmployeeResponse"/>
             <element name="EchoPersonRequest" type="tns:EchoPersonRequest"/>
             <element name="EchoPersonResponse" type="tns:EchoPersonResponse"/>
            </schema>
            


            • 3. Re: Qualified names in SOAP messages
              Thomas Diesler Master

               

               <message name="FooAnonymousTypeRequest">
               <part name="fooAnonymousTypeRequest" element="ns2:FooAnonymousType"/>
               </message>
              


              <schema
               targetNamespace="http://marshalltestservice.org/types2"
               xmlns:foo="http://marshalltestservice.org/types2"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns="http://www.w3.org/2001/XMLSchema"
               elementFormDefault="qualified">
              
               <xs:include schemaLocation="IncludedDefs.xsd"/>
              
               <element name="languageElem" type="language"/>
               <element name="tokenElem" type="token"/>
               <element name="nameElem" type="Name"/>
               <element name="NCNameElem" type="NCName"/>
               <element name="IDElem" type="ID"/>
               <element name="NMTokenElem" type="NMTOKEN"/>
              
               <element name="UnsignedShort" type="unsignedShort"/>
               <element name="UnsignedInt" type="unsignedInt"/>
               <element name="UnsignedByte" type="unsignedByte"/>
               <element name="UnsignedLong" type="unsignedLong"/>
               <element name="Time" type="time"/>
               <element name="Date" type="date"/>
               <element name="NonPositiveInteger" type="nonPositiveInteger"/>
               <element name="NonNegativeInteger" type="nonNegativeInteger"/>
               <element name="PositiveInteger" type="positiveInteger"/>
               <element name="NegativeInteger" type="negativeInteger"/>
              
               <element name="FooStringListType" type="foo:FooStringListType"/>
               <simpleType name="FooStringListType">
               <list itemType="string"/>
               </simpleType>
              
               <element name="FooFloatListType" type="foo:FooFloatListType"/>
               <simpleType name="FooFloatListType">
               <list itemType="float"/>
               </simpleType>
              
               <element name="FooIntListType" type="foo:FooIntListType"/>
               <simpleType name="FooIntListType">
               <list itemType="int"/>
               </simpleType>
              
               <element name="FooDecimalListType" type="foo:FooDecimalListType"/>
               <simpleType name="FooDecimalListType">
               <list itemType="decimal"/>
               </simpleType>
              
               <element name="FooDoubleListType" type="foo:FooDoubleListType"/>
               <simpleType name="FooDoubleListType">
               <list itemType="double"/>
               </simpleType>
              
               <element name="FooIntegerListType" type="foo:FooIntegerListType"/>
               <simpleType name="FooIntegerListType">
               <list itemType="integer"/>
               </simpleType>
              
               <element name="FooLongListType" type="foo:FooLongListType"/>
               <simpleType name="FooLongListType">
               <list itemType="long"/>
               </simpleType>
              
               <element name="FooShortListType" type="foo:FooShortListType"/>
               <simpleType name="FooShortListType">
               <list itemType="short"/>
               </simpleType>
              
               <element name="FooByteListType" type="foo:FooByteListType"/>
               <simpleType name="FooByteListType">
               <list itemType="byte"/>
               </simpleType>
              
               <element name="FooString" type="foo:FooString"/>
               <element name="FooInteger" type="foo:FooInteger"/>
               <element name="FooInt" type="foo:FooInt"/>
               <element name="FooLong" type="foo:FooLong"/>
               <element name="FooShort" type="foo:FooShort"/>
               <element name="FooDecimal" type="foo:FooDecimal"/>
               <element name="FooFloat" type="foo:FooFloat"/>
               <element name="FooDouble" type="foo:FooDouble"/>
               <element name="FooBoolean" type="foo:FooBoolean"/>
               <element name="FooByte" type="foo:FooByte"/>
               <element name="FooQName" type="foo:FooQName"/>
              
              
               <simpleType name="mySimpleStringType">
               <restriction base="xs:string">
               </restriction>
               </simpleType>
              
               <simpleType name="FooString">
               <restriction base="foo:mySimpleStringType">
               </restriction>
               </simpleType>
              
               <simpleType name="mySimpleIntegerType">
               <restriction base="xs:integer">
               <minInclusive value="5"/>
               <maxInclusive value="7"/>
               </restriction>
               </simpleType>
              
               <simpleType name="FooInteger">
               <restriction base="foo:mySimpleIntegerType">
               </restriction>
               </simpleType>
              
               <simpleType name="mySimpleIntType">
               <restriction base="xs:int">
               <minInclusive value="10"/>
               <maxInclusive value="12"/>
               </restriction>
               </simpleType>
              
               <simpleType name="FooInt">
               <restriction base="foo:mySimpleIntType">
               </restriction>
               </simpleType>
              
              
               <simpleType name="mySimpleLongType">
               <restriction base="xs:long">
               <minInclusive value="1000000000000000000"/>
               <maxInclusive value="1000000000000000002"/>
               </restriction>
               </simpleType>
              
               <simpleType name="FooLong">
               <restriction base="foo:mySimpleLongType">
               </restriction>
               </simpleType>
              
               <simpleType name="mySimpleShortType">
               <restriction base="xs:short">
               <minInclusive value="32765"/>
               <maxInclusive value="32767"/>
               </restriction>
               </simpleType>
              
               <simpleType name="FooShort">
               <restriction base="foo:mySimpleShortType">
               </restriction>
               </simpleType>
              
               <simpleType name="mySimpleDecimalType">
               <restriction base="xs:decimal">
               <minInclusive value="3512359.1456"/>
               <maxInclusive value="3512360.1456"/>
               </restriction>
               </simpleType>
              
               <simpleType name="FooDecimal">
               <restriction base="foo:mySimpleDecimalType">
               </restriction>
               </simpleType>
               <simpleType name="mySimpleFloatType">
               <restriction base="xs:float">
               <minInclusive value="489.57"/>
               <maxInclusive value="488.57"/>
               </restriction>
               </simpleType>
              
               <simpleType name="FooFloat">
               <restriction base="foo:mySimpleFloatType">
               </restriction>
               </simpleType>
              
              
               <simpleType name="mySimpleDoubleType">
               <restriction base="xs:double">
               <minInclusive value="5"/>
               <maxInclusive value="7"/>
               </restriction>
               </simpleType>
              
               <simpleType name="FooDouble">
               <restriction base="foo:mySimpleDoubleType">
               </restriction>
               </simpleType>
              
               <simpleType name="mySimpleBooleanType">
               <restriction base="xs:boolean">
               </restriction>
               </simpleType>
              
               <simpleType name="FooBoolean">
               <restriction base="foo:mySimpleBooleanType">
               </restriction>
               </simpleType>
              
              
               <simpleType name="mySimpleByteType">
               <restriction base="xs:byte">
               <minInclusive value="125"/>
               <maxInclusive value="127"/>
               </restriction>
               </simpleType>
              
               <simpleType name="FooByte">
               <restriction base="foo:mySimpleByteType">
               </restriction>
               </simpleType>
               <simpleType name="mySimpleQNameType">
               <restriction base="xs:QName">
               </restriction>
               </simpleType>
              
               <simpleType name="FooQName">
               <restriction base="foo:mySimpleQNameType">
               </restriction>
               </simpleType>
              
               <element name="FooStringRequest">
               <complexType>
               <sequence>
               <element name="varString" type="string" nillable="true"/>
               </sequence>
               </complexType>
               </element>
               <element name="FooStringResponse">
               <complexType>
               <sequence>
               <element name="varString" type="string" nillable="true"/>
               </sequence>
               </complexType>
               </element>
              
               <element name="Foo1Request" type="foo:FooType"/>
               <element name="Foo1Response" type="foo:FooStatusType"/>
              
               <element name="Foo2Request" type="foo:FooType"/>
               <element name="Foo2Response" type="foo:FooType"/>
              
               <complexType name="FooType">
               <sequence>
               <element name="fooA" type="boolean"/>
               <element name="fooB" type="byte"/>
               <element name="fooC" type="short"/>
               <element name="fooD" type="int"/>
               <element name="fooE" type="long"/>
               <element name="fooF" type="float"/>
               <element name="fooG" type="double"/>
               <element name="fooH" type="string"/>
               <element name="fooI" type="foo:FooIType"/>
               <element name="fooJ" type="foo:FooVariousSchemaTypes"/>
               <element name="fooK" type="foo:FooIntegerRangeType"/>
               <element name="fooM" type="anySimpleType"/>
               <element name="fooN" type="foo:FooAnonymousType"/>
               </sequence>
               </complexType>
              
               <element name="FooIType" type="foo:FooIType"/>
               <simpleType name="FooIType">
               <restriction base="normalizedString">
               <pattern value="\d{3}-[A-Z0-9]{5}"/>
               </restriction>
               </simpleType>
              
               <element name="FooVariousSchemaTypesListType" type="foo:FooVariousSchemaTypesListType"/>
               <complexType name="FooVariousSchemaTypesListType">
               <sequence>
               <element name="fooA" type="foo:FooVariousSchemaTypes" nillable="false" maxOccurs="unbounded"/>
               </sequence>
               </complexType>
              
               <element name="FooVariousSchemaTypes" type="foo:FooVariousSchemaTypes"/>
               <complexType name="FooVariousSchemaTypes">
               <sequence>
               <element name="fooA" type="unsignedShort"/>
               <element name="fooB" type="nonNegativeInteger"/>
               <element name="fooC" type="normalizedString"/>
               <element name="fooD" type="NMTOKEN"/>
               <element name="fooE" type="unsignedInt"/>
               <element name="fooF" type="unsignedByte"/>
               </sequence>
               </complexType>
              
               <element name="FooIntegerRangeType" type="foo:FooIntegerRangeType"/>
               <simpleType name="FooIntegerRangeType">
               <restriction base="integer">
               <minInclusive value="100"/>
               <maxInclusive value="999"/>
               </restriction>
               </simpleType>
              
               <element name="FooAnnotationType" type="foo:FooAnnotationType"/>
               <simpleType name="FooAnnotationType">
               <annotation>
               <documentation xml:lang="en">Test results</documentation>
               </annotation>
               <restriction base="string">
               <enumeration value="Unknown"/>
               <enumeration value="Passed"/>
               <enumeration value="Failed"/>
               </restriction>
               </simpleType>
              
               <element name="FooAnySimpleType" type="anySimpleType"/>
              
               <element name="FooAnyURIType" type="foo:FooAnyURIType"/>
               <complexType name="FooAnyURIType">
               <sequence>
               <element name="FooAnyURIType" type="anyURI"/>
               </sequence>
               </complexType>
              
               <element name="FooStringEnumType" type="foo:FooStringEnumType"/>
               <simpleType name="FooStringEnumType">
               <restriction base="string">
               <enumeration value="MA"/>
               <enumeration value="NH"/>
               <enumeration value="VT"/>
               <enumeration value="ME"/>
               <enumeration value="RI"/>
               </restriction>
               </simpleType>
               <element name="FooByteEnumType" type="foo:FooByteEnumType"/>
               <simpleType name="FooByteEnumType">
               <restriction base="byte">
               <enumeration value="1"/>
               <enumeration value="2"/>
               <enumeration value="3"/>
               </restriction>
               </simpleType>
               <element name="FooShortEnumType" type="foo:FooShortEnumType"/>
               <simpleType name="FooShortEnumType">
               <restriction base="short">
               <enumeration value="1"/>
               <enumeration value="2"/>
               <enumeration value="3"/>
               </restriction>
               </simpleType>
               <element name="FooIntegerEnumType" type="foo:FooIntegerEnumType"/>
               <simpleType name="FooIntegerEnumType">
               <restriction base="integer">
               <enumeration value="1"/>
               <enumeration value="2"/>
               <enumeration value="3"/>
               </restriction>
               </simpleType>
               <element name="FooIntEnumType" type="foo:FooIntEnumType"/>
               <simpleType name="FooIntEnumType">
               <restriction base="int">
               <enumeration value="1"/>
               <enumeration value="2"/>
               <enumeration value="3"/>
               </restriction>
               </simpleType>
               <element name="FooLongEnumType" type="foo:FooLongEnumType"/>
               <simpleType name="FooLongEnumType">
               <restriction base="long">
               <enumeration value="1"/>
               <enumeration value="2"/>
               <enumeration value="3"/>
               </restriction>
               </simpleType>
               <element name="FooDecimalEnumType" type="foo:FooDecimalEnumType"/>
               <simpleType name="FooDecimalEnumType">
               <restriction base="decimal">
               <enumeration value="1.1"/>
               <enumeration value="2.2"/>
               <enumeration value="3.3"/>
               </restriction>
               </simpleType>
               <element name="FooFloatEnumType" type="foo:FooFloatEnumType"/>
               <simpleType name="FooFloatEnumType">
               <restriction base="float">
               <enumeration value="1.1"/>
               <enumeration value="2.2"/>
               <enumeration value="3.3"/>
               </restriction>
               </simpleType>
               <element name="FooDoubleEnumType" type="foo:FooDoubleEnumType"/>
               <simpleType name="FooDoubleEnumType">
               <restriction base="double">
               <enumeration value="1.1"/>
               <enumeration value="2.2"/>
               <enumeration value="3.3"/>
               </restriction>
               </simpleType>
              
               <element name="FooStatus" type="foo:FooStatusType"/>
               <complexType name="FooStatusType">
               <sequence>
               <element name="fooA" type="boolean" nillable="false"/>
               </sequence>
               </complexType>
              
               <element name="FooAnonymousType" type="foo:FooAnonymousType"/>
               <complexType name="FooAnonymousType">
               <sequence>
               <element name="fooAnonymous" minOccurs="0" maxOccurs="unbounded">
               <complexType>
               <sequence>
               <element name="fooA" type="string"/>
               <element name="fooB" type="int"/>
               </sequence>
               <attribute name="fooC" type="boolean" use="required"/>
               </complexType>
               </element>
               </sequence>
               </complexType>
              
               <element name="FooFault" type="foo:FooFaultException"/>
               <complexType name="FooFaultException">
               <sequence>
               <element name="WhyTheFault">
               <simpleType>
               <restriction base="NMTOKEN">
               <enumeration value="FooBad1"/>
               <enumeration value="FooBad2"/>
               <enumeration value="FooBad3"/>
               <enumeration value="FooBad4"/>
               <enumeration value="FooBad5"/>
               </restriction>
               </simpleType>
               </element>
               </sequence>
               </complexType>
              </schema>
              
              


              • 4. Re: Qualified names in SOAP messages
                Jason Greene Master

                It is not legal to refer to a complexType directly in a schema instance. (The soap message) If you look at the wsdl file they actually declare that type as an element (it just happens to have the same name as the complexType)

                <element name="FooAnonymousType" type="foo:FooAnonymousType"/>


                -Jason

                • 5. Re: Qualified names in SOAP messages
                  Jason Greene Master

                  Sorry, I misinterpreted what you were asking.

                  Both of these examples are valid, and the differences between the two has to do with XML schema local and global declarations. One of the schemas (the foo annoymous type one) has elementFormDefault="qualified", which moves all names that would normally be local into the global namespace, which requires the schema instance document to qualify the name. The other takes the default "unqualified", which means that it must not be qualified in the SOAP message.

                  Take a look at this section in the schema primer:
                  http://www.w3.org/TR/xmlschema-0/#GlobalvsLocal

                  -Jason

                  • 7. Re: Qualified names in SOAP messages
                    Thomas Diesler Master

                    Thanks for the excellent research