嘿伙计们,我如何能够选择所有用户的SOAP Envelope或Array? 我试图返回数据库结果集的数组,但没有返回,这是我的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>
i用于获取数据库中数据的功能
public function searchUser( $Name ){
$this->__getDatabase();
$this->Name = (string)$Name;
if( !is_null( $this->Name ) ){
$query = $this->db->query( 'SELECT * FROM `t_users` WHERE `nome` LIKE "%'.$this->Name.'%"' );
}
}
调用页面webserviçe
<?php
ini_set("soap.wsdl_cache_enabled", "0");
$oSoapClient = new SOAPClient("http://localhost/service/service.wsdl");
var_dump( $oSoapClient->searchUser( 'name' ) ) ;
?>
答案 0 :(得分:1)
我认为你的代码中有几个缺失的部分。
WSDL定义说您的响应是“string”类型,可能需要创建一个复杂的类型来获取正确的信息,但是因为我无法看到你的表无法告诉你正确的答案
你没有从php函数返回任何内容。
纠正这些事情你应该没事。