jeudi 20 août 2015

Reactive pattern with Cook XML-RPC.NET design ideas, please

I am trying to combine [possibly async] calls from XML-RPC.NET with Reactive Programming. I am new to Rx and only slowing beginning to understand how to take advantage of it. I am also fairly to XML-RPC.NET. I understand some of the inner workings, yet might be unaware of some of it "abilities."

In my code, I subscribe to request from an http server as below:

var publisher = this.httpServer
    .TakeUntil(Observable.Create<object>(observer => token.Register(() => observer.OnNext(null))))
    .Where(ctx => ctx.Request.HttpMethod == "POST")
    .Subscribe(ctx =>               
        {
            ctx.Request.InputStream.ReadBytes(ctx.Request.ContentLength)
                .Subscribe(bts =>
                    {   
                        // Read Xml from the network
                        string Xml = Encoding.UTF8.GetString(bts);

I want to use XML-RPC.NET to parse this XML message. How do I do this? The library operates with objects such as XmlRpcStruct.

If you have experience with such things, please suggest a design.

Aucun commentaire:

Enregistrer un commentaire