Zend Soap Server с WSDL AutoDiscovery не работает должным образом ожидаемым

StackOverflow https://stackoverflow.com/questions/5044213

Вопрос

Дубликат Этот вопрос

Я пытаюсь создать веб-сервис с zend_soap_server в режиме Autodiscovery WSDL, но я получаю очень странные эффекты ... Здесь код: Сервер:

<?php
require_once('Zend/Soap/AutoDiscover.php');
require_once('Zend/Soap/Server.php');
require_once('Zend/Soap/Wsdl.php');
require_once('library/SoapActions.php');
$wsdl = new Zend_Soap_Autodiscover();
$wsdl->setClass('SoapActions');
if (isset($_GET['wsdl'])) {
$wsdl->handle();
    } else {
    $server = new Zend_Soap_Server('http://localhost:8083/server.php?wsdl');
    $server->setClass('SoapActions');
    $server->setEncoding('ISO-8859-1');
    $server->handle();
    }
.

Класс SOACKACKS:

class SoapActions {

/**
 * Test function
 * 
 * @param String $a
 * @param String $b
 * @return String
 */
 public function test1($a, $b) {
    return "you passed me ".$a." ".$b;
 }

 /**
 * Test function 2
 * 
 * @param String $a
 * @param String $b
 * @return String
 */
 public function test2($a, $b) {
    return "you passed me ".$a." ".$b;
 }
.

}

Я пытался использовать функцию test1 и test2, используя класс zend_soap_client, здесь код:

require_once('Zend/Soap/Client.php');
    $client = new Zend_Soap_Client("http://localhost:8083/server.php?wsdl");

    try {
        echo $client->test2("foo","bar"); //this works!
    } catch (Exception $e) {
        echo $e;
    }

    try {
        echo $client->test1("foo","bar"); //this doesn't work!
    } catch (Exception $e) {
        echo $e;
    }
.

Я не могу понять, потому что функция TEST2 работает, как и ожидалось, функция TEST1 возвращает следующее исключение:

SOAPFAULT Исключение: [Отправитель] Функция («TEST1») не является действительным методом для Эта услуга в /usr/local/zend/share/zendframework/library/zend/soap/client.php:1121. Трассировки стека: 0 /usr/local/zend/share/zendframework/library/zend/soap/client.php(1121): SOAPCLIENT -> ___ SOAPCALL («TEST1», ARRAY, Нуль, нуль, массив) 1 /usr/local/zend/apache2/htdocs/webservice/client.php(6): Zend_soap_client -> __ call ('test1', Множество) 2 /usr/local/zend/apache2/htdocs/webservice/client.php(6): Zend_soap_client-> test1 ('foo', 'bar') 3 {main}

Я пытался инвертировать название функций ... Результатом невероятно, работает только Test2! Я сошел с ума, кажется, что где-то на стороне сервера он сохраняет имя функции ...

Может кто-нибудь помочь мне?

Это было полезно?

Решение

SOLVED! The problem was this setting in the php.ini file:

soap.wsdl_cache_enabled=1

I set this to 0 and now it works fine!

Другие советы

If you don't want change your php.ini:

// WSDL_CACHE_NONE;     /* 0 Pas de cache */
// WSDL_CACHE_DISK;     /* 1 Sur le disque supprimer le fichier pour le réinitialiser */
// WSDL_CACHE_MEMORY;   /* 2 En mémoire => redémarrer Apache pour le réinitialiser */
// WSDL_CACHE_BOTH;     /* 3 En mémoire et sur le disque */

$options = array();
$options['cache_wsdl'] = WSDL_CACHE_NONE;
$client = new Zend_Soap_Client("http://localhost:8083/server.php?wsdl", $options);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top