System.Collections.Generic.Dictionary
this.errorProperties = []; // System.Collections.ObjectModel.Collection<PropertyDefinitionBase>;
var argsLength = arguments.length;
if (argsLength == 0)
return;
if (typeof soapFaultDetailsOrResponseCode === 'number') {
this.result = ServiceResult_1.ServiceResult.Error;
this.errorCode = soapFaultDetailsOrResponseCode;
this.ErrorMessage = errorMessage;
this.errorDetails = null;
}
else {
this.result = ServiceResult_1.ServiceResult.Error;
this.errorCode = soapFaultDetailsOrResponseCode.ResponseCode;
this.ErrorMessage = soapFaultDetailsOrResponseCode.FaultString;
this.errorDetails = soapFaultDetailsOrResponseCode.ErrorDetails;
}
}
Object.defineProperty(ServiceResponse.prototype, "BatchProcessingStopped", {
get: function () { return (this.result == ServiceResult_1.ServiceResult.Warning) && (this.errorCode == ServiceError_1.ServiceError.ErrorBatchProcessingStopped); },
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceResponse.prototype, "Result", {
get: function () { return this.result; },
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceResponse.prototype, "ErrorCode", {
get: function () { return this.errorCode; },
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceResponse.prototype, "ErrorDetails", {
get: function () { return this.errorDetails; },
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceResponse.prototype, "ErrorProperties", {
get: function () { return this.errorProperties; } //System.Collections.ObjectModel.Collection<PropertyDefinitionBase>;
,
enumerable: true,
configurable: true
});
ServiceResponse.prototype.InternalThrowIfNecessary = function () {
if (this.Result == ServiceResult_1.ServiceResult.Error) {
throw new ServiceResponseException_1.ServiceResponseException(this);
}
};
ServiceResponse.prototype.Loaded = function () { };
ServiceResponse.prototype.LoadExtraErrorDetailsFromXml = function (reader, xmlElementName) {
if (reader.IsElement(XmlNamespace_1.XmlNamespace.Messages, XmlElementNames_1.XmlElementNames.MessageXml) && !reader.IsEmptyElement) {
this.ParseMessageXml(reader);
return true;
}
else {
return false;
}
};
ServiceResponse.prototype.LoadFromXmlJsObject = function (responseObject, service) {
this.result = ServiceResult_1.ServiceResult[responseObject[XmlAttributeNames_1.XmlAttributeNames.ResponseClass]];
this.errorCode = ServiceError_1.ServiceError[responseObject[XmlElementNames_1.XmlElementNames.ResponseCode]];
// TODO: Deal with a JSON version of "LoadExtraDetailsFromXml"
if (this.result == ServiceResult_1.ServiceResult.Warning || this.result == ServiceResult_1.ServiceResult.Error) {
this.ErrorMessage = responseObject[XmlElementNames_1.XmlElementNames.MessageText];
}
if (this.result == ServiceResult_1.ServiceResult.Success || this.result == ServiceResult_1.ServiceResult.Warning) {
if (!this.BatchProcessingStopped) {
this.ReadElementsFromXmlJsObject(responseObject, service);
}
}
this.MapErrorCodeToErrorMessage();
this.Loaded();
};
ServiceResponse.prototype.MapErrorCodeToErrorMessage = function () {
// Use a better error message when an item cannot be updated because its changeKey is old.
if (this.ErrorCode == ServiceError_1.ServiceError.ErrorIrresolvableConflict) {
this.ErrorMessage = Strings_1.Strings.ItemIsOutOfDate;
}
};
ServiceResponse.prototype.ParseMessageXml = function (reader) {
throw new Error("ServiceResponse.ts - ParseMessageXml - not used");
do {
//debugger;
reader.Read();
//if (reader.IsStartElement()) {
switch (reader.LocalName) {
case XmlElementNames_1.XmlElementNames.Value:
this.errorDetails[reader.ReadAttributeValue(null, XmlAttributeNames_1.XmlAttributeNames.Name)] = reader.ReadElementValue();
break;
case XmlElementNames_1.XmlElementNames.FieldURI:
// debugger;//next statement needs implementation or varification of accuracy
//this.errorProperties.push(ServiceObjectSchema.FindPropertyDefinition(reader.ReadAttributeValue(null, XmlAttributeNames.FieldURI)));
break;
case XmlElementNames_1.XmlElementNames.IndexedFieldURI:
this.errorProperties.push(new IndexedPropertyDefinition_1.IndexedPropertyDefinition(reader.ReadAttributeValue(null, XmlAttributeNames_1.XmlAttributeNames.FieldURI), reader.ReadAttributeValue(null, XmlAttributeNames_1.XmlAttributeNames.FieldIndex)));
break;
case XmlElementNames_1.XmlElementNames.ExtendedFieldURI:
var extendedPropDef = new ExtendedPropertyDefinition_1.ExtendedPropertyDefinition();
//debugger;//next statement may be inaccurate
extendedPropDef.LoadPropertyValueFromXmlJsObject(reader);
this.errorProperties.push(extendedPropDef);
break;
default:
break;
}
} while (!reader.HasRecursiveParent(XmlElementNames_1.XmlElementNames.MessageXml));
reader.SeekLast();
};
ServiceResponse.prototype.ReadElementsFromJson = function (responseObject
JsonObject
service) {
//virtual void
};
ServiceResponse.prototype.ReadElementsFromXmlJsObject = function (jsObject, service) { };
ServiceResponse.prototype.ThrowIfNecessary = function () { this.InternalThrowIfNecessary(); };
return ServiceResponse;
})();
exports.ServiceResponse = ServiceResponse;