public void TestMethod1() { UserDo userInfo = new UserDo() { Name = "diana.wu", Password = "******", Email = "*****@*****.**", Mobile = "15913135168", EffectiveDate = DateTime.Now, ExpiryDate = DateTime.Now.AddYears(5) }; OperationRequest request = new OperationRequest() { TargetOperationId = "userOperation", TargetMethod = OperationMethod.Create, OperationArgs = SerializerUtils.SerializeBinary(new object[] { userInfo }) }; response = ClientProxy.InvokeOperation(request); System.Diagnostics.Debug.Assert(response.Result.Status == OperationResultType.Ok); }
public static OperationResponse InvokeOperation(OperationRequest request) { request.Url = dispatcher.Url; OperationResponse response = new OperationResponse() { Result = new OperationResult() { Message = "Client error", Type = OperationResultType.Error } }; PreparedArguments(request); if (request.OperationArgs is Object[]) { byte[] serializedArguments = SerializerUtils.SerializeBinary((Object[])request.OperationArgs); request.OperationArgs = serializedArguments; } try { response = dispatcher.Post(request); if (response.Result.Type == OperationResultType.Ok) { byte[] uncompressedResult = SevenZipUtils.ExtractBytes((byte[])response.Result.Value); object[] results = SerializerUtils.DeserializeBinary(uncompressedResult); response.Result.Value = results[0]; } } catch(Exception ex) { response.Result.Message = ex.Message; } return response; }