internal InvokeAsyncResponse InvokeAsync(InvokeAsyncRequest request) { var marshaller = new InvokeAsyncRequestMarshaller(); var unmarshaller = InvokeAsyncResponseUnmarshaller.Instance; return(Invoke <InvokeAsyncRequest, InvokeAsyncResponse>(request, marshaller, unmarshaller)); }
public void InvokeAsyncMarshallTest() { var operation = service_model.FindOperation("InvokeAsync"); var request = InstantiateClassGenerator.Execute <InvokeAsyncRequest>(); var marshaller = new InvokeAsyncRequestMarshaller(); var internalRequest = marshaller.Marshall(request); RequestValidator.Validate("InvokeAsync", 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.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString()); var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse); ResponseUnmarshaller unmarshaller = InvokeAsyncResponseUnmarshaller.Instance; var response = unmarshaller.Unmarshall(context) as InvokeAsyncResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
/// <summary> /// Initiates the asynchronous execution of the InvokeAsync operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the InvokeAsync 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 <InvokeAsyncResponse> InvokeAsyncAsync(InvokeAsyncRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new InvokeAsyncRequestMarshaller(); var unmarshaller = InvokeAsyncResponseUnmarshaller.Instance; return(InvokeAsync <InvokeAsyncRequest, InvokeAsyncResponse>(request, marshaller, unmarshaller, cancellationToken)); }
public void InvokeAsyncAsync(InvokeAsyncRequest request, AmazonServiceCallback <InvokeAsyncRequest, InvokeAsyncResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new InvokeAsyncRequestMarshaller(); var unmarshaller = InvokeAsyncResponseUnmarshaller.Instance; Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if (callback != null) { callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult <InvokeAsyncRequest, InvokeAsyncResponse> responseObject = new AmazonServiceResult <InvokeAsyncRequest, InvokeAsyncResponse>((InvokeAsyncRequest)req, (InvokeAsyncResponse)res, ex, ao.State); callback(responseObject); } } ; BeginInvoke <InvokeAsyncRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
public Task<InvokeAsyncResponse> InvokeAsyncAsync(InvokeAsyncRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new InvokeAsyncRequestMarshaller(); var unmarshaller = InvokeAsyncResponseUnmarshaller.Instance; return InvokeAsync<InvokeAsyncRequest,InvokeAsyncResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal InvokeAsyncResponse InvokeAsync(InvokeAsyncRequest request) { var marshaller = new InvokeAsyncRequestMarshaller(); var unmarshaller = InvokeAsyncResponseUnmarshaller.Instance; return Invoke<InvokeAsyncRequest,InvokeAsyncResponse>(request, marshaller, unmarshaller); }
public void InvokeAsyncMarshallTest() { var operation = service_model.FindOperation("InvokeAsync"); var request = InstantiateClassGenerator.Execute<InvokeAsyncRequest>(); var marshaller = new InvokeAsyncRequestMarshaller(); var internalRequest = marshaller.Marshall(request); RequestValidator.Validate("InvokeAsync", 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.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString()); var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse); ResponseUnmarshaller unmarshaller = InvokeAsyncResponseUnmarshaller.Instance; var response = unmarshaller.Unmarshall(context) as InvokeAsyncResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
public IAsyncResult BeginInvokeAsync(InvokeAsyncRequest request, AsyncCallback callback, object state) { var marshaller = new InvokeAsyncRequestMarshaller(); var unmarshaller = InvokeAsyncResponseUnmarshaller.Instance; return BeginInvoke<InvokeAsyncRequest>(request, marshaller, unmarshaller, callback, state); }
public void InvokeAsyncAsync(InvokeAsyncRequest request, AmazonServiceCallback<InvokeAsyncRequest, InvokeAsyncResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new InvokeAsyncRequestMarshaller(); var unmarshaller = InvokeAsyncResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<InvokeAsyncRequest,InvokeAsyncResponse> responseObject = new AmazonServiceResult<InvokeAsyncRequest,InvokeAsyncResponse>((InvokeAsyncRequest)req, (InvokeAsyncResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<InvokeAsyncRequest>(request, marshaller, unmarshaller, options, callbackHelper); }