public async Task <string> ShowHelloAsync(HelloData hello, CancellationToken cancellationToken) { Console.WriteLine($"from thrift {hello.Name} call SayHello![{ServiceName}]"); var result = $"from thrift name:{hello.Name};gender:{hello.Gender};avatar:{hello.Head};From[{ServiceName}]"; return(await Task.FromResult(result)); }
/// <summary> /// Following method initiates the client to talk to service on the /// end points address specified in the app.config. We picked one of the end points. /// Any end point can be chosen /// </summary> /// <param name="args"></param> static void Main(string[] args) { HelloServiceClient client = new HelloServiceClient("WSHttpBinding_IHelloService"); HelloData userName = new HelloData(); userName.Fname = "Anshul"; userName.Lname = "Pandey"; Console.WriteLine("Client Send the message "+ userName.Fname + " "+ userName.Lname); Console.WriteLine("Client received Following Message from Service" + client.HelloWorld(userName)); Console.ReadLine(); }
public async Task <HelloData> SayHelloAsync(string name, CancellationToken cancellationToken) { Console.WriteLine($"from thrift {name} call SayHello![{ServiceName}]"); var result = new HelloData { Name = $"from thrift {name};From[{ServiceName}]", Gender = "male", Head = $"head.png" }; return(await Task.FromResult(result)); }
public static HelloData Hello(DisquuunResult[] data) { var version = Encoding.UTF8.GetString(ByteArrayFromSegment(data[0].bytesArray[0])); var sourceNodeId = Encoding.UTF8.GetString(ByteArrayFromSegment(data[0].bytesArray[1])); var nodeDatas = new List <NodeData>(); for (var i = 1; i < data.Length; i++) { var nodeIdStr = Encoding.UTF8.GetString(ByteArrayFromSegment(data[i].bytesArray[0])); var ipStr = Encoding.UTF8.GetString(ByteArrayFromSegment(data[i].bytesArray[1])); var portInt = Convert.ToInt16(Encoding.UTF8.GetString(ByteArrayFromSegment(data[i].bytesArray[2]))); var priorityInt = Convert.ToInt16(Encoding.UTF8.GetString(ByteArrayFromSegment(data[i].bytesArray[3]))); nodeDatas.Add(new NodeData(nodeIdStr, ipStr, portInt, priorityInt)); } var helloData = new HelloData(version, sourceNodeId, nodeDatas.ToArray()); return(helloData); }