示例#1
0
        public void SendMessageMarshallTest()
        {
            var operation = service_model.FindOperation("SendMessage");

            var request    = InstantiateClassGenerator.Execute <SendMessageRequest>();
            var marshaller = new SendMessageRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);

            TestTools.RequestValidator.Validate("SendMessage", request, internalRequest, service_model);

            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       }
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();

            webResponse.Headers["Content-Length"] = UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString();
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = SendMessageResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                           as SendMessageResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
示例#2
0
        public void SendMessage_ValidationExceptionMarshallTest()
        {
            var operation = service_model.FindOperation("SendMessage");

            var request         = InstantiateClassGenerator.Execute <SendMessageRequest>();
            var marshaller      = new SendMessageRequestMarshaller();
            var internalRequest = marshaller.Marshall(request);

            TestTools.RequestValidator.Validate("SendMessage", request, internalRequest, service_model);

            var exception   = operation.Exceptions.First(e => e.Name.Equals("ValidationException"));
            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       },
                    { "x-amzn-ErrorType", "ValidationException"     },
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, exception).Execute();

            webResponse.Headers["Content-Length"] = UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString();
            var context  = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), true, webResponse, true);
            var response = SendMessageResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK);

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
        internal SendMessageResponse SendMessage(SendMessageRequest request)
        {
            var marshaller   = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return(Invoke <SendMessageRequest, SendMessageResponse>(request, marshaller, unmarshaller));
        }
示例#4
0
        /// <summary>
        /// Initiates the asynchronous execution of the SendMessage operation.
        /// <seealso cref="Amazon.SQS.IAmazonSQS"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the SendMessage operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <SendMessageResponse> SendMessageAsync(SendMessageRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return(Invoke <IRequest, SendMessageRequest, SendMessageResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
示例#5
0
        public async Task <SendMessageResponse> SendMessageAsync(SendMessageRequest request)
        {
            request.QueueName = this.QueueName;

            var marshaller   = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return(await _serviceClient.InvokeAsync <SendMessageRequest, SendMessageResponse>(request, marshaller, unmarshaller).ConfigureAwait(false));
        }
示例#6
0
        /// <inheritdoc/>
        public SendMessageResponse SendMessage(SendMessageRequest request)
        {
            request.QueueName = this.QueueName;

            var marshaller   = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return(_serviceClient.Invoke <SendMessageRequest, SendMessageResponse>(request, marshaller, unmarshaller));
        }
示例#7
0
        /// <inheritdoc/>
        public IAsyncResult BeginSendMessage(SendMessageRequest request, AsyncCallback callback, object state)
        {
            request.QueueName = this.QueueName;

            var marshaller   = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return(_serviceClient.BeginInvoke <SendMessageRequest>(request, marshaller, unmarshaller,
                                                                   callback, state));
        }
        public void SendMessageMarshallTest()
        {
            var operation = service_model.FindOperation("SendMessage");

            var request = InstantiateClassGenerator.Execute<SendMessageRequest>();
            var marshaller = new SendMessageRequestMarshaller();
            var internalRequest = marshaller.Marshall(request);
            var validator = new AWSQueryValidator(internalRequest.Parameters, request, service_model, operation);
            validator.Validate();


            var payloadResponse = new XmlSampleGenerator(service_model, operation).Execute();
            var context = new XmlUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, null);
            var response = SendMessageResponseUnmarshaller.Instance.Unmarshall(context)
                as SendMessageResponse;   
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);       
        }
        /// <summary>
        /// <para>The <c>SendMessage</c> action delivers a message to the specified queue.</para>
        /// </summary>
        /// 
        /// <param name="sendMessageRequest">Container for the necessary parameters to execute the SendMessage service method on AmazonSQS.</param>
        /// 
        /// <returns>The response from the SendMessage service method, as returned by AmazonSQS.</returns>
        /// 
        /// <exception cref="T:Amazon.SQS.Model.InvalidMessageContentsException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<SendMessageResponse> SendMessageAsync(SendMessageRequest sendMessageRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, SendMessageRequest, SendMessageResponse>(sendMessageRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
示例#10
0
        /// <summary>
        /// Initiates the asynchronous execution of the SendMessage operation.
        /// <seealso cref="Amazon.SQS.IAmazonSQS.SendMessage"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendMessage operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public async Task<SendMessageResponse> SendMessageAsync(SendMessageRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, SendMessageRequest, SendMessageResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
示例#11
0
        /// <summary>
        /// Initiates the asynchronous execution of the SendMessage operation.
        /// <seealso cref="Amazon.SQS.IAmazonSQS"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendMessage operation on AmazonSQSClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndSendMessage
        ///         operation.</returns>
        public IAsyncResult BeginSendMessage(SendMessageRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return BeginInvoke<SendMessageRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
示例#12
0
        /// <summary>
        /// Delivers a message to the specified      queue. With Amazon SQS, you now have
        /// the ability to send large payload messages that are up      to 256KB (262,144 bytes)
        /// in size. To send large payloads, you must use an AWS SDK that      supports SigV4
        /// signing. To verify whether SigV4 is supported for an AWS SDK, check the SDK      release
        /// notes.    
        /// 
        ///     <important>      
        /// <para>
        ///         The following list shows the characters (in Unicode) allowed in your message,
        /// according        to the W3C XML specification. For more information, go to       
        ///         <a href="http://www.w3.org/TR/REC-xml/#charsets">http://www.w3.org/TR/REC-xml/#charsets</a>
        ///                If you send any characters not included in the list, your request will
        /// be rejected.      
        /// </para>
        ///       
        /// <para>
        ///         #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | [#x10000 to #x10FFFF]
        ///      
        /// </para>
        ///     </important>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the SendMessage service method.</param>
        /// 
        /// <returns>The response from the SendMessage service method, as returned by SQS.</returns>
        /// <exception cref="InvalidMessageContentsException">
        /// The message contains characters outside the allowed set.
        /// </exception>
        /// <exception cref="UnsupportedOperationException">
        /// Error code 400. Unsupported operation.
        /// </exception>
        public SendMessageResponse SendMessage(SendMessageRequest request)
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return Invoke<SendMessageRequest,SendMessageResponse>(request, marshaller, unmarshaller);
        }
示例#13
0
        /// <summary>
        /// Initiates the asynchronous execution of the SendMessage operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendMessage operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<SendMessageResponse> SendMessageAsync(SendMessageRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return InvokeAsync<SendMessageRequest,SendMessageResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
示例#14
0
 IAsyncResult invokeSendMessage(SendMessageRequest sendMessageRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new SendMessageRequestMarshaller().Marshall(sendMessageRequest);
     var unmarshaller = SendMessageResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the SendMessage operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the SendMessage operation on AmazonSQSClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void SendMessageAsync(SendMessageRequest request, AmazonServiceCallback<SendMessageRequest, SendMessageResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new SendMessageRequestMarshaller();
     var unmarshaller = SendMessageResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<SendMessageRequest,SendMessageResponse> responseObject 
                     = new AmazonServiceResult<SendMessageRequest,SendMessageResponse>((SendMessageRequest)req, (SendMessageResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<SendMessageRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
        IAsyncResult invokeSendMessage(SendMessageRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }