none
How to to retrieve call logs using SOAP request from EWS. RRS feed

  • Question

  • Hi,

        I am new to exchange web service and trying to retrieve call logs (conversation history) from exchange web server, so can you please provide any guidelines.

    -> I tried with POST a request to exchange web server but i am getting 405 (method not found) error i think i don't have prefect understanding on EWS.

    so please provide some guidelines. 

    Thanks,

    Gopika.

    Thursday, November 7, 2013 4:10 AM

All replies

  • Regarding your error you need to tell us what version of Exchange your using and also post the code your trying to use.

    I would suggest you look at using the EWS Managed API which you can download from http://www.microsoft.com/en-au/download/details.aspx?id=35371 . You can then use the code sample from http://msdn.microsoft.com/en-us/library/hh243707(v=office.14).aspx which demonstrates how to get the conversation history folder and items within.

    Cheers
    Glen


    Friday, November 8, 2013 1:12 AM
  • Hi,

       Thanks for quick response.

     version of Exchange  I am using:

                Exchange server 2010            

        Version: 14.01.0218.013

    Hi, Thanks for quick response. version of Exchange I am using: Exchange server 2010 ver: 14.01.0218.013

    Code: struct WriteThis { char *readptr; size_t sizeleft; }; doRequest() { UtilStrC csXmlRequest; UtilStrC header1 = "Accept: text/xml"; UtilStrC header2 = "Content-Type: text/xml; charset=utf-8"; UtilStrC header3 = "SOAPAction: \"http://schemas.microsoft.com/exchange/services/2006/messages/GetServiceConfiguration\""; struct curl_slist *headerlist=NULL; struct WriteThis pooh; long localResCode = 0; long httpResCode = 0; char* urlRes; csXmlRequest = Servicerequest(); if (csXmlRequest.length() != 0) { pooh.readptr = const_cast<char*>(csXmlRequest.c_str()); pooh.sizeleft = csXmlRequest.length(); } headerlist = curl_slist_append(headerlist, header1.c_str()); headerlist = curl_slist_append(headerlist, header2.c_str()); headerlist = curl_slist_append(headerlist, header3.c_str()); CURL * pCurl = curl_easy_init(); CURLcode m_CurlReturn; curl_easy_setopt(pCurl, CURLOPT_HEADER, 1); curl_easy_setopt(pCurl, CURLOPT_SSLVERSION, (long) CURL_SSLVERSION_TLSv1); const char *caFilePath = NULL; caFilePath = UtilTLSProfileMngrC::caFilePathGet(UTIL_TLSAPP_SIP); if (caFilePath != NULL && strlen(caFilePath) > 0) { curl_easy_setopt(pCurl, CURLOPT_CAINFO, caFilePath); } const char *cipherBuffer = NULL; cipherBuffer = UtilTLSProfileMngrC::cipherGet(UTIL_TLSAPP_SIP); if (cipherBuffer != NULL && strlen(cipherBuffer) > 0) { curl_easy_setopt(pCurl, CURLOPT_SSL_CIPHER_LIST, cipherBuffer); } curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYHOST, (long) 0); if (cfgProvIsSntpServerConfigured() == 0) { //setting VERIFYPEER to 2 makes ssl ignore time related failures curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYPEER, (long) 2); } else { curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYPEER, (long) 1); } char* url="https://<server domain>/EWS/Service.wsdl"; curl_easy_setopt(pCurl, CURLOPT_FOLLOWLOCATION, (long) true); curl_easy_setopt(pCurl, CURLOPT_AUTOREFERER, true); curl_easy_setopt(pCurl, CURLOPT_URL,url); curl_easy_setopt(pCurl, CURLOPT_WRITEFUNCTION, CLDir_write_callback); curl_easy_setopt(pCurl, CURLOPT_READFUNCTION,CLDir_read_callback); curl_easy_setopt(pCurl, CURLOPT_ERRORBUFFER, doXmlRequestErrorBuffer); curl_easy_setopt(pCurl, CURLOPT_FAILONERROR, (long) (false)); curl_easy_setopt(pCurl, CURLOPT_HTTPHEADER, headerlist); curl_easy_setopt(pCurl, CURLOPT_LOCALPORTFUNCTION, utilCurlLocalPortDefaultCb); curl_easy_setopt(pCurl, CURLOPT_LOCALPORTRANGE, (long) UTIL_LOCAL_PORT_NUM_RETRY); curl_easy_setopt(pCurl, CURLOPT_VERBOSE, 1); if (csXmlRequest) { curl_easy_setopt(pCurl, CURLOPT_POST, TRUE); curl_easy_setopt(pCurl, CURLOPT_INFILE,&pooh); curl_easy_setopt(pCurl, CURLOPT_POSTFIELDSIZE, (long)pooh.sizeleft); } curl_easy_setopt(pCurl,CURLOPT_HTTPAUTH,(long)CURLAUTH_NTLM); curl_easy_setopt(pCurl, CURLOPT_USERPWD,"domain\\username:password"); curl_easy_setopt(pCurl, CURLOPT_NTLMVERSION, (long)CURL_NTLM_VERSION1); m_CurlReturn = curl_easy_perform(pCurl); } UtilStrC CLDir::Servicerequest() { UtilStrC csXmlRequest=NULL; csXmlRequest = "<?xml version=\"1.0\" encoding=\"utf-8\"?> "; csXmlRequest += "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; csXmlRequest += "xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" "; csXmlRequest += "xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\" "; csXmlRequest += "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope\" "; csXmlRequest += "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" >"; csXmlRequest += "<soap:Header>"; csXmlRequest += "<t:RequestServerVersion Version=\"Exchange2010\" xmlns=\"http://schemas.microsoft.com/exchange/services/2006/types\" soap:mustUnderstand=\"0\" />"; csXmlRequest += "</soap:Header>"; csXmlRequest += "<soap:Body>"; csXmlRequest += "<GetServiceConfigurationSoapIn xmlns=\"http://schemas.microsoft.com/exchange/services/2006/messages/GetServiceConfiguration\">"; csXmlRequest += "<m:GetServiceConfigurationType>"; csXmlRequest += "<m:RequestedConfiguration>"; csXmlRequest += "<m:ConfigurationName>UnifiedMessagingConfiguration</m:ConfigurationName>"; csXmlRequest += "</m:RequestedConfiguration></m:GetServiceConfigurationType></m:GetServiceConfigurationSoapIn></soap:Body></soap:Envelope>"; return csXmlRequest; }

    I don't know what we are changing on server side but below are the response for each change.

    Problems:

    1) Every time first i am getting 401 unauthorized error.

    2) After 401 error while sending request using POST method getting 405 (Method not found) error.  

    Error:

             HTTP/1/1 405 Method Not Allowed

             Allow:GET,HEAD,OPTIONS,TRACE

             Server:Microsoft-IIS/7.5

    3)As per above error we thought that POST is not enabled on server so we try to enable to enable POST method on server.  

           ->Not able to access Exchange server url from browser.

           ->Even for wrong URL we am getting 200 OK as response.

           ->No response at all.

    Thanks,

    Gopika.



    Friday, November 8, 2013 6:35 AM
  • I don't really understand the code (are you using curl to communicate with the server?), but it looks like your posts are going to

    https://server.domain/EWS/Service.wsdl

    which would not be correct. The posts should go to

    https://server.domain/EWS/Exchange.asmx


    OWA For SmartPhone
    www.leederbyshire.com

    Friday, November 8, 2013 10:54 AM
  • Ya i am using Curl to communicate with the server and even with https://server.domain/EWS/Exchange.asmx i am getting same error.
    Friday, November 8, 2013 12:15 PM
  • At this point, it would probably help to see the IIS log entries from the Exchange CAS server. It's possible that the requests aren't even reaching the default web site, and may be going to another site on the server, or even your router's internal admin site.


    OWA For SmartPhone
    www.leederbyshire.com

    Friday, November 8, 2013 1:01 PM
  • But when i use GET method i am able to see whole wsdl file as response,so we can say it is contacting correct server.Is it necessary to change something on server to send POST request.
    Monday, November 11, 2013 5:23 PM
  • If you want to test EWS you might want to use something like the EWSEditor http://ewseditor.codeplex.com/

    Here's a valid SOAP request that works for me,

    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><RequestServerVersion Version="Exchange2012" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
    </soap:Header><soap:Body><GetServiceConfiguration xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
    <RequestedConfiguration><ConfigurationName>UnifiedMessagingConfiguration</ConfigurationName>
    </RequestedConfiguration>
    </GetServiceConfiguration></soap:Body></soap:Envelope>

    I've not used CURL before but you should make sure that a UserAgent is set and being sent as well.

    Cheers
    Glen

    Tuesday, November 12, 2013 3:58 AM