static void Main(string[] args) { const string serverUrl = "http://localhost:12345/"; var transferServer = new TransferServer(new RequestHandler()); using (new HttpListenerTransferEndpoint(serverUrl, transferServer)) { var transferClient = new SOAPClient(serverUrl); Console.Write("Create..."); var address = transferClient.BuildMessage().Create(new SampleData()); Console.WriteLine(address.Address); Console.Write("Put..."); var data = transferClient.BuildMessage().Put <SampleData>(new SampleData { A = "AAA" }); Console.WriteLine(data.A); Console.Write("Get..."); data = transferClient.BuildMessage().Get <SampleData>(); Console.WriteLine(data.A); Console.Write("Delete..."); transferClient.BuildMessage(); Console.WriteLine("OK"); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
public object Invoke(ObjectName name, string operationName, object[] arguments) { var request = new OperationRequestType { Input = arguments.Select(x => new ParameterType(null, x)).ToArray(), name = operationName, Signature = null }; var responseMessage = _soapClient.BuildMessage() .WithAction(Schema.InvokeAction) .WithSelectors(name.CreateSelectorSet()) .WithResourceUri(Schema.DynamicMBeanResourceUri) .AddBody(new InvokeMessage(request)) .SendAndGetResponse(); var payload = responseMessage.GetPayload <InvokeResponseMessage>(); return(payload.ManagedResourceOperationResult.Deserialize()); }
public T Get <T>(string resourceUri, string fragmentTransferExpression, IEnumerable <Selector> selectors) { return(_soapClient.BuildMessage().Get <T>(resourceUri, fragmentTransferExpression, selectors)); }