Loading ...
Sorry, an error occurred while loading the content.
 

RE: [soapbuilders] Question: vs for Struct Field s

Expand Messages
  • Timothy J. Ewald
    It is worth noting that the XmlSerializer class that ASP.NET Web Services uses to unmarshal types is driven by reflection against .NET metadata. It simply
    Message 1 of 11 , Jul 2, 2001
      It is worth noting that the XmlSerializer class that ASP.NET Web Services
      uses to unmarshal types is driven by reflection against .NET metadata. It
      simply walks through the field definitions for the target type and looks for
      a corresponding element in the XML, *independent* of order. So while an
      ASP.NET Web Service endpoint says it wants a <sequence>, it will accept
      messages encoded as if it accepted <all>. Interestingly, it will also ignore
      anything in the XML that doesn't correspond to a field of the target type.
      In short, if a ASP.NET Web Service says it wants this:

      <complexType name="Add">
      <sequence>
      <element name='x' type='xsd:int' />
      <element name='y' type='xsd:int' />
      </sequence>
      </complexType>

      It will accept any of these:

      <Add>
      <x>10</x>
      <y>20</y>
      </Add>

      <Add>
      <y>30</y>
      <x>10</x>
      <y>20</y>
      </Add>

      <Add>
      <y>30</y>
      <z>10</z>
      </Point>

      Assuming Add adds x and y together, these requests would produce 30, 40 and
      30 as results, *without* raising an exception. I suppose some might find
      this degree of "flexibility" beneficial, but given the use of <sequence>, it
      is in error.

      Tim-

      > -----Original Message-----
      > From: Yann Christensen [mailto:yannc@...]
      > Sent: Wednesday, June 27, 2001 9:36 PM
      > To: Andrew Layman; soapbuilders@yahoogroups.com
      > Cc: Henrik Frystyk Nielsen; Erik Christensen; Ashok Malhotra
      > Subject: RE: [soapbuilders] Question: <all> vs <sequence> for Struct
      > Field s
      >
      >
      > ASP.NET Web Services uses <sequence>.
      >
      > The reason is that:
      > 1) <all> only supports maxoccurs=1. See XML Schema 3.8.1 in [1]
      > 2) <all> does not support <choice>. See XML Schema 3.8.2 in [1]
      >
      > Obviously there are lots of cases where we could use <all> but we stick
      > to <sequence> for simplicity of implementation.
      >
      > [1] http://www.w3.org/TR/xmlschema-1/#Model_Groups
      >
      > -Yann
      >
      > ----- Original Message -----
      > From: "Simon Fell" <sfell@...>
      > To: <soapbuilders@yahoogroups.com>
      > Sent: Tuesday, June 26, 2001 7:52 PM
      > Subject: RE: [soapbuilders] Question: <all> vs <sequence> for Struct
      > Field s
      >
      >
      > The prose definition of struct in the SOAP Spec (for section 5 encodings
      > anyway), indicates that child element name not order is important, <all>
      > is
      > much closer to that definition that <sequence> and I think most WSDL
      > generates use <all>.
      >
      > Cheers
      > Simon
      >
      > -----Original Message-----
      > From: YU,KEVIN (HP-FtCollins,ex1) [mailto:kevin_yu2@...]
      > Sent: Tuesday, June 26, 2001 7:29 PM
      > To: 'soapbuilders@yahoogroups.com'
      > Subject: [soapbuilders] Question: <all> vs <sequence> for Struct Fields
      >
      >
      > Hi,
      > We are working on WSDL generation. The following two schemas are both
      > valid
      > for representing a Struct, however, is there a preferred one? why and
      > on
      > what use case?
      >
      > 1)
      > <complexType name="SOAPStruct">
      > <sequence>
      > <element name="varString" type="string" />
      > <element name="varInt" type="int" />
      > <element name="varFloat" type="float" />
      > </sequence>
      > </complexType>
      >
      > 2)
      > <complexType name="SOAPStruct">
      > <all>
      > <element name="varString" type="string" />
      > <element name="varInt" type="int" />
      > <element name="varFloat" type="float" />
      > </all>
      > </complexType>
      >
      > Thanks.
      >
      > -Kevin
      > HP SOAP
      >
      > To unsubscribe from this group, send an email to:
      > soapbuilders-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >
      > To unsubscribe from this group, send an email to:
      > soapbuilders-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >
      >
      >
      > To unsubscribe from this group, send an email to:
      > soapbuilders-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.