private void PreparedArguments(OperationRequest request) { if (request == null) throw new ArgumentNullException("request"); if (string.IsNullOrWhiteSpace(request.TargetOperation)) throw new ArgumentException("The TargetOperation is required."); if (string.IsNullOrWhiteSpace(request.TargetMethod)) throw new ArgumentException("The TargetMethod is required."); }
public OperationResponse InvokeOperation(OperationRequest request) { PreparedArguments(request); OperationResponse response = dispatcher.Post(request); if (response == null) throw new Exception("Unknow error"); if (response.Result.Status == OperationResultType.Success) { object[] results = SerializerHelper.DeserializeBinary((byte[])response.Result.Value); response.Result.Value = results[0]; } return response; }
public void TestMethod1() { UserInfo userInfo = new UserInfo() { UserId = "mis00a", UserName = "******", Password = "******", Email = "*****@*****.**", Mobile = "15913135168", EffectiveDate = DateTime.Now, ExpiredDate = DateTime.Now.AddYears(5) }; OperationRequest request = new OperationRequest() { TargetOperation = "userOperation", TargetMethod = OperationMethod.Create, Arguments = SerializerHelper.SerializeBinary(new object[] { userInfo }) }; response = proxy.InvokeOperation(request); System.Diagnostics.Debug.Assert(response.Result.Status == OperationResultType.Success); }
/// <remarks/> public System.IAsyncResult BeginPost(OperationRequest request, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("Post", new object[] { request}, callback, asyncState); }
/// <remarks/> public void PostAsync(OperationRequest request, object userState) { if ((this.PostOperationCompleted == null)) { this.PostOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPostOperationCompleted); } this.InvokeAsync("Post", new object[] { request}, this.PostOperationCompleted, userState); }
/// <remarks/> public void PostAsync(OperationRequest request) { this.PostAsync(request, null); }
public OperationResponse Post(OperationRequest request) { object[] results = this.Invoke("Post", new object[] { request}); return ((OperationResponse)(results[0])); }