Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

webservice call access denied error message

$
0
0

I am trying to call EWS service using jquery to send mail. I am getting access denied message. Please let me know if there are any suggestions.

   var soapMessage = '<?xml version="1.0" encoding="utf-8"?>'
   + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
   + 'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
   + '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>'
    + '<RequestServerVersion Version="Exchange2010_SP2" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />'
   + '</soap:Header>'
   + '<soap:Body>'
    + '<m:CreateItem MessageDisposition="SendOnly">'
      + '<m:Items>'
       + ' <t:Message>'
       + '   <t:Subject>test</t:Subject>'
        + '  <t:Body BodyType="Text">test</t:Body>'
        + '  <t:ToRecipients>'
        + '    <t:Mailbox>'
        + '      <t:EmailAddress>myEmail@hotmail.com</t:EmailAddress>'
        + '    </t:Mailbox>'
        + '  </t:ToRecipients>'
        + '</t:Message>'
      + '</m:Items>'
     + '</m:CreateItem>'
     + '</soap:Body>'
   + '</soap:Envelope>';



        var ServiceUrl = 'https://serverName/EWS/Exchange.asmx';
        debugger;
                                                jQuery.support.cors = true;
                                                $.ajax({
                                                    url: ServiceUrl,
                                                type: "POST",
                                                dataType: "xml",
                                                data: soapMessage,
                                                contentType:"text/xml; charset=\"utf-8\"",
                                    success: processSuccess,
            error:processError
        });

        function processSuccess(data, status, req) {
            if (status == "success")
                alert("sucess");
        }

        function processError(data, status, req) {
            alert(data + " " + status);
        } 


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>