Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php WSDL Soap返回问题_Php_Xml_Web Services_Soap_Wsdl - Fatal编程技术网

Php WSDL Soap返回问题

Php WSDL Soap返回问题,php,xml,web-services,soap,wsdl,Php,Xml,Web Services,Soap,Wsdl,嘿,伙计们,我如何返回我选择的所有用户的SOAP信封或数组? 我试图返回数据库结果集的数组,但没有返回,这是我的wsdl <?xml version='1.0' encoding='utf-8' ?> <definitions name="ClientSearch" targetNamespace="urn:ClientSearch" xmlns:typens="urn:ClientSearch" xmlns:xsd="http://www.w3.org/2001/XMLSch

嘿,伙计们,我如何返回我选择的所有用户的SOAP信封或数组? 我试图返回数据库结果集的数组,但没有返回,这是我的wsdl

<?xml version='1.0' encoding='utf-8' ?>
<definitions name="ClientSearch" targetNamespace="urn:ClientSearch" xmlns:typens="urn:ClientSearch" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
          <message name="searchUser">
                <part name="userName" type="xsd:string" />
          </message>
          <message name="searchUserResponse">
                <part name="searchUserReturn" type="xsd:string" />
          </message>
          <portType name="searchUserPortType">
                     <operation name="searchUser">
                             <input message="typens:searchUser" />
                             <output message="typens:searchUserResponse" />
                     </operation>
          </portType>
          <binding name="searchUserBinding" type="typens:searchUserPortType">
                   <operation name="searchUser">
                           <soap:operation soapAction="urn:searchUserAction" />
                           <input>
                                 <soap:body namespace="urn:ClientSearch" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
                           </input>
                           <output>
                                   <soap:body namespace="urn:ClientSearch" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                           </output>
                   </operation>
          </binding>
          <service name="clientSearchService">
                <port name="searchUserPort" binding="typens:searchUserBinding">
                        <soap:address location="http://localhost/service/server.php"/>
                </port>
        </service>
</definitions>
呼叫网页webserviceçe

<?php
ini_set("soap.wsdl_cache_enabled", "0");
$oSoapClient = new SOAPClient("http://localhost/service/service.wsdl");
var_dump( $oSoapClient->searchUser( 'name' ) ) ;
?>

我认为您的代码中缺少几个部分

  • WSDL定义说您的响应是“string”类型的,可能您需要创建一个复杂的类型来获得正确的信息,但是由于我看不到,您的表无法告诉您正确的答案

  • 您不会从php函数返回任何内容


  • 纠正这些错误,您应该会没事。

    我认为您的代码中缺少几个部分

  • WSDL定义说您的响应是“string”类型的,可能您需要创建一个复杂的类型来获得正确的信息,但是由于我看不到,您的表无法告诉您正确的答案

  • 您不会从php函数返回任何内容

  • 纠正这些事情,你应该会没事的

    <?php
    ini_set("soap.wsdl_cache_enabled", "0");
    $oSoapClient = new SOAPClient("http://localhost/service/service.wsdl");
    var_dump( $oSoapClient->searchUser( 'name' ) ) ;
    ?>