I\'m working on an integration between our web application and Microsoft Exchange 2007. I am using Exchange Web Services (EWS) to communicate to the Exchange Server. Howev
I'm having a very similar problem trying to add additional properties with the FieldURI element. PHP's SoapClient is creating the XML as:
<Path FieldURI='folder:DisplayName'>
when it should be creating it as:
<FieldURI FieldURI='folder:DisplayName'>
As a side note, I used wsdl2php to create proxy classes in an attempt to fix the problem, but it did not help. So I'm now wondering if the WSDL exchange returns is wrong, if php's SoapClient is buggy, or if wsdl2php created incorrect proxy classes. If anyone has any insight into this issue, please let us know.
I found the answer to my own question. Apparently PHP's SOAP object cannot properly form XML from the object structure I am using when there are abstract types. To combat the issue, I edited the WSDL and replaced references to any abstract types with references to the concrete types that extend them. So for the RestrictionType example above, I changed the schema definition to match the following:
<xs:complexType name="RestrictionType">
<xs:choice maxOccurs ="unbounded">
<xs:element ref="t:Exists"/>
<xs:element ref="t:Excludes"/>
<xs:element ref="t:IsEqualTo"/>
<xs:element ref="t:IsNotEqualTo"/>
<xs:element ref="t:IsGreaterThan"/>
<xs:element ref="t:IsGreaterThanOrEqualTo"/>
<xs:element ref="t:IsLessThan"/>
<xs:element ref="t:IsLessThanOrEqualTo"/>
<xs:element ref="t:Not"/>
<xs:element ref="t:And"/>
<xs:element ref="t:Or"/>
</xs:choice>
</xs:complexType>
I hope this helps somebody else out. Thanks to all who took the time to at least read my post.
You can use substitutionGroup only with global elements not with types. The same with
<xs:element ref="t:SearchExpression"/>
if you use a ref reference you need a element and not a type!
<xsd:complexType name="PublicationType"/>
<xsd:element name="Publication" abstract="true" type="PublicationType"/>
<xsd:element name="Book" substitutionGroup="Publication" type="BookType"/>
<xsd:element name="Magazine" substitutionGroup="Publication" type="MagazineType"/>
A other approache is just to use abstract types and XMLSchema-instance (xsi:type) instead and leave the substitutionGroup as you did.
<xsd:complexType name="PublicationType" abstract="true"/>
<xsd:element name="Publication" type="PublicationType"/>
<xsd:element name="Book"type="BookType"/>
<xsd:element name="Magazine" type="MagazineType"/>
<Publication" xsi:type="MagazineType">
This may explain that a bit better as i did. http://www.xfront.com/ExtensibleContentModels.pdf