Thank for your help<br><br>It&#39;s right, the code number 1 is not well structured that is the reason I modified it for the code number 2<br>But in the first one the xml_rpc call retun the good answer and in the second one I received a error message<br>
<br>I tried your code,this is a better structure (The Class Resource is in the next example in the book)<br><br> But the code doesn&#39;t work, I have the same error message about xml_rpc answer<br><br>[Failure instance: Traceback: &lt;class &#39;xmlrpclib.Fault&#39;&gt;: &lt;Fault -32602: &#39;server error. invalid method parameters&#39;&gt;<br>
C:\python27\lib\site-packages\twisted\internet\posixbase.py:263:_disconnectSelectable<br>C:\python27\lib\site-packages\twisted\internet\tcp.py:433:connectionLost<br>C:\python27\lib\site-packages\twisted\internet\tcp.py:277:connectionLost<br>
C:\python27\lib\site-packages\twisted\web\xmlrpc.py:373:connectionLost<br>--- &lt;exception caught here&gt; ---<br>C:\python27\lib\site-packages\twisted\web\xmlrpc.py:444:parseResponse<br>C:\python27\lib\xmlrpclib.py:1137:loads<br>
C:\python27\lib\xmlrpclib.py:793:close<br>]<br><br>The issue is how to call xml_rpc callRemote correctly ?<br><br>Thank again<br><br><div class="gmail_quote">Le 17 avril 2012 04:46, Phil Mayers <span dir="ltr">&lt;<a href="mailto:p.mayers@imperial.ac.uk">p.mayers@imperial.ac.uk</a>&gt;</span> a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 04/17/2012 03:38 AM, joel tremblet wrote:<br>
<br>
&gt; I try to declare the Proxy(OF_XMLRPC_URL) differently, without success<br>
&gt;<br>
&gt; Where is my mistake ....<br>
<br>
</div>That code is all wrong, and (to be blunt) pretty horrible too.<br>
<br>
Why have you re-implemented a HTTP protocol yourself? You&#39;re bound to<br>
get this wrong (and in fact have, in several ways). Don&#39;t do this. Use<br>
the HTTP stack that comes with Twisted.<br>
<br>
Anyway, your major mistake in the 1st example is that, at the end of the<br>
lineReceived method, you always call the sendResponse() method. This<br>
happens immediately, before the XMLRPC reply has come back, so your code<br>
sends &quot;no value&quot;. You need to attach the sendResponse method to the<br>
deferred returned from the xmlrpc call.<br>
<br>
I would junk it and start again, like this:<br>
<br>
from twisted.web import server, resource, xmlrpc, http<br>
<br>
proxy = xmlrpc.Proxy(XMLRPC_URL)<br>
<br>
class MyResource(resource.Resource):<br>
   isLeaf = True<br>
   def render_GET(self, request):<br>
     sessid = request.args[&#39;sessid&#39;][0]<br>
     keyid = request.args[&#39;keyid&#39;][0]<br>
     d = proxy.callRemote(&#39;checkCommand&#39;, sessid, keyid)<br>
     d.addCallback(self._done, request)<br>
     d.addErrback(self._err, request)<br>
     return server.NOT_DONE_YET<br>
<br>
   def _done(self, res, request):<br>
     if res!=1:<br>
       request.setResponseCode(406)<br>
     else:<br>
       request.setResponseCode(200)<br>
     request.finish()<br>
<br>
   def _err(self, failure, request):<br>
     request.setResponseCode(405)<br>
     request.finish()<br>
<br>
reactor.listenTCP(8080, server.Site(MyResource()))<br>
reactor.run()<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</blockquote></div><br>