WSDL 肥皂退货问题

发布于 2024-11-09 06:36:46 字数 2820 浏览 1 评论 0原文

大家好,我如何返回包含我选择的所有用户的 SOAP 信封或数组? 我试图返回数据库结果集的数组,但没有返回,这是我

<?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>

用来获取数据库中的数据的 wsdl 函数

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

                      }
}

调用 webservice 的页面

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

Hey guys, how i can return SOAP Envelope or Array with all users of i selected ?
i trying to return array of database resultset, but not returning, here is my 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' ) ) ;
?>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪意 2024-11-16 06:36:46

我认为您的代码中有几个缺失的部分。

  1. WSDL 定义表示您的响应是“字符串”类型,可能您需要创建一个复杂类型才能获取正确的信息,但由于我看不到您的表格,无法告诉您正确的答案

  2. 你没有从 php 函数返回任何内容.

纠正这些事情,你应该没问题。

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

  2. you are not returning anything from php function.

Correct those things and you should be fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文