1
votes

I am trying to test EWS with the postman. I tried to obtain the WSDL from https://outlook.office365.com/EWS/Exchange.asmx, but the WSDL returned from the link throws a not found error.

Then after following the conversations here, https://social.msdn.microsoft.com/Forums/lync/en-US/07a01fbe-ef5e-4b9c-b1a2-be0945d4b621/how-to-get-serviceswsdl-for-office-365?forum=exchangesvrdevelopment.

I was able to get the WDSL from https://outlook.office365.com/ews/services.wsdl after basic auth.

For executing a SOAP call

  1. I tried sending a POST request to https://outlook.office365.com/ews/services.wsdl, this resulted in the HTTP 405 Method not Allowed.
  2. I tried sending a POST request to https://outlook.office365.com/EWS/Exchange.asmx, which returned the following response.
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">*</Action>
    </s:Header>
    <s:Body>
        <s:Fault>
            <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorInvalidRequest</faultcode>
            <faultstring xml:lang="en-US">The request is invalid.</faultstring>
            <detail>
                <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInvalidRequest</e:ResponseCode>
                <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request is invalid.</e:Message>
            </detail>
        </s:Fault>
    </s:Body>
</s:Envelope>

My XML POST content is for example this

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
   <soap:Header>
      <t:RequestServerVersion Version="Exchange2006" />
   </soap:Header>
   <soap:Body >
      <m:FindPeople>
         <m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="100" Offset="0"/>
         <m:ParentFolderId>
            <t:DistinguishedFolderId Id="contacts"/>
         </m:ParentFolderId>
      </m:FindPeople>
   </soap:Body>
</soap:Envelope>

I am trying to follow a SOAP request (https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/findpeople-operation). Am I missing something?

1

1 Answers

2
votes

Your post has an multiple errors

 <t:RequestServerVersion Version="Exchange2006" />

This is incorrect there is no Exchange2006 maybe you meant

 <t:RequestServerVersion Version="Exchange2016" />

You also have modified the namespaces from http to https which you shouldn't touch (this doesn't mean it will use http (or https) these are just namespace declarations and your change just made your request invalid)

eg a working request would look like

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2016" />
  </soap:Header>
   <soap:Body >
      <m:FindPeople>
         <m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="100" Offset="0"/>
         <m:ParentFolderId>
            <t:DistinguishedFolderId Id="contacts"/>
         </m:ParentFolderId>
      </m:FindPeople>
   </soap:Body>
</soap:Envelope>