Post command
Pierre Sahores
psahores at easynet.fr
Sat May 1 12:36:43 EDT 2004
Hi Alain,
Le 1 mai 04, à 02:41, Alain Farmer a écrit :
> Hello,
>
> I need help, folks.
>
> I have been creating a MetaCard stack that submits to
> a server-side PHP program. The payload of the post cmd
> is of type "text/xml" and, specifically, it is the XML
> that an XML-RPC program expects.
>
> The above submit works fine, and the server-side
> program returns what it is supposed to, b-u-t ... and
> here's the problem ... when the content is lengthy, my
> client-side stack does NOT wait long enough for the
> whole reply, and breaks-off the HTTP connection too
> soon.
>
> What do I need to do to make my MC client WAIT for the
> server-side program to complete the transmission of
> its reply? Should I be using the urlStatus function?
I use this kind of "POST" method handler without problem all the time
to access server-sided Rev or MC apps trough Apache and a PHP sockets
listener/port translator. The first below line is important :
>> set httpheaders to "Content-type: application/x-www-form-urlencoded"
>> & return
Try to see if you can pick somthing usable from the example code
below...
>> on adddatas
>> if (fld "citation" of card 1 of stack "ccitalis" is not "*" \
>> and fld "citation" of card 1 of stack "ccitalis" is not "" \
>> and fld "citation" of card 1 of stack "ccitalis" is not "Saisir
>> ici la nouvelle citation..." \
>> and fld "citation" of card 1 of stack "ccitalis" is not "Saisir
>> ici les extraits de citation (mots-clés et/ou expressions littérales
>> - utiliser" && quote & "+" & quote && "comme item de concaténation)
>> entrant dans la sélection de recherche...") \
>> and (fld "auteur__" of card 1 of stack "ccitalis" is not "*" \
>> and fld "auteur__" of card 1 of stack "ccitalis" is not "" \
>> and fld "auteur__" is not "Saisir ici le nom de l'auteur..." \
>> and fld "auteur__" of card 1 of stack "ccitalis" is not "Saisir
>> ici les noms d'auteurs (utiliser" && quote & "+" & quote && "comme
>> item de concaténation) entrant dans la sélection de recherche...") \
>> and (fld "concept_" of card 1 of stack "ccitalis" is not "*" \
>> and fld "concept_" of card 1 of stack "ccitalis" is not "" \
>> and fld "concept_" of card 1 of stack "ccitalis" is not "Saisir
>> ici le concept de référence..." \
>> and fld "concept_" of card 1 of stack "ccitalis" is not "Saisir
>> ici le concept entrant dans la sélection de recherche...") then
>> put "ci001=FE8&END=" into retour
>> set httpheaders to "Content-type:
>> application/x-www-form-urlencoded" & return
>> post retour to url (fld "csrecents" of cd 2 of stack "ccitalis")
>> if it is "" then
>> answer "La connexion avec le serveur distant est rompue." &
>> return & return & \
>> "Vérifiez votre configuration d'accès à l'internet"
>> exit adddatas
>> end if
>> if lineoffset(word 1 to -1 of fld "slogin" of cd 2 of stack
>> "ccitalis" & "¶" & word 1 to -1 of fld "smdp" of cd 2 of stack
>> "ccitalis" & "¶",macoscharset(it)) is not "0" then
>> put "|TI1=" & fld "citation" & \
>> "|TI2=" & fld "auteur__" & \
>> "|TI3=" & fld "titre___" & \
>> "|TI4=" & fld "date____" & \
>> "|TI5=" & fld "concept_" & \
>> "|TI6=" & fld "comment_" & \
>> "|IDC=" & encef(word 1 to -1 of fld "slogin" of cd 2 of
>> stack "ccitalis") & \
>> "|VAL=" & encef(word 1 to -1 of fld "smdp" of cd 2 of stack
>> "ccitalis") into larequete
>> put isocharset(larequete) into larequete
>> replace "&" with "¶" in larequete
>> replace "|" with "&" in larequete
>> put "ci001=FN1" & urlencode(larequete) & "&END=" into retour
>> set httpheaders to "Content-type:
>> application/x-www-form-urlencoded" & return
>> post retour to url (fld "csrecents" of cd 2 of stack "ccitalis")
>> if it is "" then
>> answer "La connexion avec le serveur distant est rompue." &
>> return & return & \
>> "Vérifiez votre configuration d'accès à l'internet" &
>> return & "avant de poursuivre." & return & return & \
>> "(succès des tests de 0% en 0 secondes)"
>> exit adddatas
>> else answer it
>> else answer "Vous devez vous authentifier comme utilisateur" &
>> return & "habilité à la saisie avant de pouvoir proposer de nouvelles
>> citations !"
>> else answer "Saisissez, au minimum, une citation un auteur et un
>> concept, SVP !"
>> end adddatas
If the server side of your app is a MC/Rev Stack or Script, it's
important to add the below line of code to the "on preopenstack" or "on
startup" handlers :
>> set the socketTimeoutInterval to "10"
Such kind of requests runs without troubble. In about testing the
limits of the method (MC/Rev client app, Apache + PHP + MC app server +
PostgreSQL back-end), it's able to let the client receive up to 16 Mo
of datas peer query trough a 10 Mbits LAN...
Hope this will help,
Kind Regards, Pierre
> ....
>
> Btw, this XMLRPC stack will be shared with the
> community and will, therefore, help a *LOT* of people;
> notably the Rev and Pan wikis, not to mention a school
> commission, a network of consultants, the lab I work
> for, etc.
>
> So please help me if you can,
>
> Alain F
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Win a $20,000 Career Makeover at Yahoo! HotJobs
> http://hotjobs.sweepstakes.yahoo.com/careermakeover
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>
>
--
Bien cordialement, Pierre Sahores
100, rue de Paris
F - 77140 Nemours
psahores+ at +easynet.fr
GSM: +33 6 03 95 77 70
Pro: +33 1 41 60 52 68
Dom: +33 1 64 45 05 33
Fax: +33 1 64 45 05 33
Inspection académique de Seine-Saint-Denis
Applications et SGBD ACID SQL (WEB et PGI)
Penser et produire "delta de productivité"
More information about the metacard
mailing list