demexp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

preliminary xml tests with Drupal Re: [Demexp-dev] [hack] basic structur


From: Augustin
Subject: preliminary xml tests with Drupal Re: [Demexp-dev] [hack] basic structure for an XML RPC <-> ONC RPC proxy for demexp in Python
Date: Sun, 3 Sep 2006 15:26:51 +0800
User-agent: KMail/1.8.2

David,

The data you sent us is great.
It allowed me to do some simple tests, and get familiar with the API.
It's looking good!

Well done.

On Friday 01 September 2006 11:57 pm, David MENTRE wrote:
> I've played a bit with XML-RPC server API in Python[1] as well as with
> Thomas's RPC binding for demexp[2] and I succeeded in hacking the start
> of a basic XML RPC <-> ONC RPC proxy for demexp (see the joined Python
> code).

Does this mean that I could either now or very soon actually connect to your 
demo server, via xml rpc?

The data you sent me was very useful. I have been able to run some small 
preliminary tests, to understand how I am supposed to use the Drupal API.
Now that I know how it works, it is actually quite simple.

Using the API, I have been able to reproduce exactly the same xml call. 

<?xml version='1.0'?>
<methodCall>
<methodName>question_info</methodName>
...

so, for the call itself, there is no problem. 
For the reply, though, I run into some error.
I simulated the reply from the server by injecting the xml you gave me in the 
appropriate place:

<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><array><data>
<value><struct>
<member>
<name>q_id</name>
<value><int>2</int></value>
...

The whole reply doesn't look like valid xml. I don't know the specs, but I 
find it strange to have such a deep nesting (member within struct within 
value within data within array within value within param...)

<methodResponse>
  <params>
    <param>
      <value>
        <array>
          <data>
            <value>
              <struct>
                <member>
                  <name>q_id</name>
                  <value><int>2</int></value>
                </member>
                <member>
                  <name>q_info_num_votes</name>
                  <value><int>4</int></value>
                </member>
                <member>
...

Are you sure that's valid?

In any case, when I injected the reply, the function supposed to parse the xml 
returned the error message: Parse error. XML not well formed.
It is possible that I made a mistake myself, but I wanted to check with you.


> >>> print server.question_info(27948569, 0, 3)


Can you explain the parameters 27948569, 0, 3 to me?

Is that 3 questions starting from question 0 (i.e. 0, 1, 2) requested by user 
with cookie 27948569?

From your pdf, page 19:

   Method question info returns the information for the set of questions of 
which identifiers are in [base id, base id + number). It returns rt request 
too much ids if number is greater than MAX NUMBER IDS, rt ok otherwise.
 messages.xdr 8a +≡   question_info_return_t question_info(cookie_t, 
int/*base_id*/, int/*number*/) = 6;



> Augustin, right now the return result is undocumented but for complex
> answers like question_info(), returned valued is an XML-RPC mix of
> <array>s and <struct>s. That should translate to PHP array of
> arrays.

as I said, I currently have a parsing problem, but a mistake on my end is 
possible.


> I'll try to document all that. In the meantime, you can look at 
> chapter 3 (p. 14) of demexp book[3] to get an idea of demexp
> protocol.

I did.

> Do not hesitate to ask questions. 

I won't.
thanks.


Augustin.



-- 
http://www.wechange.org/
Because we and the world need to change.
 
http://www.reuniting.info/
Intimate Relationships, peace and harmony in the couple.

http://www.gnosis-usa.com/
Revolutionary Psychology, White Tantrism, Dream Yoga...

http://www.masquilier.org/
Condorcet, Approval alternative, better voting methods.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]