Stella L.: keine Rückgabe bei SOAP

Beitrag lesen

Hallo!

ich probiere gerade etwas mit Zend_Soap.

Der SOAP Server läuft auf ein Webserver mit PHP 5.2.x, als SOAP Client verwende ich python mit SOAPpy.

Wenn ich bei einer Methode void als Rpckgabewert angeben, erhalbe ich beio SOAPpy eine Exception

HelloWorld.php
[code=php]<?php

class HelloWorld
{
    private $text = "";
    /**
     * @param  string
     * @return void
     */
    public function setText($text){
        $this->text = $text;
        return '';
    }
    /**
     * @return string
     */
    public function hello()
    {

return "Hello World!";
    }

/**
     * @return array
     */
    public function getFruits()
    {

return array('apple' , 'orange' , 'banana');
    }

}

?>[/code]

soap.php
[code=php]<?php
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application/'));
set_include_path(APPLICATION_PATH . '/../library' . PATH_SEPARATOR . get_include_path());

require_once 'Zend/Soap/Server.php';
require_once 'Zend/Soap/AutoDiscover.php';
require_once 'HelloWorld.php';

if(isset($_GET['wsdl'])){
    $autodiscover = new Zend_Soap_AutoDiscover();
    $autodiscover->setClass('HelloWorld');
    $autodiscover->handle();
}
else{
    $soap = new Zend_Soap_Server("http://example.com/soap.php?wsdl"); // this current file here
    $soap->setClass('HelloWorld');
    $soap->handle();
}
?>[/code]

ipython
[code=python]import SOAPpy
soap = SOAPpy.WSDL.Proxy('http://example.com/soap.php?wsdl')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/stella/<ipython console> in <module>()

/var/lib/python-support/python2.5/SOAPpy/WSDL.pyc in __init__(self, wsdlsource, config, **kw)
     77         portType = binding.getPortType()
     78         for operation in portType.operations:
---> 79             callinfo = wstools.WSDLTools.callInfoFromWSDL(port, operation.name)
     80             self.methods[callinfo.methodName] = callinfo
     81

/var/lib/python-support/python2.5/SOAPpy/wstools/WSDLTools.pyc in callInfoFromWSDL(port, name)
   1551             message = messages[operation.output.message]
   1552         except KeyError:
-> 1553             if self.strict:
   1554                 raise RuntimeError(
   1555                     "Recieved message not defined in the WSDL schema: %s" %

NameError: global name 'self' is not defined[/code]

Welchen SOAP-Typ muss ich bei der Methode setText zurückgeben?

Stella