AnsweredAssumed Answered

PHP SOAP Library for CMIS / Alfresco

Question asked by karstene on Aug 3, 2012
Latest reply on Dec 31, 2012 by jpotts
Hello,

A lot of systems are based on PHP, and I am in the process to create a generic PHP library for CMIS. My initial test system is Alfresco. I am aware of the Chemistry PHP implementation using the AtomPub binding, but it's incomplete and not so easy to use. I am looking at a SOAP based implementation, using the standard SOAP extension in PHP5, without any additional libraries.

It took me several days now to resolve an issue with responses that include properties. I couldn't get the PropertyDefinitionId (essentially the property name) back into PHP and there is not a lot you can do without it. The WSDL type definition for properties is quite complex, using multiple definitions and type extensions for different data types, e.g. for DateTime and String:

<xs:complexType name="cmisProperty">
<xs:sequence/>
<xs:attribute name="propertyDefinitionId" type="xs:anySimpleType"/>
<xs:attribute name="localName" type="xs:anySimpleType"/>
<xs:attribute name="displayName" type="xs:anySimpleType"/>
<xs:attribute name="queryName" type="xs:anySimpleType"/>
<xs:anyAttribute namespace="##other" processContents="skip"/>
</xs:complexType>
<xs:complexType name="cmisPropertyDateTime">
<xs:complexContent>
<xs:extension base="tns:cmisProperty">
<xs:sequence>
<xs:element form="qualified" maxOccurs="unbounded" minOccurs="0" name="value" nillable="true" type="xs:dateTime"/>
<xs:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="skip"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="cmisPropertyString">
<xs:complexContent>
<xs:extension base="tns:cmisProperty">
<xs:sequence>
<xs:element form="qualified" maxOccurs="unbounded" minOccurs="0" name="value" nillable="true" type="xs:string"/>
<xs:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="skip"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

What I assumed to be a PHP problem turned out to be an incompatibility with the use of type "xs:anySimpleType" (3rd line above). After changing this to "xs:string", everything works fine.

I have not been able to figure out whether "xs:anySimpleType" is officially allowed or not at this point in the WSDL, the source of the problem may well be within the PHP implementation. But I did check the official CMIS WSDL, for example at http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/schemas/CMIS-Core.xsd, and xs:anySimpleType is not used anywhere in there. It's likely that this is an Alfresco specific issue.

Would it be possible for Alfresco to adapt the WSDL in some future release, so it's working well with existing PHP implementations? Use cases should be many, and manually changing the WSDL or fixing PHP itself everytime is a pain.

thanks
Karsten

Outcomes