将 PHP 对象传递到 SOAP

Pass PHP object into SOAP

我正在尝试将 php 对象传递到 SOAP 服务中

$client = new phpWebServiceClient('kursevi_servis', true); //service

$criteria = new stdClass();
            $criteria->limit = $limit;
            $criteria->offset = $offset;
            $criteria->search_term = $keyword;
                        var_dump($client->__getFunctions());

$client->pretraga_jedinica($criteria) 

我尝试在 wsdl 文件中

<xsd:complexType name="trazeneJedinice">
                <xsd:sequence>
                    <xsd:element name="trazeneJediniceObj"
                        type="tns:trazeneJediniceObjType" maxOccurs="unbounded"
                        minOccurs="0">
                    </xsd:element>
                    <xsd:element name="count_all" type="xsd:int"></xsd:element>
                </xsd:sequence>
            </xsd:complexType>

            <xsd:complexType name="trazeneJediniceObjType">
                <xsd:sequence>
                    <xsd:element name="limit" type="xsd:int"></xsd:element>
                    <xsd:element name="offset" type="xsd:int"></xsd:element>
                    <xsd:element name="keyword" type="xsd:string"></xsd:element>

                </xsd:sequence>
            </xsd:complexType>

但我收到错误

Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in C:\wamp\www\link-university\application\modules\lessons\controllers\lessons.php:296 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://phpweb/l...', 'http://localhos...', 1, 0) #1 C:\wamp\www\link-university\application\modules\lessons\controllers\lessons.php(296): SoapClient->__call('pretraga_jedini...', Array) #2 C:\wamp\www\link-university\application\modules\lessons\controllers\lessons.php(296): phpWebServiceClient->pretraga_jedinica(Object(stdClass)) #3 [internal function]: Lessons->search() #4 C:\wamp\www\link-university\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #5 C:\wamp\www\link-university\index.php(116): require_once('C:\wamp\www\lin...') #6 {main} thrown in C:\wamp\www\link-university\application\modules\lessons\controllers\lessons.php on line 296

当我 var_dump 肥皂时,我得到了

array (size=13)
  0 => string 'nizKurseva spisak_kurseva(string $spisak_kursevaRequest)' (length=56)
  1 => string 'trazeneJedinice pretraga_jedinica(UNKNOWN $pretraga_jedinicaRequest)' (length=68)
  2 => string 'nizModula moduli_kursa(int $moduli_kursaRequest)' (length=48)
  3 => string 'nizJedinica jedinice_modula(int $jedinice_modulaRequest)' (length=56)
  4 => string 'nizElemenata elementi_jedinice(int $elementi_jediniceRequest)' (length=61)
  5 => string 'JedinicaPodaci jedinica(int $jedinicaRequest)' (length=45)
  6 => string 'ModulPodaci modul(int $modulRequest)' (length=36)
  7 => string 'KursPodaci kurs(string $kursRequest)' (length=36)
  8 => string 'trazeniKursevi pretraga_kurseva(string $pretraga_kursevaRequest)' (length=64)
  9 => string 'TestPodaci test(int $testRequest)' (length=33)
  10 => string 'nizKurseva spisak_testova(string $spisak_testovaRequest)' (length=56)
  11 => string 'nizGrupa getGrupe(int $getGrupeRequest)' (length=39)
  12 => string 'jediniceByKurs jedinice_by_kurs(int $jedinice_by_kursRequest)' (length=61)

我不知道,也许是这里的错误我不知道我做错了什么 所以在这一行

1 => string 'trazeneJedinice pretraga_jedinica(UNKNOWN $pretraga_jedinicaRequest)' (length=68)

乱猜,invalid/mistyped/missing 服务器名称?将解释您的 无法连接 错误。