Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a WSDL with abstract types in PHP
    primarykey
    data
    text
    <p>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. However, I am running into some issues with the WSDL. There are several types defined in the WSDL that have elements of abstract types. For example:</p> <pre><code>&lt;xs:complexType name="RestrictionType"&gt; &lt;xs:sequence&gt; &lt;xs:element ref="t:SearchExpression"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; </code></pre> <p>SearchExpression is an abtract type. There are several types that extend SearchExpression such as ExistsType:</p> <pre><code>&lt;xs:complexType name="ExistsType"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="t:SearchExpressionType"&gt; ... &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; &lt;xs:element name="Exists" type="t:ExistsType" substitutionGroup="t:SearchExpression"/&gt; </code></pre> <p>I would expect to be able to make a valid call that produces the following XML:</p> <pre><code>&lt;Restriction&gt; &lt;Exists&gt; ... &lt;/Exists&gt; &lt;/Restriction&gt; </code></pre> <p>However, when I attempt to make the call using PHP's SoapClient class I receive the following error:</p> <blockquote> <p>The request failed schema validation: The element '<a href="http://schemas.microsoft.com/exchange/services/2006/types:SearchExpression" rel="nofollow noreferrer">http://schemas.microsoft.com/exchange/services/2006/types:SearchExpression</a>' is abstract or its type is abstract. </p> </blockquote> <p>If I modify the definition of the RestrictionType type to the follow, the call works:</p> <pre><code>&lt;xs:element name="Exists" type="t:ExistsType"/&gt; </code></pre> <p>Is PHP's SOAP handling not able to properly handle abstract types in the WSDL, or could there be something wrong with the WSDL itself? The WSDL is stored locally so I can make edits to it if the need arrises.</p> <p>Thank you for your help in advance.</p> <p><strong>Edit:</strong><br> I just wanted to clarify that I am not forming the XML myself. I am using the following code that should be creating the proper XML:</p> <pre><code>$request-&gt;Restriction-&gt;IsGreaterThan-&gt;FieldURI-&gt;FieldURI = 'item:DateTimeReceived'; $request-&gt;Restriction-&gt;IsGreaterThan-&gt;FieldURIOrConstant -&gt;Constant-&gt;Value = date('c', $last_checked_time); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload