mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
Fixes to URLs for SOAP and ActiveSync requests; additional logging in case of error
This commit is contained in:
parent
073f883ba6
commit
126bfff3be
@ -84,11 +84,23 @@ namespace Acacia.ZPush.Connect.Soap
|
||||
|
||||
#region Decoding
|
||||
|
||||
public override object ParseResponse(Stream result)
|
||||
public override object ParseResponse(string url, Stream result)
|
||||
{
|
||||
// Parse xml
|
||||
XmlDocument xml = new XmlDocument();
|
||||
xml.Load(result);
|
||||
using (StreamReader reader = new StreamReader(result))
|
||||
{
|
||||
string text = reader.ReadToEnd();
|
||||
try
|
||||
{
|
||||
xml.LoadXml(text);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Instance.Error(this, "Error in SOAP response:\nurl={0}\nresponse={1}", url, text);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it's an error message
|
||||
CheckFaultResponse(xml);
|
||||
|
@ -136,7 +136,7 @@ namespace Acacia.ZPush.Connect
|
||||
using (HttpContent responseContent = response.Content)
|
||||
{
|
||||
Logger.Instance.Trace(this, "Response: {0}", responseContent.ReadAsStringAsync().Result);
|
||||
return request.ParseResponse(responseContent.ReadAsStreamAsync().Result);
|
||||
return request.ParseResponse(url, responseContent.ReadAsStreamAsync().Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -288,8 +288,12 @@ namespace Acacia.ZPush.Connect
|
||||
|
||||
public Response Execute(ActiveSync.RequestBase request)
|
||||
{
|
||||
string url = string.Format(ACTIVESYNC_URL, _account.Account.ServerURL, _account.Account.DeviceId,
|
||||
request.Command, _account.Account.UserName, "WindowsOutlook");
|
||||
string url = string.Format(ACTIVESYNC_URL,
|
||||
_account.Account.ServerURL,
|
||||
Uri.EscapeDataString(_account.Account.DeviceId),
|
||||
request.Command,
|
||||
Uri.EscapeDataString(_account.Account.UserName),
|
||||
"WindowsOutlook");
|
||||
|
||||
// Construct the body
|
||||
WBXMLDocument doc = new WBXMLDocument();
|
||||
|
@ -28,6 +28,6 @@ namespace Acacia.ZPush.Connect
|
||||
{
|
||||
public abstract HttpContent GetContent();
|
||||
|
||||
public abstract object ParseResponse(Stream result);
|
||||
public abstract object ParseResponse(string url, Stream result);
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace Acacia.ZPush.Connect
|
||||
string url = string.Format(ACTIVESYNC_URL, _connection.Account.Account.ServerURL, "webservice",
|
||||
ServiceName,
|
||||
// TODO: this username is a bit of a quick hack.
|
||||
request.UserName ?? _connection.Account.Account.UserName,
|
||||
Uri.EscapeDataString(request.UserName ?? _connection.Account.Account.UserName),
|
||||
"webservice");
|
||||
|
||||
// Set up the encoding
|
||||
|
Loading…
Reference in New Issue
Block a user