Open HaoNLe opened 7 years ago
Update: I took a look at the WSDL file that my program was downloading and this is what it shows:
<html>
<head>
<title>Object moved</title>
</head>
<body>
<h2>
Object moved to
<a href="%2fews%2fServices.wsdl">here</a>
.
</h2>
</body>
</html>
But when I access https://domain.com/ews/exchange.asmx
by browser I'm getting the real WSDL file.
You are probably getting a 302 redirect which the browser will follow. Follow redirects likely needs to be enabled the code base. What method of authentication are you using? Ntlm or basic?
I'm using NTLM.
I deduced this from the fact that when I provide incorrect credentials I get this error:
Error: NTLM StatusCode 401: Unauthorized.
When I provide correct credentials I get the Invalid or malformed wsdl file
that I mentioned in the original post.
This should be fixed in version 3.2.x now.
Thank you for the quick response! I am still getting the same error however. I updated and then reinstalled node-ews but both times I am still getting the same issue.
For now I'm circumventing this by downloading the xsd
and wsdl
files directly from my test server and then defining the temp
property of ewsConfig
as the directory where I placed those files
@HaoNLe I had the same problem. My mistake was to use the full ews url in the host of the config. I mean, instead of :
const ewsConfig = { username: 'username', password: 'password', host: 'https://hostname/ews/exchange.asmx' };
I used :
const ewsConfig = { username: 'username', password: 'password', host: 'https://hostname' };
And it worked !
I believe I got it to work with something similar! I will update on my progress once I get access to my code again. Thank you Alacroux!
@alacroux thank you so much. I met the same problem and have resolved it with your suggestion!
@nmarus I've just run into this issue as well. I'm getting:
Error: Invalid or malformed wsdl file: /var/folders/.../services.wsdl
My configuration is as follows:
// process.env.NODE_TLS_REJECT_UNAUTHORIZED has already been set to '0'
const ewsConfig = {
username: "my_username",
password: "my_password",
host: "https://my_host.com",
auth: "basic"
};
const options = {
strictSSL: false
};
const ews = new EWS(ewsConfig, options);
const ewsFunction = 'CreateItem';
const ewsArgs = {
"attributes" : {
"MessageDisposition" : "SendAndSaveCopy"
},
"SavedItemFolderId": {
"DistinguishedFolderId": {
"attributes": {
"Id": "sentitems"
}
}
},
"Items" : {
"Message" : {
"ItemClass": "IPM.Note",
"Subject" : "Just a test.",
"Body" : {
"attributes": {
"BodyType" : "Text"
},
"$value": "This is some content"
},
"ToRecipients" : {
"Mailbox" : {
"EmailAddress" : "a_valid_email_address@the_host.com"
}
},
"IsRead": "false"
}
}
};
ews.run(ewsFunction, ewsArgs).then(result => { ... }).catch(error => { ... });
I'm not sure what I'm doing wrong, but I've tried switching between putting the host url explicitly as the '.../ews/exchange.asmx' and not as suggested above by @alacroux .
Any suggestions?
Any solutions? Still? I have the same problem
I am getting:
when I try to send an email:
I believe I am connecting correctly since when I provide incorrect credentials I get a
NTLM StatusCode 401: Unauthorized.
error; this error does not occur when I provide correct credentials and instead I get the first error above:Invalid or malformed wsdl file
.When I go to the EWS URL endpoint in my browser, I can provide my credentials and then get access to a WSDL file thats about 1.6k lines long so I think perhaps there is something incompatible between this node and the WSDL?
If it helps: the Exchange 2010 sp1 server I'm attempting to interact with is hosted on an Azure VM and I can successfully interact with it using the EWS Managed API in an ASP.NET web app.