<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi, I resolved the problem following your comments. Thak you. <br>
<br>
I am writting the solution for possible future similar problems and
close the topic.<br>
<br>
I defined my root resources (HTML, XML-RPP, SOAP, etc.):<br>
<br>
class RootResource(resource.Resource):<br>
&nbsp;&nbsp;&nbsp; """Define the resources"""<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; def __init__(self):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resource.Resource.__init__(self)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.putChild('', Renders.Login())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.putChild('test', Renders.TestPage)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.putChild('loginHandler', HandleLogin())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.putChild('uploadHandler', HandleUpload())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.putChild('upload', Renders.Upload())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.putChild("SOAP", Converter())<br>
<br>
I set my resources as the site root and run the reactor.<br>
<br>
siteRoot = RootResource()&nbsp; <br>
reactor.listenTCP(8000, server.Site(siteRoot))<br>
<br>
<br>
<br>
Jean-Paul Calderone escribi&oacute;:
<blockquote
 cite="mid20070709141407.4947.1888526620.divmod.quotient.9437@ohm"
 type="cite">Wasn't going to reply to this, for reasons which will be
obvious momentarily,
  <br>
but I haven't seen a correct reply yet, so...
  <br>
  <br>
On Fri, 06 Jul 2007 09:46:38 +0200, Daniel de la Cuesta
<a class="moz-txt-link-rfc2396E" href="mailto:daniel.cuesta@iavante.es">&lt;daniel.cuesta@iavante.es&gt;</a> wrote:
  <br>
  <blockquote type="cite">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML
4.01 Transitional//EN"&gt;
    <br>
&lt;html&gt;
    <br>
&lt;head&gt;
    <br>
&nbsp;&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
    <br>
&lt;/head&gt;
    <br>
&lt;body bgcolor="#ffffff" text="#000000"&gt;
    <br>
Hi,&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
I have a twisted web server running using "twisted.web.http".&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
  </blockquote>
  <br>
You probably want to direct future questions on this topic to the
  <br>
twisted-web mailing list, where you'll get more attention from
  <br>
people more actively doing web things.
  <br>
  <br>
  <blockquote type="cite">The objective of the server is to convert
files to another format.
    <br>
Currently I upload the files and the conversion params using an HTTP
    <br>
POST from a form.&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
Now I want to add XML-RPC support to the conversion process. It means
    <br>
the user could process the conversion using the http form or calling
    <br>
directly the XML-RPC class.&lt;br&gt;
    <br>
  </blockquote>
  <br>
HTTP POST is probably a better way to upload files, in general.&nbsp;
MIME-ish
  <br>
encoding is a bit easier and has less overhead than base64 encoding.
  <br>
  <br>
  <blockquote type="cite">&lt;br&gt;
    <br>
This is my pages dispatch:&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
class MyRequestHandler(http.Request):&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp; &lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp;&amp;nbsp; pages = { '/' : loginPage, &lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
'/uploadHandler' : handleUpload,&lt;br&gt;
    <br>
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
'/uploadform' : uploadForm,&lt;br&gt;
    <br>
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
'/xmlrpc_converter': MyConverterXMLRPCClass() }&lt;br&gt;
    <br>
  </blockquote>
  <br>
Rarely is it correct to subclass Request.&nbsp; You can probably just
discard
  <br>
all of the above code.&nbsp; Aside from that, I don't know what the `pages'
  <br>
attribute is.&nbsp; I don't think anything pays any attention to it.
  <br>
  <br>
  <blockquote type="cite">&lt;br&gt;
    <br>
What I want to do is offer the user two possibilities to upload the
    <br>
file, one of them using HTTP POST (calling to "uploadform") and the
    <br>
other using XML-RPC (caling to xmlrpc_converter).&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
I have tried to implement MyConverterXMLRPCClass() as
follows:&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
MyConverterXMLRPCClass(xmlrpc.XMLRPC):&lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp; &lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init(self):&lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
""""""&lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
pass&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp;&amp;nbsp; def xmlrpc_mymethod1(self,
param)&lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
"""My process""&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
  </blockquote>
  <br>
This part looks okay.
  <br>
  <br>
  <blockquote type="cite">But It down't work, when I try &lt;a
class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="http://localhost:8000/xmlrpc_converter">"http://localhost:8000/xmlrpc_converter"</a>&gt;<a class="moz-txt-link-freetext" href="http://localhost:8000/xmlrpc_converter">http://localhost:8000/xmlrpc_converter</a>&lt;/a&gt;
I
    <br>
get the following error:&lt;br&gt;
    <br>
&lt;br&gt;
    <br>
"MyConverterXMLRPCClass instance has no __call__ method"&lt;br&gt;
    <br>
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;br&gt;
    <br>
How can I call MyConverterXMLRPCClass from an url in my http
server?&lt;br&gt;
    <br>
  </blockquote>
  <br>
I don't know how a MyConverterXMLRPCClass got called.&nbsp; I suppose you
have
  <br>
some more code that you didn't include in this message which looks at
the
  <br>
pages dictionary on the request object and does something with them.
  <br>
Whatever it is, I guess it isn't correct. ;)
  <br>
  <br>
Instead, what you should do is define a root resource which has
  <br>
MyConverterXMLRPCClass as a child at the "xmlrpc_converter" segment.&nbsp;
You
  <br>
can do this pretty easily using the basic Resource class in
twisted.web:
  <br>
  <br>
&nbsp;&nbsp; from twisted.web.resource import Resource
  <br>
&nbsp;&nbsp; from twisted.web.server import Site
  <br>
&nbsp;&nbsp; from twisted.internet import reactor
  <br>
  <br>
&nbsp;&nbsp; root = Resource()
  <br>
&nbsp;&nbsp; root.putChild('xmlrpc_converter', MyConverterXMLRPCClass())
  <br>
&nbsp;&nbsp; site = Site(root)
  <br>
&nbsp;&nbsp; reactor.listenTCP(8080, site)
  <br>
  <br>
The Resource class is implemented to keep track of child resources
added
  <br>
to it with putChild so that when a request comes in for one of them, it
  <br>
gives back the appropriate one and URL traversal or page rendering can
  <br>
continue.
  <br>
  <br>
Hope this helps,
  <br>
  <br>
Jean-Paul
  <br>
  <br>
_______________________________________________
  <br>
Twisted-Python mailing list
  <br>
<a class="moz-txt-link-abbreviated" href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a>
  <br>
<a class="moz-txt-link-freetext" href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a>
  <br>
  <br>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<title></title>
<p align="left"><span lang="es"><b><font color="#808080"
 face="RotisSemiSans">Daniel de la Cuesta Navarrete</font></b></span> <br>
<span lang="es"><b><font color="#808080" face="RotisSemiSans">T&eacute;cnico
de Desarrollo de Software</font></b></span></p>
<p align="left"><span lang="es"></span><span lang="es"><font
 color="#339966" face="IAVANTE" size="4">FUNDACI&Oacute;N IAVANTE</font></span>
<br>
<span lang="es"><font color="#339966" face="RotisSemiSans"><a class="moz-txt-link-abbreviated" href="mailto:daniel.cuesta@iavantefundacion.com">daniel.cuesta@iavantefundacion.com</a></font></span>
<br>
<span lang="es"><font color="#339966" face="RotisSemiSans">Tel. 951 015
300</font></span> </p>
<br>
<p align="center"><span lang="es"><font color="#999999" face="Verdana"
 size="1">Este correo electr&oacute;nico y, en su caso, cualquier fichero
anexo, contiene informaci&oacute;n confidencial exclusivamente dirigida a
su(s) destinatario(s). Toda copia o divulgaci&oacute;n deber&aacute; ser autorizada
por IAVANTE.</font></span></p>
<p align="center"><span lang="en-gb"><font color="#999999"
 face="Verdana" size="1">This e-mail and any attachments are
confidential and exclusively directed to its adressee(s). Any copy or
distribution will have to be authorized by IAVANTE.</font></span></p>
<br>
</div>
</body>
</html>