Lyu ABE | 12 Oct 16:38 2007
Picon

Client Web

Salut,

Bon, je suis en train de regarder comment communiquer avec le serveur
demexp en javascript. Etant total neophyte, j'aimerais que quelqu'un
m'explique un minimum sur quelle voie m'orienter...

J'ai vaguement compris que par exemple pour se logger, il faut utiliser
un protocole XML-RPC. Apres, c'est le flou total pour moi: comment faire
pour passer un login et un pwd au serveur, et quelles sont les retours
du serveur (y'a une histoire de cookie en retour si j'ai bien compris).

Par exemple (dites moi si je me trompe), est-ce que j'ai besoin de code
comme ca:...?
http://jsolait.net/

qui possede un module javascript xmlrpc (dont je n'ai pas reussi a
comprendre comment l'utiliser precisement).

Si quelqu'un a d'autres commentaires (utiliser ou pas javascript pour le
client, etc)...

	Voila. Lyu ABE
David MENTRE | 12 Oct 18:24 2007

Re: Client Web

Hello Lyu,

I prefer that one speaks English on this mailing list, we have
non-French speaking readers. ;-)

One day, I'll write a real doc on all of this. This email is a first start.

Le 12/10/07, Lyu ABE<lyu.abe <at> celery.ocn.ne.jp> a écrit :
> J'ai vaguement compris que par exemple pour se logger, il faut utiliser
> un protocole XML-RPC. Apres, c'est le flou total pour moi: comment faire
> pour passer un login et un pwd au serveur, et quelles sont les retours
> du serveur (y'a une histoire de cookie en retour si j'ai bien compris).

All communications to the server is done using a Remote Procedure Call
(RPC) to the server. An RPC is much like a regular function call,
except that call parameters might be sent at the other side of the
planet. ;-)

The demexp server currently supports two RPC protocols: ONC-RPC and
XML-RPC (through a dedicated proxy).

ONC-RPC is more efficient and safe but only available for few
languages: OCaml, C, C++ and Python (thanks to developments of Thomas
Petazzoni). ONC-RPC is a binary encoding over a TCP socket. ONC-RPC
has the big advantage that client and server stubs can be generated
from ONC-RPC message description.

Most programming languages (including above ones) support XML-RPC.
XML-RPC is an XML text encoding over HTTP protocol over a TCP socket.
The XML-RPC interface is just a transposition into the XML-RPC data
(Continue reading)

Diogene Laerce | 13 Oct 06:35 2007
Picon

Lyu Web Client

Hello Lyu

> Bon, je suis en train de regarder comment communiquer avec le serveur
> demexp en javascript. Etant total neophyte, j'aimerais que quelqu'un
> m'explique un minimum sur quelle voie m'orienter...

I tried before to dialog with javascript, so you need a javascript bank
to manage xml-rpc. All the banks Ive found were a bit heavy and
complicated to understand for a newbie so I turned to php with the
xmlrpc2.2 :

http://phpxmlrpc.sourceforge.net/

And heres the code working for logging in as example :

<?php
include 'xmlrpc.inc';

	//On verifie l'existence des variables $_POST['identifiant'] et
$_GET['password']
	if(isset($_POST['identifiant'], $_POST['password']))
	{
		$login	=	new xmlrpcval($_POST['identifiant'], "string");
		$pswd	=	new xmlrpcval($_POST['password'], "string");
	} 

	// Object to represent the server
	$server = new
xmlrpc_client("http://www.linux-france.org/cgi-bin/demexp-xmlrpc-demo");

(Continue reading)

Lyu ABE | 13 Oct 07:18 2007
Picon

Re: Lyu Web Client

Hi Diogene,

> I dont know what youre up to, but if you want we can try to coordonate
> our efforts to build the server dialog. Unless you want to build your
> own client : just let me know..

Basically, I want to know how the server can generate the proper HTML
layout dynamically to send to the client (because I said I would take
care of the Web Interface GUI) for different requested actions (question
browsing, answer layout and management, etc.).

Of course I do not intend to write my own code alone, but I understood
that you're quite busy now, so I decided to start understanding web
programming to be of some help in the coding of the web interface.

If you can explain to me "how things work", I'd be very happy (right
now, I roughly understand client-communication, but I lack the "howto"
experience).

And yes, we NEED to coordinate our efforts for the client.

	Lyu.
Lyu ABE | 13 Oct 08:44 2007
Picon

Questions

Hello,

I'd like to know how I can retrieve questions, answers, votes, etc. I 
tried to use the "question_info" method, but I do not understand the 
server's reply because I only got a int value.

My question is not "What am I doing wrong?", but rather "How to properly 
do that?".

	Thanks. Lyu
David MENTRE | 14 Oct 19:28 2007

Re: Questions

Hello Lyu,

Lyu ABE <lyu.abe <at> celery.ocn.ne.jp> writes:

> I'd like to know how I can retrieve questions, answers, votes, etc. I
> tried to use the "question_info" method, but I do not understand the
> server's reply because I only got a int value.

No, the question_info() method returns a quite complex data
structure. Here is part of its XDR (ONC-RPC) description:

struct response_t {
  response_desc_t r_info_desc;
  external_link_t r_info_link;
};

enum question_status_e { tagging_only = 1, public = 2 };

struct question_t {
  _int32 int q_timestamp;
  question_id_t q_id;
  question_desc_t q_desc;
  date_t q_info_limit_date; /* if set to zero, there is no limit date */
  question_status_e q_info_status;
  response_t q_info_responses<MAX_NUMBER_RESPONSES>;
  int q_info_num_votes;
  int q_info_elected_responses<MAX_NUMBER_RESPONSES>;
};

struct question_info_return_t {
(Continue reading)

Lyu Abe | 16 Oct 02:06 2007
Picon

Re: Questions

Hi David,

>> I'd like to know how I can retrieve questions, answers, votes, etc. I
>> tried to use the "question_info" method, but I do not understand the
>> server's reply because I only got a int value.
> 
> No, the question_info() method returns a quite complex data
> structure. Here is part of its XDR (ONC-RPC) description:

Okay, let's consider a simpler case. What about the 
max_question_id(cookie) function? The return value is of type:

struct max_question_id_return_t
{
     return_code_t max_question_id_rc;
     question_id_t max_question_id;
};

containing only a return code and the actual maximum question identifier 
on the server.

So what I do in PHP is:
1/ Generate the properly formatted message to send to the server:
$message = xmlrpcmsg("max_question_id", $cookie);

2/ Send the message...
$xmlrpc_res = $server->send($message);

... but here my $xmlrpc_res value has no particular type. Should I 
declare it as an array on the base of the max_question_id_return_t 
(Continue reading)

David MENTRE | 16 Oct 09:41 2007

Re: Questions

Hello Lyu,

2007/10/16, Lyu Abe <lyu.abe <at> celery.ocn.ne.jp>:
> Diogene suggested to me to take a look at Augustin's code under Dupral
> (link or location?).

http://drupal.org/project/demexp

This is in the wiki. ;-)

https://demexp.org/dokuwiki/doku.php?id=en:start#drupal_module_for_demexp

I need more time (and a computer) to answer the other part of your question.

Yours,
d.
David MENTRE | 16 Oct 09:47 2007

Re: Questions

Lyu,

2007/10/16, David MENTRE <dmentre <at> linux-france.org>:
> http://drupal.org/project/demexp

You can look at function _contact_demexp_server() and other functions
that call it.

However, from what I've read Augustin is using the xmlrpc() standard
call from PHP and not the xmlrpc external module, so the API is
probably quite different.

Yours,
d.
David MENTRE | 16 Oct 09:58 2007

Re: Questions

Hello,

2007/10/16, Lyu Abe <abe <at> optik.mtk.nao.ac.jp>:
> Diogene told me that he'd rather send a bunch of questions about the
> client after he's explored several things. I personnally think that
> asking questions regularly is safer. It avoids going too deep onto a
> wrong paths.
>
> What do you think?

Well, everybody works his own way but I also do think that you can ask
freely questions as they occur might be more efficient. I probably
won't answer all of them immediately but that will give me some time
to think about them.

Yours,
d.

Gmane