OfficeDev / ews-managed-api

Other
584 stars 316 forks source link

Testing Microsoft EWS (Exchange web service) using postman #243

Closed raja-jamwal closed 4 years ago

raja-jamwal commented 4 years ago

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?