Soap: Parsing Schema: unexpected simpletype in element

From FVue
Jump to: navigation, search

Problem

PHP returns a fatal error:

PHP Fatal error: SOAP-ERROR: Parsing Schema: unexpected <simpletype> in element in vendor/zendframework/zend-soap/src/Server.php on line 812

The offending piece of XML Schema is this:

<xsd:element name="MOBILE_NUMBER">
  <xsd:simpletype>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[0-9]"/>
    </xsd:restriction>
  </xsd:simpletype>
</xsd:element>

Environment

  • zendframework/zend-soap-2.2.*
  • php-5

Solution

Element simpletype must be written with a capital T: simpleType.

<xsd:element name="MOBILE_NUMBER">
  <xsd:simpleType>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[0-9]"/>
    </xsd:restriction>
  </xsd:simpleType>
</xsd:element>