public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { var response = new CreateQueueResponse(); if (context.ResponseData.IsHeaderPresent(HttpHeader.LocationHeader)) response.QueueUrl = context.ResponseData.GetHeaderValue(HttpHeader.LocationHeader); return response; }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { XmlTextReader reader = new XmlTextReader(context.ResponseStream); SendMessageResponse response = new SendMessageResponse(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case MNSConstants.XML_ELEMENT_MESSAGE_ID: response.MessageId = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_MESSAGE_BODY_MD5: response.MessageBodyMD5 = reader.ReadElementContentAsString(); break; } break; } } reader.Close(); return response; }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { XmlTextReader reader = new XmlTextReader(context.ResponseStream); ChangeMessageVisibilityResponse response = new ChangeMessageVisibilityResponse(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case MNSConstants.XML_ELEMENT_RECEIPT_HANDLE: response.ReceiptHandle = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_NEXT_VISIBLE_TIME: response.NextVisibleTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; } break; } } reader.Close(); return response; }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { XmlTextReader reader = new XmlTextReader(context.ResponseStream); ListQueueResponse response = new ListQueueResponse(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case MNSConstants.XML_ELEMENT_QUEUE_URL: response.QueueUrls.Add(reader.ReadElementContentAsString()); break; case MNSConstants.XML_ELEMENT_NEXT_MARKER: response.NextMarker = reader.ReadElementContentAsString(); break; } break; } } reader.Close(); return response; }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(context.ResponseStream); BatchReceiveMessageResponse batchReceiveMessageResponse = new BatchReceiveMessageResponse(); Message message = null; while (reader.Read()) { switch (reader.NodeType) { case System.Xml.XmlNodeType.Element: switch (reader.LocalName) { case MNSConstants.XML_ROOT_MESSAGE: message = new Message(); break; case MNSConstants.XML_ELEMENT_MESSAGE_ID: message.Id = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_RECEIPT_HANDLE: message.ReceiptHandle = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_MESSAGE_BODY_MD5: message.BodyMD5 = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_MESSAGE_BODY: message.Body = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_ENQUEUE_TIME: message.EnqueueTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; case MNSConstants.XML_ELEMENT_NEXT_VISIBLE_TIME: message.NextVisibleTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; case MNSConstants.XML_ELEMENT_FIRST_DEQUEUE_TIME: message.FirstDequeueTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; case MNSConstants.XML_ELEMENT_DEQUEUE_COUNT: message.DequeueCount = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_PRIORITY: message.Priority = (uint)reader.ReadElementContentAsInt(); break; } break; case System.Xml.XmlNodeType.EndElement: if (reader.LocalName == MNSConstants.XML_ROOT_MESSAGE) { batchReceiveMessageResponse.Messages.Add(message); } break; } } reader.Close(); return batchReceiveMessageResponse; }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { XmlTextReader reader = new XmlTextReader(context.ResponseStream); QueueAttributes attributes = new QueueAttributes(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case MNSConstants.XML_ELEMENT_QUEUE_NAME: attributes.QueueName = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_CREATE_TIME: attributes.CreateTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; case MNSConstants.XML_ELEMENT_LAST_MODIFY_TIME: attributes.LastModifyTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; case MNSConstants.XML_ELEMENT_VISIBILITY_TIMEOUT: attributes.VisibilityTimeout = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_MAXIMUM_MESSAGE_SIZE: attributes.MaximumMessageSize = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_MESSAGE_RETENTION_PERIOD: attributes.MessageRetentionPeriod = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_DELAY_SECONDS: attributes.DelaySeconds = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_POLLING_WAIT_SECONDS: attributes.PollingWaitSeconds = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_INACTIVE_MESSAGES: attributes.InactiveMessages = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_ACTIVE_MESSAGES: attributes.ActiveMessages = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.ATTRIBUTE_DELAY_MESSAGES: attributes.DelayMessages = (uint)reader.ReadElementContentAsInt(); break; } break; } } reader.Close(); return new GetQueueAttributesResponse() { Attributes = attributes }; }
public override AliyunServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.Instance.Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals(MNSErrorCode.InvalidArgument)) { return new InvalidArgumentException(errorResponse.Message, innerException, errorResponse.Code, errorResponse.RequestId, errorResponse.HostId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals(MNSErrorCode.QueueNotExist)) { return new QueueNotExistException(errorResponse.Message, innerException, errorResponse.Code, errorResponse.RequestId, errorResponse.HostId, statusCode); } return new MNSException(errorResponse.Message, innerException,errorResponse.Code, errorResponse.RequestId, errorResponse.HostId, statusCode); }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { XmlTextReader reader = new XmlTextReader(context.ResponseStream); Message message = new Message(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case MNSConstants.XML_ELEMENT_MESSAGE_ID: message.Id = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_MESSAGE_BODY_MD5: message.BodyMD5 = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_MESSAGE_BODY: message.Body = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_ENQUEUE_TIME: message.EnqueueTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; case MNSConstants.XML_ELEMENT_FIRST_DEQUEUE_TIME: message.FirstDequeueTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; case MNSConstants.XML_ELEMENT_DEQUEUE_COUNT: message.DequeueCount = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_PRIORITY: message.Priority = (uint)reader.ReadElementContentAsInt(); break; } break; } } reader.Close(); return new PeekMessageResponse() { Message = message }; }
public override AliyunServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { XmlTextReader reader = new XmlTextReader(context.ResponseStream); ErrorResponse errorResponse = new ErrorResponse(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: if (reader.LocalName == MNSConstants.XML_ROOT_ERROR_RESPONSE) { return UnmarshallNormalError(reader, innerException, statusCode); } else { return UnmarshallBatchDeleteError(reader); } } } return new MNSException(errorResponse.Message, innerException, errorResponse.Code, errorResponse.RequestId, errorResponse.HostId, statusCode); }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { return new BatchDeleteMessageResponse(); }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { var response = new DeleteMessageResponse(); // Nothing need to do with this response here return response; }
public override AliyunServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.Instance.Unmarshall(context); return new MNSException(errorResponse.Message, innerException, errorResponse.Code, errorResponse.RequestId, errorResponse.HostId, statusCode); }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { SetQueueAttributesResponse response = new SetQueueAttributesResponse(); // Nothing need to do with this response here return response; }