0

This has been truly baffling for me. Two days ago I had your php-ews working perfectly with all of my EWS files using a restriction as so:

$start = new DateTime('2014-06-05');

$Request->Restriction = new EWSType_RestrictionType();
$Request->Restriction->And = new EWSType_AndType();

$Request->Restriction->And->IsGreaterThan = new EWSType_IsGreaterThanType();
$Request->Restriction->And->IsGreaterThan->FieldURI = new stdClass;
$Request->Restriction->And->IsGreaterThan->FieldURI->FieldURI = 'item:DateTimeSent';
$Request->Restriction->And->IsGreaterThan->FieldURIOrConstant->Constant->Value = $start->format('c');

Now, whenever I try to run this script I get the error message in the title. I have checked and my files do contain references to SearchExpression and SearchExpressionType.

If necessary I'd be more than happy to post my wsdl and xsd files. Any clue what this error could be stemming from?

P.S. I'm using exhange 2013 and I can receive emails fine, just not with a restriction.

Community
  • 1
  • 1
Zach Kauffman
  • 486
  • 1
  • 4
  • 17

2 Answers2

1

Try to replace your messages.xsd, types.xsd and services.wsdl with files from: https://github.com/jamesiarmes/php-ews/tree/master/wsdl

I've found that the file types.xsd was modified and its different from the original one you can download on yopurexchangeserver/ews/services.wsdl

There is probably a problem in php soapclient. It does not work properly with substitution groups and abstract elements. So, they change types.xsd slightly and the problem was resolved.

If you want to use new wsdl file from exchange 2013, its need to be modified in a similar way.

Don't forget to turn off wsdl cache in php after this change:

ini_set("soap.wsdl_cache_enabled", 0);
arghtype
  • 4,376
  • 11
  • 45
  • 60
0

I have the same problem... I've found that there is a diference between 2010 and 2013 in services.wsdl So the request needs to be different. But I havnt found a solution yet.

2010:

<!-- The type of object which actually encodes a restriction -->
  <xs:complexType name="RestrictionType">
    <xs:choice maxOccurs ="unbounded">
      <xs:element ref="t:Contains"/>
      <xs:element ref="t:Excludes"/>
      <xs:element ref="t:Exists"/>
      <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:And"/>
      <xs:element ref="t:Not"/>
      <xs:element ref="t:Or"/>
    </xs:choice>
  </xs:complexType>

2013:

 <!-- The type of object which actually encodes a restriction -->
  <xs:complexType name="RestrictionType">
    <xs:sequence>
      <xs:element ref="t:SearchExpression"/>
    </xs:sequence>
  </xs:complexType>