tags:

views:

220

answers:

0

I'm writing PHP logic that will implement a WebService in SOAP 1.1. The WSDL (which is out of my control) specifies a response type of "enumeration", but PHP doesn't have anything that's formally considered an enumeration. I'm using constant class members instead, which is a common hack for enumeration in PHP. But PHP's SoapServer isn't translating my class constants into a SOAP enumeration.

What do you do in PHP to create a value that SoapServer will treat as a SOAP enumeration?

WSDL looks like this:

<wsdl:definitions ...>
 <wsdl:types>
  <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="...">
   ...
   <xs:simpleType name="itemEvent">
    <xs:restriction base="xs:string">
     <xs:enumeration value="DeliveryFailed"/>
     <xs:enumeration value="DeliveryAccepted"/>
     <xs:enumeration value="DeliveryRejected"/>
    </xs:restriction>
   </xs:simpleType>
   ...

And my PHP values (which fail) look like this:

  class ItemEvent {
    const DeliveryAccepted = "DeliveryAccepted";
    const DeliveryRejected = "DeliveryRejected";
    const DeliveryFailed = "DeliveryFailed";   }