← Back to team overview

ladon-dev-team team mailing list archive

[Question #243093]: APACHE2 Premature end of script headers: handler.py

 

New question #243093 on ladon:
https://answers.launchpad.net/ladon/+question/243093

Hello, i'm using Ubuntu 12.04 i want make a SOAP web service, this is what i've done:


PYTHON3 INSTALL

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:fkrull/deadsnakes
$ sudo apt-get update
$ sudo apt-get install python3.3


DISTRIBUTE-0.7.3 INSTALL

$ cd /home/user/distribute-0.7.3
$ sudo python3.3 setup.py install


JURKO-SUDS-A8C49059DA72 INSTALL

$ cd /home/user/jurko-suds-a8c49059da72
$ sudo python3.3 setup.py install


LADON-0.8.9 INSTALL

$ cd /home/user/ladon-0.8.9
$ sudo python3.3 setup.py install


THIS IS THE SOAP CLIENT

#!/usr/bin/python3.3
# -*- coding: UTF-8 -*-

from suds.client import Client

try:
    # client = Client("http://ladonize.org/python-demos/Calculator/soap/description";) --> with this line it runs OK
    # client = Client("http://localhost:8080/Calculator/soap/description";) --> with Ladon-ctl this works fine!
       client = Client("http://localhost/ws/Calculator/soap/description";)

    # Calculate 34+56
    result = client.service.add(34, 56)
    print("Content-Type: text/html;charset=utf-8\n")
    print(result)
except Exception as e:
    print("Content-Type: text/html;charset=utf-8\n")
    print(e)


THIS IS THE SOAP SERVER (ecows.py)

#!/usr/bin/python3.3

from ladon.ladonizer import ladonize


class Calculator(object):
    """
    Questo servizio esegue la somma algebrica di due interi.
    """
    @ladonize(int, int, rtype=int)
    def add(self, a, b):
        """
        Somma il valore di due interi e restituisce il valore risultante sotto forma di intero

        @param a: 1° intero
        @param b: 2° intero
        @rtype: Risultato dell'addizione'
        """
        return a + b


If i test everything with "ladon-ctl testserve /var/www/ws/ecows.py -p 8080"  (ladon2.7ctl OR ladon3.3ctl seems to be not a valid command)
Everything runs ok!
The problem is with apache2

This is my configuration:

<VirtualHost *:80>
	ServerAdmin webmaster@localhost

	DocumentRoot /var/www
	WSGIScriptAlias /ws/ /var/www/ws/handler.py
	<Directory />
		Options Indexes FollowSymLinks Includes ExecCGI
		#Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks Includes ExecCGI
		#Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
		AddHandler cgi-script .py
		AddHandler default-handler .html .htm
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

And this is my handler.py

#!/usr/bin/env python3.3

from ladon.server.wsgi import LadonWSGIApplication
from os.path import abspath, dirname


application = LadonWSGIApplication(
    ['ecows'], [dirname(abspath('/var/www/ws/ecows.py'))],
    catalog_name='ECOWS webservice catalog',
    catalog_desc='Funzioni disponibili')



So i have restartted my apache webserver and if i try

"http://localhost/ws";
There is a 500 Internal server error and the apache log says only "Premature end of script headers: handler.py"

With ladon-ctl and http://localhost:8080/ EVERYTHING WORKS FINE!!!

What am i doing wrong???
Tank you very much!!









-- 
You received this question notification because you are a member of
Ladon Developer, which is an answer contact for ladon.