After connecting to the exchange server wsdl, it is just allowing to access method listing. but not allowing to access methods.
$wsdl = 'https://SERVER_URL/ews/Services.wsdl';
$soapClient = new SoapClient($wsdl, array('trace' => 1,'exceptions' => true,'login' => 'LOGINUSER','password' => 'LOGINPASSWORD'));
var_dump($soapClient->__getFunctions());
How can we get access to the wsdl methods?
Please provide good suggestions for the Exchange Server 2010.
Related
I use Office.js's getCallbackTokenAsync to load the token to pass to the backend.
In the backend, I use EWS to retrieve the email data. Here is how I perform the authentication.
ExchangeService service = new ExchangeService();
service.Url = new Uri(ewsUrl); //retrieved from getCallbackTokenAsync
service.Credentials = new OAuthCredentials(ewsToken);// retrieved from getCallbackTokenAsync
It works well in exchange online enviroment. However when tested in on-premise exchange server, I got this authentication error:
Error Message: The remote server returned an error: (401) Unauthorized.
Stack Trace: at System.Net.HttpWebRequest.GetResponse() at Microsoft.Exchange.WebServices.Data.EwsHttpWebRequest.Microsoft.Exchange.WebServices.Data.IEwsHttpWebRequest.GetResponse() at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
I then found this doc says the Oauth2 authentication is only for exchange online. I guess I need to use this NTLM (Exchange on-premises only).
The major reason I use EWS instead of Graph or Rest is it supports on-premise server more naturally. So should I change the authentication here? I certainly do not want to ask user for username and password.
We have an MVC app that connects to the Exchange server. We used to connect to an on premises server using this code to create the service:
if (string.IsNullOrEmpty(Current.UserPassword))
{
throw new UnauthorizedAccessException("Exchange access requires Authentication by Password");
}
return new ExchangeService
{
Credentials = new NetworkCredential(Current.User.LoginName, Current.UserPassword),
Url = new Uri(ConfigurationManager.AppSettings["ExchangeServiceUrl"]),
};
This worked fine, but now our IT department is migrating the Exchange server to the cloud, and some users are on the cloud server while others are on premises. So I changed the code to this:
if (string.IsNullOrEmpty(Current.UserPassword))
{
throw new UnauthorizedAccessException("Exchange access requires Authentication by Password");
}
var user = ConfigurationManager.AppSettings["ExchangeUser"];
var password = ConfigurationManager.AppSettings["ExchangePassword"];
var exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP2)
{
Credentials = new NetworkCredential(user, password),
};
exchangeService.AutodiscoverUrl(Current.EmaiLuser + "#calamos.com", RedirectionCallback);
exchangeService.Credentials = new NetworkCredential(Current.EmaiLuser + "#calamos.com", Current.UserPassword);
return exchangeService;
I am using a service account to do the autodiscovery ( for some reason it doesn't work with a regular account) and then I am changing the credentials of the service to the user that logs in, so he can access the inbox. The problem is that , randomly, the server returns "The request failed. The remote server returned an error: (401) Unauthorized.".
I asked the IT department to check the Exchange logs, but there is nothing there about this error, so I don't know how to fix it...
So by cloud do you mean Office365 ?
I am using a service account to do the autodiscovery ( for some reason it doesn't work with a regular account)
For the users in the cloud you need to ensure the request are sent to the cloud servers maybe enable tracing https://msdn.microsoft.com/en-us/library/office/dd633676(v=exchg.80).aspx and then have a look at where the failed requests are being routed. From what you are saying your discovery is going to always point to your internal servers which is why the request will fail for the cloud based users. You need to have a way of identifying the users that are in the cloud and I would suggest you then just use the single Office365 Endpoint (eg you don't need Autodiscover for that) https//outlook.office365.com/EWS/Exchange.asmx
I would like to automate sending few emails using Live Connect API.
I had been looking at this page here from the Live Connect SDK and i found is this :
http://msdn.microsoft.com/en-ca/library/hh243646.aspx : it is stating exactly :
wl.imap The wl.imap scope enables read and write access to a user's
email using IMAP, and send access using SMTP
I wanted to use that scope to use the smtp send email right, Im able to get the access token however there is no doc about how to communicate with smtp server etc...
You can follow this example that is for gmail:
http://www.chargenevier.com/2013/02/google-smtp-and-oauth2-authentication/
For outlook you need change this:
$config = array('ssl' => 'tls', 'port' => '587', 'auth' => 'oauth2', 'xoauth2_request' => $initClientRequestEncoded);
$transport = new Zend_Mail_Transport_Smtp('smtp-mail.outlook.com', $config);
I am using paypal with codeigniter.
I have paypal credentials, find below -
$this->API_USERNAME = '************';
$this->API_PASSWORD = '************';
$this->API_SIGNATURE = '************';
My requirement is: Direct send payment to user's paypal email address. I have only user's paypal email address.
I used Paypal_pro codeigniter library but no luck, any suggestion. FInd my code below -
$nvpStr = "&EMAILSUBJECT=$emailSubject&RECEIVERTYPE=$receiverType&CURRENCYCODE=$currency";
$nvpStr.="&L_EMAIL0=$receiverEmail&L_Amt0=$amount&L_ITEMAMT=$amount&L_UNIQUEID0=$uniqueID&L_NOTE0=$note";
$httpParsedResponseAr = $this->paypal_pro->hash_call('MassPay', $nvpStr);
Response is-
Array ( [TIMESTAMP] => 2013-09-05T17:45:07Z [CORRELATIONID] => 3dfc532f74f43 [ACK] => Failure [VERSION] => 57.0 [BUILD] => 7560199 [L_ERRORCODE0] => 10329 [L_SHORTMESSAGE0] => User is blocked [L_LONGMESSAGE0] => We're sorry, but your PayPal account isn't currently eligible to send mass payments. Please contact either PayPal Customer Service or your account manager. [L_SEVERITYCODE0] => Error )
but above code works fine with test credentials, find below-
$this->API_USERNAME = 'seller_1297608781_biz_api1.lionite.com';
$this->API_PASSWORD = '1297608792';
$this->API_SIGNATURE = 'A3g66.FS3NAf4mkHn3BDQdpo6JD.ACcPc4wMrInvUEqO3Uapovity47p';
Then i changed this line-
$httpParsedResponseAr = $this->paypal_pro->hash_call('SetExpressCheckout', $nvpStr);
But it return below error -
[L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
[L_LONGMESSAGE0] => Order total is missing.
Can anyone help me whats wrong i did?
MassPay has to be specifically approved and enabled on a live account in order to use it. The sandbox has access to it without approval so that's why it works fine with your test account.
SetExpressCheckout is the first step in integrating the Express Checkout payment flow into your website or application and its NVP string will be entirely different from what you're trying with MassPay. The error you got is because there was no AMT parameter included in the string you sent.
If you're simply trying to send money from your own account to another account you can use the Pay API for that.
I would recommend taking a look at my CodeIgniter library for PayPal which will make this very simple for you to setup your Pay request.
I am connecting to CRM with the intention of retrieving a list of picklist values. On my development machine I am working under my own login name and all works fine. On the test server, the code executes under the NETWORK SERVICE account. When it connects to the CRM web service everything is great. When it connects to the metadata service I get 401 Unauthorised messages.
This is the first time I have used the metadata service so I am hoping someone can tell me why I get the error. The connection is configured using the code below and the failure happens when you try to retrieve the picklist data.
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.OrganizationName = config.AppSettings.Settings["CrmTargetOrganisation"].Value;
token.AuthenticationType = 0;
MetadataService service = new MetadataService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = config.AppSettings.Settings["CrmMetadataServiceUrl"].Value;
service.CrmAuthenticationTokenValue = token;
service.UnsafeAuthenticatedConnectionSharing = true;
I suspect it might be a Kerberos / delegation issue, to make sure it is try replacing DefaultCredentials with
new System.Security.Net.NetworkCredentials("username","password","domain");
See if that still gives you a 401.
This is the quick way I normally try to see if it is kerbos/security related.
I need a bit more information about your environment to make any other intelligent comments.
Hope it helps.
In my case (yes, we still use CRM 4), the website in IIS wasn't bound to the hostname being used to access the metadata service on port 5555.