[英]Array response in WSDL - SOAP PHP
在我的wsdl代码中,我得到一个整数,我想在数组中返回结果。 为什么在我的输入中我只有一个整数,并且我需要数组中的结果,因为在我的php函数中,我想从客户端从选定的整数中返回数据库中的信息。
例如,我的客户发送1,在我的PHP中,我从DB中的“ 1”获取信息,作为他的“ ID(int)”,“ Name(string)”,“ Number1(int)”,“ Number2(int)”,“实际客户需求的日期和时间«YYYY-MM-DD hh:mm:hh»(??)”
我该怎么做?
谢谢,
这是我实际的wsdl,输入为一个整数,输出为一个整数:
<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应该包含以下部分:
<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生成器来创建描述文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.