문제

이 질문

WSDL Autodiscovery 모드에서 zend_soap_server로 웹 서비스를 만들려고 노력하고 있지만 매우 이상한 효과를 얻습니다 ... 여기서 코드 : 서버 :

<?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();
    }
.

SOAPACTIONS 클래스 :

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;
 }
.

}

나는 zend_soap_client 클래스를 사용하여 함수 Test1 및 Test2를 사용하려고 시도했다.

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 예외 : [Sender] 기능 ( "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', 배열, null, null, 배열) 1 /usr/local/zend/apache2/htdocs/webservice/client.php(6) : zend_soap_client -> __ 호출 ( '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