That is what we added, did you restart apache?

These are the steps we use to recreate the problem:

Step 1 : Configure and expose a test xmlrpc service in web2py:

a) Create a simple web2py application "testapp"
b) Edit db.py and add the following where "auth.settings" are
configured

auth.settings.allow_basic_login = True

c) Edit default.py and add @auth.requires_login() to call()

@auth.requires_login()
def call()


d) In default.py, add a function to be exposed as an xmlrpc service.

@service.xmlrpc
def multiply(a=1,b=1):
    product = int(a) * int(b)
    return dict(answer=product)

e) Create a user in the "testapp" web application, e.g.
"b...@mycompany.com", password = "oranges".  This user will be used to
authenticate against the test service.

Step 2 : Invoke XMLRPC service from Python

Assume server is available on localhost:8000.  The path to the XMLRPC
wrapper is "testapp/default/call/xmlrpc".

Open a python shell

>>> from xmlrpclib import ServerProxy

Create a server using format http://user:pass@host:port/path
>>> server = 
>>> ServerProxy('http://b...@mycompany.com:oranges@localhost:8000/testapp/default/call/xmlrpc')

Make sure to use "https" or "http" as appropriate. To enable logging
of request/response data, create with the named parameter
"verbose=True", e.g.
>>> server = 
>>> ServerProxy('http://b...@mycompany.com:oranges@localhost:8000/testapp/default/call/xmlrpc',
>>>  verbose=True)

Invoke the multiply() method
>>> server.multiply(2, 2)

You should see a dictionary containing the answer or, if it's
incorrectly configured, a 303 SEE OTHER error.

Cheers,
Robin

On Jul 12, 5:52 pm, Abhishek Gupta <abhishekgupta.i...@gmail.com>
wrote:
> Hello,
>
> I am still getting the same error. My /etc/apache2/mods-enabled/
> wsgi.conf looks like this :
>
> <IfModule mod_wsgi.c>
>     WSGIPassAuthorization On
> </IfModule>
>
> On 12 July 2011 01:15, Robin Marshall <robin.d.marsh...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > I found the problem, it's to do with WSGI - it needs to be configured
> > to pass on the authentication data.
>
> > In the configuration file for the module, somewhere like /etc/apache2/
> > mods-enabled/wsgi.conf you need to add a line:
>
> > WSGIPassAuthorization On
>
> > and reload apache.
>
> > Cheers,
> > Robin
>
> > On Jun 14, 6:30 am, Abhishek Gupta <abhishekgupta.i...@gmail.com>
> > wrote:
> > > I have the following functions defined in test.py file
>
> > > @auth.requires_login()
> > > def call():
> > >     return service()
>
> > > @service.xmlrpc
> > > def time():
> > >     import time
> > >     return time.ctime()
>
> > > and following in my db.py file
> > > auth.settings.allow_basic_
> > > login = True  #for CLI access
>
> > > When I execute the following commands in python shell :
>
> > > server = ServerProxy( '
> > > https://username:passw...@10.20.254.39/cloud_computing/test/call/xmlrpc'
> > )
> > > server.time()
>
> > > I get the following error
>
> > > Traceback (most recent call last):
> > >   File "<stdin>", line 1, in <module>
> > >   File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
> > >     return self.__send(self.__name, args)
> > >   File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
> > >     verbose=self.__verbose
> > >   File "/usr/lib/python2.6/xmlrpclib.py", line 1243, in request
> > >     headers
> > > xmlrpclib.ProtocolError: <ProtocolError for
> > > username:passw...@10.20.254.39/cloud_computing/test/call/xmlrpc: *303
> > SEE
> > > OTHER*>
>
> > > Am, I doing something wrong somewhere?
>
> > > --
> > > Abhishekhttp://abhishekgupta92.info
>
> --
> Abhishek
> Webpage <http://abhishekgupta92.info/> !!! Blog<http://thelazy.info/abhishek>

Reply via email to