Как использовать NuSoap с PHP 5.6? - PullRequest
0 голосов
/ 07 ноября 2018

У меня есть мой wsdl в моем www.url.com/test.php?wsdl

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://dev1.locoprice.tourism-it.com/test.php?wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://dev1.locoprice.tourism-it.com/test.php?wsdl">
   <types>
      <xsd:schema targetNamespace="http://dev1.locoprice.tourism-it.com/test.php?wsdl">
         <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
         <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
      </xsd:schema>
   </types>
   <message name="helloRequest" />
   <message name="helloResponse" />
   <portType name="testPortType">
      <operation name="hello">
         <input message="tns:helloRequest" />
         <output message="tns:helloResponse" />
      </operation>
   </portType>
   <binding name="testBinding" type="tns:testPortType">
      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
      <operation name="hello">
         <soap:operation soapAction="http://dev1.locoprice.tourism-it.com/test.php/hello" style="rpc" />
         <input>
            <soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
         </input>
         <output>
            <soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
         </output>
      </operation>
   </binding>
   <service name="test">
      <port name="testPort" binding="tns:testBinding">
         <soap:address location="http://dev1.locoprice.tourism-it.com/test.php" />
      </port>
   </service>
</definitions>

и у меня есть простой метод с именем "hello" с простым "return" hello "" без параметров ..... так просто ..

когда я использую свой nusoap_client с getProxyClassCode, я получаю такой результат:

string (234) "класс nusoap_proxy_1384609830 расширяет nusoap_client {// void function hello () {$ params = array (); вернуть $ this-> call ('привет', $ params, 'http://testuri.com', 'http://url/test.php/hello');}} "

и когда я использую $ client-> call ('hello', array ())); у меня есть "bool (false)" без ошибок ......

Вы можете мне помочь? Спасибо тебе!

Дополнительная информация: мой сервер:

    <?php
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    require_once('nusoap/lib/nusoap.php');

    try {

        $URL       = "http://url/test.php";
        $namespace = $URL . '?wsdl';
        //using soap_server to create server object
        $server    = new soap_server;
        $server->configureWSDL('test', $namespace);

        //register a function that works on server
        $server->register('hello');

        $server->service(file_get_contents("php://input"));


    } catch (Exception $e) {
       echo $e->getMessage();
    }catch (Throwable $e) {
        echo $e->getMessage();
    }catch (SoapFault $e) {
        echo $e->getMessage();
    }catch (ContextErrorException $e){
        echo $e->getMessage();
    }   

function hello()
{
    return "hi";
}
...