verynew | 14 Apr 13:56 2009
Picon

xmlrpc with c#.net

Hello everyone,

                 Iam using the xmlrpc with the c#.net. My server function looks like this below.

API = (('object_id', 'ASCII string', 1),
        ('services', 'struct', 0, [('events', 'struct', 0, [('evt_read', 'boolean', 0),
        ('evt_create', 'boolean', 0),
        ('evt_move', 'boolean', 0),
        ('evt_change', 'boolean', 0)])]),
        ('reset', 'boolean', 0))

Now i have pass the value to this function like this 
chawpref(id, {'aw_report':{'evt_move':False, 'evt_change':True,}}

The problem is the second parameter is a nested structure. how can pass the nested structure value in the
xmlrpcstruct. 

Thank you very much..

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/xml-rpc/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
(Continue reading)

Troy Farrell | 14 Apr 16:54 2009

Re: xmlrpc with c#.net

Hello Dineshp.

You can nest XmlRpcStructs just like you would nest .net Hashtables:

         XmlRpcStruct t = new XmlRpcStruct();
         XmlRpcStruct u = new XmlRpcStruct();
         u.Add("Foo", "Bar");
         t.Add("subStructure", u);

Troy

From:
"verynew" <dineshp_832003 <at> yahoo.com>
To:
xml-rpc <at> yahoogroups.com
Date:
04/14/2009 08:10 AM
Subject:
[xml-rpc] xmlrpc with c#.net
Sent by:
xml-rpc <at> yahoogroups.com

Hello everyone,

Iam using the xmlrpc with the c#.net. My server function looks like this 
below.

API = (('object_id', 'ASCII string', 1),
('services', 'struct', 0, [('events', 'struct', 0, [('evt_read', 
'boolean', 0),
(Continue reading)

verynew | 20 Apr 12:22 2009
Picon

Re: xmlrpc with c#.net

Hello troy,

              Thank you very much for your answer. I have implemented the interface and structure as below 

[XmlRpcUrl("http://www.myurl.com")]
        public interface chawpref : IXmlRpcProxy
        {
            [XmlRpcMethod("chawpref")]
            XmlRpcStruct chawpref(string id, XmlRpcStruct servicess, bool reset);
}

iam passing value to the method like this 

try {

                        chawpref mydo = (chawpref)XmlRpcProxyGen.Create(typeof(chawpref));

                        XmlRpcStruct mystruct;
                        bool reset = true;
                        XmlRpcStruct ser = new XmlRpcStruct();
                        XmlRpcStruct events = new XmlRpcStruct();
                        bool value = true;
                        events.Add("evt_change", value);
                        ser.Add("services", "aw_email");
                        ser.Add("events",events);
                        IAsyncResult asr;
                        mystruct = ch.chawpref(docid, ser, reset);

    } catch(XmlRpcFaultException fex) {
        MessageBox.Show("Fault Response: " + fex.FaultCode + " " + fex.FaultString);
(Continue reading)

verynew | 21 Apr 12:32 2009
Picon

Re: xmlrpc with c#.net

Hello troy,

Thank you very much for your answer. I have implemented the
interface and structure as below

[XmlRpcUrl("http://www.myurl.com")]
public interface chawpref : IXmlRpcProxy
{
[XmlRpcMethod("chawpref")]
XmlRpcStruct chawpref(string id, XmlRpcStruct servicess, bool
reset);
}

iam passing value to the method like this

try {

chawpref mydo =
(chawpref)XmlRpcProxyGen.Create(typeof(chawpref));

XmlRpcStruct mystruct;
bool reset = true;
XmlRpcStruct ser = new XmlRpcStruct();
XmlRpcStruct events = new XmlRpcStruct();
bool value = true;
events.Add("evt_change", value);
ser.Add("services", "aw_email");
ser.Add("events",events);
IAsyncResult asr;
mystruct = ch.chawpref(docid, ser, reset);
(Continue reading)

Troy Farrell | 21 Apr 16:00 2009

Re: Re: xmlrpc with c#.net

Dinesh,

If your client is not receiveing a response, your client is probably not 
transmitting a request.  Try using Wireshark http://www.wireshark.org/ to 
listen to your network for the traffic.  You should see an HTTP request to 
www.myurl.com from your client.  You can also telnet to your server and 
send it something like this:

POST /RPC2 HTTP/1.1
Host: www.myurl.com
Content-Type: text/xml
Content-Length: 106
Connection: close

<?xml 
version="1.0"?><methodCall><methodName>system.listMethods</methodName><params></params></methodCall>

You should get back something like this:

HTTP/1.1 200 OK
Content-type: text/xml; charset="utf-8"
Content-length: 525
Connection: close
Date: Tue, 21 Apr 2009 15:45:28 UTC
Server: XMLRPC_ABYSS/Xmlrpc-c 1.16.1

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param><value><array><data>
(Continue reading)

verynew | 21 Apr 17:57 2009
Picon

Re: xmlrpc with c#.net

hello troy,

            Thank you once again for your reply. Actually is it possible to view the request in from the c#.Net itself so
that i can verify with the server api function. I mean to view the data packet which is send via HTTP request
in mycase it is the through the ixmlrpcproxy. if i can view the data then it would be nice. any idea troy?..

Thank you.

Dinesh.
--- In xml-rpc <at> yahoogroups.com, Troy Farrell <troy.farrell <at> ...> wrote:
>
> Dinesh,
> 
> If your client is not receiveing a response, your client is probably not 
> transmitting a request.  Try using Wireshark http://www.wireshark.org/ to 
> listen to your network for the traffic.  You should see an HTTP request to 
> www.myurl.com from your client.  You can also telnet to your server and 
> send it something like this:
> 
> POST /RPC2 HTTP/1.1
> Host: www.myurl.com
> Content-Type: text/xml
> Content-Length: 106
> Connection: close
> 
> <?xml 
> version="1.0"?><methodCall><methodName>system.listMethods</methodName><params></params></methodCall>
> 
> You should get back something like this:
> 
(Continue reading)

Troy Farrell | 21 Apr 18:32 2009

Re: Re: xmlrpc with c#.net

Hi Dinesh.

Since you are using XML-RPC.NET, you should read the Debugging section of 
the FAQ.  It answers your question:
http://xml-rpc.net/faq/xmlrpcnetfaq.html#5.1

From:
"verynew" <dineshp_832003 <at> yahoo.com>
To:
xml-rpc <at> yahoogroups.com
Date:
04/21/2009 10:57 AM
Subject:
[xml-rpc] Re: xmlrpc with c#.net
Sent by:
xml-rpc <at> yahoogroups.com

hello troy,

Thank you once again for your reply. Actually is it possible to view the 
request in from the c#.Net itself so that i can verify with the server api 
function. I mean to view the data packet which is send via HTTP request in 
mycase it is the through the ixmlrpcproxy. if i can view the data then it 
would be nice. any idea troy?..

Thank you.

Dinesh.
--- In xml-rpc <at> yahoogroups.com, Troy Farrell <troy.farrell <at> ...> wrote:
>
(Continue reading)

verynew | 22 Apr 12:10 2009
Picon

Re: xmlrpc with c#.net

Hello troy,

               This was really good help. I had used Fiddler to view the request header. Actually i have a send a request to
the server api function like this 

chawpref(id, {'aw_email':{'evt_change':True,}}

The second parameter aw_email is a structure and the evt_change is a nested structure of aw_email. So i did
this with the xmlrpcstruct as below in my code.

                        XmlRpcStruct mystruct;
                        bool reset = true;
                        XmlRpcStruct ser = new XmlRpcStruct();
                        XmlRpcStruct events = new XmlRpcStruct();
                        bool valu = false;
                        bool value = true;
                        ser.Add("services", "aw_email");
                        ser.Add("events",events);
                        events.Add("evt_change", value);
                        mystruct = mydo.chawpref(docid, ser, reset);
Actually in my code i think iam first adding the aw_email and then evt_change but the my request header shows
like this 
<param>
      <value>
        <struct>
          <member>
            <name>events</name>
            <value>
              <struct>
                <member>
(Continue reading)

verynew | 22 Apr 12:02 2009
Picon

Re: xmlrpc with c#.net

hello troy,

               This is really good help. I had used the fiddler to view the request and reponse header. I found what is the
problem i have. Actually my api function of the server looks like this below

chawpref(id, {'aw_email':{'evt_change':True,}}

The aw_email is a structure and evt_change nested structure of the aw_email. To pass value like this using
the xmlrpcstruct..

                        XmlRpcStruct mystruct;
                        bool reset = true;
                        XmlRpcStruct ser = new XmlRpcStruct();
                        XmlRpcStruct events = new XmlRpcStruct();
                        bool value = true;
                        ser.Add("services", "aw_email");
                        ser.Add("events",events);
                        events.Add("evt_change", value);
                        mystruct = mydo.chawpref(docid, ser, reset);
Actually iam adding the aw_email first and then the ev_change in the code but the request header it is like
this 

<param>
      <value>
        <struct>
          <member>
            <name>events</name>
            <value>
              <struct>
                <member>
(Continue reading)

Troy Farrell | 23 Apr 02:05 2009

Re: Re: xmlrpc with c#.net

Hello Dinesh.

Your program is giving you this:

{events: {evt_change: True}, services: "aw_email"}

You want this:

{aw_email: {evt_change: True}}

So maybe you need to change this:

ser.Add("events", events);

to this:

ser.Add("aw_email", events);

You API says nothing of a key "services."  Note that you have no control 
over the order of structure members in the XML.

xml-rpc <at> yahoogroups.com wrote on 04/22/2009 05:02:46 AM:
>
> hello troy,
> 
> This is really good help. I had used the fiddler to view the request
> and reponse header. I found what is the problem i have. Actually my 
> api function of the server looks like this below
> 
> chawpref(id, {'aw_email':{'evt_change':True,}}
(Continue reading)


Gmane