WSDL 中的数组响应 - SOAP PHP [英] Array response in WSDL - SOAP PHP

查看:24
本文介绍了WSDL 中的数组响应 - SOAP PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 wsdl 代码中,我得到一个整数,我想以数组形式返回结果.为什么在我的输入中我只有一个整数,而我需要结果在数组中,因为在我的 php 函数中,我想从客户端选择的整数返回数据库中的信息.

In my wsdl code, i get an integer and i want to return result in array. Why in my input i have only one integer and i need result in array because in my php function i want to return information from Database from choosen integer by client.

例如,我的客户端发送 1,在我的 php 中,我从 DB 中的1"获取信息作为他的ID (int)"、Name(string)"、Number1(int)"、Number2(int)","客户实际需求日期和时间« YYYY-MM-DD hh:mm:hh » (??)"

Example, my client send 1, in my php i get information from "1" in DB as his "ID (int)","Name(string)","Number1(int)","Number2(int)","Date&Time of actual client demand « YYYY-MM-DD hh:mm:hh » (??)"

我该怎么做?

谢谢,

这是我的实际 wsdl,输入一个整数,输出一个整数:

this is my actual wsdl with input of one integer and output of one integer :

<message name='getResultRequest'> 
  <part name='numeropark' type='xsd:int'/>
</message> 
<message name='getResultResponse'> 
  <part name='result' type='xsd:string'/> 
</message> 

<portType name='getResultPortType'> 
  <operation name='getResult'> 
    <input message='tns:getResultRequest'/> 
    <output message='tns:getResultResponse'/> 
  </operation> 
</portType> 

<binding name='getResultBinding' type='tns:getResultPortType'> 
  <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> 
  <operation name='getResult'> 
    <soap:operation soapAction='urn:xmethods-delayed-quotes#getResult'/> 
    <input> 
      <soap:body use='encoded' namespace='urn:xmethods-delayed-calcul' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </input> 
    <output> 
      <soap:body use='encoded' namespace='urn:xmethods-delayed-calcul' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </output> 
  </operation> 
</binding> 

<service name='getResultService'> 
  <port name='getResultPort' binding='getResultBinding'> 
    <soap:address location='http://XXX.XXXX.com/soap/soap-server.php'/> 
  </port> 
</service> 

推荐答案

要返回数组,您应该定义一个 complexType.例如,如果您想返回字符串数组,则您的 WSDL 应包含以下部分:

To return array, you should define a complexType. For example, if you want to return the array of strings, your WSDL should contain this part:

<wsdl:types>
    <xsd:schema targetNamespace="http://schema.example.com">
      <xsd:complexType name="resultArray">
        <xsd:complexContent>
          <xsd:restriction base="SOAP-ENC:Array">
            <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]" />
          </xsd:restriction>
        </xsd:complexContent>
      </xsd:complexType>
    </xsd:schema>
</wsdl:types>
<message name='getResultRequest'> 
  <part name='numeropark' type='xsd:int'/>
</message> 
<message name='getResultResponse'> 
  <part name='result' type='tns:resultArray'/> 
</message>

我建议您使用任何 WSDL 生成器来创建描述文件.

And I suggest you use any WSDL generator to create description file.

这篇关于WSDL 中的数组响应 - SOAP PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆