简体   繁体   English

WSDL Soap Return问题

[英]WSDL Soap Return Problem

Hey guys, how i can return SOAP Envelope or Array with all users of i selected ? 大家好,我如何在我选择了所有用户的情况下返回SOAP信封或数组? i trying to return array of database resultset, but not returning, here is my wsdl 我试图返回数据库结果集数组,但不返回,这是我的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>

Function of i using to get data in database 我用来获取数据库中数据的功能

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.'%"' );

                      }
}

Page of calls webserviçe 呼叫网页服务

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

I think you have several missing parts on your code. 我认为您的代码中缺少几个部分。

  1. The WSDL definition says your response is of type "string", may be you need to create a complex type to get the correct info, but as i cant see you table cant tell you the right answer WSDL定义说您的响应的类型为“字符串”,可能是您需要创建一个复杂的类型以获取正确的信息,但是正如我所见,表无法告诉您正确的答案

  2. you are not returning anything from php function. 您没有从php函数返回任何内容。

Correct those things and you should be fine. 纠正那些事情,你应该会好的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM