  | |  | exploring the innards of a WXS derived complex type definition | exploring the innards of a WXS derived complex type definition 2003-07-25 - By Jeff Greif
Lots of Web Services using SOAP contain XML Schema type definitions like this:
<xsd:complexType name="ResultElementArray"> <xsd:complexContent> <xsd:restriction base="soapenc:Array"> <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens :ResultElement[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType>
(The base type is given below).
When a SOAP/WSDL processor reads this type, it can determine via special knowledge (out of band as far as WXS is concerned) based on presence of the soapenc:arrayType attribute and the wsdl:arrayType attribute value that an element of type ResultElementArray may contain an unrestricted number of child elements (with any name allowed -- see the base type) of type ResultElement.
When an instance document is encountered, it might look like this <return arrayType="ResultElement[3]" xsi:type="ResultElementArray"> <item xsi:type="ResultElement">...</item> <item xsi:type="ResultElement">...</item> <item xsi:type="ResultElement">...</item> </return> and the SOAP processor can determine from the arrayType value that there will be three child elements of type ResultElement.
The question is, if I get the grammar containing this type and convert it to an XSModel, how can I find the all-important wsdl:arrayType attribute value, (and thus be able to emulate the SOAP/WSDL processor's knowledge of the content, without having an instance document to look at)? Is this information captured somewhere in the XSModel? Is it possible to examine the contents of the restriction, rather than only determine the base type and the derivation method ?
Jeff
Note: The base type, somewhat simplified, is from the SOAP-Encoding spec: <xs:complexType name="Array" > <xs:sequence> <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" /> </xs:sequence> <xs:attribute name="arrayType" type="xs:string" /> <xs:attribute name="arrayOffset" type="xs:string"/> <xs:anyAttribute namespace="##other" processContents="lax" /> </xs:complexType>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2800.1170" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Verdana size=2>Lots of Web Services using SOAP contain XML Schema type definitions like this:</FONT></DIV> <DIV><FONT face=Verdana size=2></FONT> </DIV> <DIV><FONT face=Verdana size=2> <xsd:complexType name="ResultElementArray"><BR> <xsd:complexContent><BR> <xsd:restriction base="soapenc:Array"><BR> <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:ResultElement[]"/><BR> </xsd:restriction><BR> </xsd:complexContent><BR> </xsd:complexType></FONT></DIV> <DIV><FONT face=Verdana size=2></FONT> </DIV> <DIV><FONT face=Verdana size=2>(The base type is given below).</FONT></DIV> <DIV><FONT face=Verdana size=2></FONT> </DIV> <DIV><FONT face=Verdana size=2>When a SOAP/WSDL processor reads this type, it can determine via special knowledge (out of band as far as WXS is concerned) based on presence of the soapenc:arrayType attribute and the wsdl:arrayType attribute value that an element of type ResultElementArray may contain an unrestricted number of child elements (with any name allowed -- see the base type) of type ResultElement.</FONT></DIV> <DIV><FONT face=Verdana size=2></FONT> </DIV> <DIV><FONT face=Verdana size=2>When an instance document is encountered, it might look like this</FONT></DIV> <DIV><FONT face=Verdana size=2><return arrayType="ResultElement[3]" xsi:type="ResultElementArray"></FONT></DIV> <DIV><FONT face=Verdana size=2> <item xsi:type="ResultElement">...</item></FONT></DIV> <DIV><FONT face=Verdana size=2> <DIV><FONT face=Verdana size=2> <item xsi:type="ResultElement">...</item></FONT></DIV> <DIV> <DIV><FONT face=Verdana size=2> <item xsi:type="ResultElement">...</item></FONT></DIV> <DIV></return></DIV> <DIV>and the SOAP processor can determine from the arrayType value that there will be three child elements of type ResultElement.</DIV> <DIV> </DIV></DIV></FONT></DIV> <DIV><FONT face=Verdana size=2>The question is, if I get the grammar containing this type and convert it to an XSModel, how can I find the all-important wsdl:arrayType attribute value, (and thus be able to emulate the SOAP/WSDL processor's knowledge of the content, without having an instance document to look at)? Is this information captured somewhere in the XSModel? Is it possible to examine the contents of the restriction, rather than only determine the base type and the derivation method?</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Verdana size=2>Jeff</FONT></DIV> <DIV><FONT face=Verdana size=2></FONT> </DIV> <DIV><FONT face=Verdana size=2>Note:</FONT></DIV> <DIV><FONT face=Verdana size=2>The base type, somewhat simplified, is from the SOAP-Encoding spec:</FONT></DIV> <DIV><FONT face=Verdana size=2> <xs:complexType name="Array" ><BR> <xs:sequence><BR>   ; <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" /><BR> </xs:sequence><BR> <xs:attribute name="arrayType" type="xs:string" /><BR> <xs:attribute name="arrayOffset" type="xs:string"/></FONT></DIV> <DIV><FONT face=Verdana size=2> <xs:anyAttribute namespace="##other" processContents="lax" /><BR> </xs:complexType> <BR></FONT><FONT face=Verdana size=2></DIV></FONT></BODY></HTML>
|
|
 |