This project is read-only.

Why change minoccurs="1" after server code generation

Jan 21, 2013 at 3:53 PM

Hello, I have request and response with fields with minOccurs="1" and maxOccurs="1". Why with server code generation I obtain a different xsd schema?? What I was wrong?

This is the original schema:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://www.tivu.tv/TivuCB"
    elementFormDefault="qualified"
    xmlns="http://www.tivu.tv/TivuCB"
    xmlns:ns="http://www.tivu.tv/TivuCB"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="TivuCBRequestType">
    <xs:sequence>
      <xs:element name="AssetID"    type="xs:string"    minOccurs="1" maxOccurs="1"/>
      <xs:element name="Filename"   type="xs:string"    minOccurs="1" maxOccurs="1"/>
      <xs:element name="Timestamp"  type="xs:dateTime"  minOccurs="1" maxOccurs="1"/>
      <xs:element name="Status"     type="xs:string"    minOccurs="1" maxOccurs="1"/>
      
      <!-- Next 2 fields are initialized if error occurred-->
      <xs:element name="ResultCode"         type="xs:integer" minOccurs="0" maxOccurs="1"/>
      <xs:element name="ResultDescription"  type="xs:string"  minOccurs="0" maxOccurs="1"/>
      
    </xs:sequence>
  </xs:complexType>

  
  <xs:complexType name="TivuCBResponseType">
    <xs:sequence>
      <!-- This should be filled with "OK" string-->
      <xs:element name="Ack" type="xs:string" minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="TivuCBRequest"  type="ns:TivuCBRequestType"/>
  <xs:element name="TivuCBResponse" type="ns:TivuCBResponseType"/>
  
</xs:schema>

 

But the xsd published by the web service become:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="http://www.tivu.tv/TivuCB" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.tivu.tv/TivuCB">
<xs:element name="TivuCBRequest">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="AssetID" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="Filename" type="xs:string"/>
<xs:element minOccurs="1" maxOccurs="1" name="Timestamp" type="xs:dateTime"/>
<xs:element minOccurs="0" maxOccurs="1" name="Status" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="ResultCode" type="xs:integer"/>
<xs:element minOccurs="0" maxOccurs="1" name="ResultDescription" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TivuCBResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Ack" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Why fields multiplicity was changed? It's an issue??

Thanks,

Max