473,395 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ZSI + mod_python

Hi,

I tried for the last 2 hours now to somehow grasp how to use ZSI over
mod_python. It's nice that they have a code-example in the ZSI docs,
but it's incomplete and you are left guessing.

The ZSI docs I used as reference can be found on http://
pywebsvcs.sourceforge.net/zsi.html#SECTION003130000000000000000

Here is where I am at so far:

First I created the two files as described in the ZSI docs. Namely
"MyHandler.py" and "ws.py". The first name is obvious to someone who
has coded at least a little bit of python, but it could be explicitly
stated in the docs, so the beginners don't get stumped by a silly
filename to start with ;)
The second filename is my own concoction. I suppose it does not matter
how it's named as you specify it in the apache conf anyhow.

So. Now to the apache conf. I put the scripts into the document-root
of my server. In this case: "/var/www/localhost". So this is what I
get (ommitting the unnecessary cruft -- marked it with "[...]"):

---- /etc/apache2/sites-enables/000-default.conf
-----------------------------------
<VirtualHost *>
[...]
DocumentRoot /var/www/localhost
AddHandler mod_python .py
[...]
<Directory /var/www/localhost/>
[...]
PythonHandler ws
PythonDebug On
</Directory>
[...]
--------------------------------------------------------------------------------------------------------

This is as far as I got. Now how do I call a service from this
setting? What's the URI I need to specify in the client?

I was trying "http://server/foo.py" in the browser, and it was
obviously doing *something* with the "ws.py" file. But I have no clue
what. Here's the output:

---- Browser output for http://server/foo.py
---------------------------------------------
Mod_python error: "PythonHandler ws"

Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

File "/var/www/localhost/ws.py", line 9, in handler
dispatch.AsHandler(modules=(MyHandler,), request=req)

File "/usr/lib/python2.4/site-packages/ZSI-2.0_rc3-py2.4.egg/ZSI/
dispatch.py", line 263, in AsHandler

File "/usr/lib/python2.4/site-packages/ZSI-2.0_rc3-py2.4.egg/ZSI/
parse.py", line 61, in __init__

File "/usr/lib/python2.4/site-packages/PyXML-0.8.4-py2.4-linux-
i686.egg/_xmlplus/dom/ext/reader/PyExpat.py", line 65, in fromStream
success = self.parser.ParseFile(stream)

ExpatError: no element found: line 1, column 0
--------------------------------------------------------------------------------------------------------
No matter what I append to the URI, it does not make a difference in
the output. And *why* am I forced to add a "abracadabra.py" to the
URI? Could I not set Apache up in a way that it would use the ZSI
handler for everything that calls -- let's say -- http://
webservices.server.tld/ instead of http://webservices.server.tld/
booh.py ?

I'm off to a little bit more of testing. But any hints/input would be
kindly appreciated ;)

Feb 15 '07 #1
0 1077

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: wolf | last post by:
i would like to briefly share my experiences with installing mod_python on a w2000 box. i must say that i believe the installation process to be unnecessarily complicated by the simple fact that...
2
by: Robert J. Hansen | last post by:
I'm not entirely certain comp.lang.python is the proper newsgroup for mod_python questions, but "comp.lang.python.web" doesn't seem to exist, so... my apologies in advance if this is considered...
0
by: Python_it | last post by:
I'm going to work with mod_python. I install mod_python 3.2.2b for python 2.4. If i test my install with mptest.py see this link:...
6
by: Anthony L. | last post by:
I am writing a web application that is comparable to a content management system used in blogging. I really want to use Python after having done some evaluation coding using Python 2.3.5 with...
1
by: treelife | last post by:
I'm getting and internal server error when | run the following mod_python script. I am actually trying to run Django. Script: from mod_python import apache def handler(req):...
2
by: exhuma.twn | last post by:
Hi again, as soon as I try to make use of the "session" object inside a psp-template file, I get the following error: Mod_python error: "PythonHandler mod_python.publisher" Traceback (most...
5
by: m.banaouas | last post by:
Hi, bonjour, witch versions are suitable to use for apache & mod_python ? Can i install and use "Apache 2.2.3" & "mod_python 3.2.10" (most recent versions) without facing any known major...
2
by: m.banaouas | last post by:
I installed Apache 2.2.3 and mod_python 3.2.10 on WinXP plateform I configured mod_python via httpd.conf: LoadModule python_module modules/mod_python.so but my script folder configuration...
3
by: Michael | last post by:
Hey everyone, Is it possible to automatically insert headers/footers using mod_python? I will be not be using PSP's, so I cannot use the PSP/include solution. Furthermore, the header will be...
3
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.