Search code examples
web-servicessoapexchangewebservicesexchange-server-2013

EWS: unexpected SOAP validation error from Exchange 2013


I make a request with JAX-WS:

GetItemType itemRequest = new GetItemType()
    .withItemShape(new ItemResponseShapeType()
        .withBaseShape(DefaultShapeNamesType.ID_ONLY)
        .withAdditionalProperties(new NonEmptyArrayOfPathsToElementType()
            .withPath(objectFactory.createFieldURI(new PathToUnindexedFieldType()
                .withFieldURI(UnindexedFieldURIType.ITEM_WEB_CLIENT_EDIT_FORM_QUERY_STRING)
                )
            )
        )
    )
    .withItemIds(new NonEmptyArrayOfBaseItemIdsType()
        .withItemIdOrOccurrenceItemIdOrRecurringMasterItemId(new ItemIdType()
            .withId(id)
        )
    );

Which yields a soap message:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <ns3:MailboxCulture xmlns:ns3="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messages">nb-NO</ns3:MailboxCulture>
  </soap:Header>
  <soap:Body>
    <GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types">
      <ItemShape>
        <ns2:BaseShape>IdOnly</ns2:BaseShape>
        <ns2:AdditionalProperties>
          <ns2:FieldURI FieldURI="item:WebClientEditFormQueryString"/>
        </ns2:AdditionalProperties>
      </ItemShape>
      <ItemIds>
        <ns2:ItemId Id="AQAZAEF4ZWwuV2F0aG5lQHNwYXJlYmFuazEubm8ARgAAA7k+kh3x38JJgjb3IcQO3bAHAP4YJIRG6m5GkZN2+/hve1MAAAIBEAAAAP4YJIRG6m5GkZN2+/hve1MAAAIbBgAAAA=="/>
      </ItemIds>
    </GetItem>
  </soap:Body>
</soap:Envelope>

And get this response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <s:Fault>
      <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation</faultcode>
      <faultstring xml:lang="nb-NO">The request failed schema validation: The 'FieldURI' attribute is invalid - The value 'item:WebClientEditFormQueryString' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.</faultstring>
      <detail>
        <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode>
        <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.</e:Message>
        <t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
          <t:LineNumber>1</t:LineNumber>
          <t:LinePosition>534</t:LinePosition>
          <t:Violation>The 'FieldURI' attribute is invalid - The value 'item:WebClientEditFormQueryString' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.</t:Violation>
        </t:MessageXml>
      </detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

So it seems to not like the value item:WebClientReadFormQueryString, but this seems correct to me, according to the enumeration in types.xsd from EWS:

<xs:simpleType name="UnindexedFieldURIType">
    <xs:restriction base="xs:string">
        ...
        <xs:enumeration value="item:WebClientReadFormQueryString"/>

Does anyone understand this validation error, or is it a bug?

Exchange version is 15.0.913.19


Solution

  • Try adding a RequestServerVersion element in your SOAP header and setting it to at least Exchange2010.