我正在尝试调用一个webServer,其中complexTypes被描述为输入和输出参数
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="getTermsForService">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="universalid" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getTermsForServiceResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="getTermsForServiceResult" type="tns:ArrayOfString" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfString">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
并且
<wsdl:message name="getTermsForServiceSoapIn">
<wsdl:part name="parameters" element="tns:getTermsForService" >
</wsdl:message>
<wsdl:message name="getTermsForServiceSoapOut">
<wsdl:part name="parameters" element="tns:getTermsForServiceResponse" />
</wsdl:message>
<wsdl:portType name="Service1Soap">
<wsdl:operation name="getTermsForService">
<wsdl:input message="tns:getTermsForServiceSoapIn" />
<wsdl:output message="tns:getTermsForServiceSoapOut" />
</wsdl:operation>
</wsdl:portType>
我想,称它会像以下一样:
$client = new Zend_Soap_Client($this->config->webserviceWsdlFile);
try {
$result = $client->getTermsForService($_GET['universalid']);
} catch (Exception $e) {
// @TODO catch correctly
var_dump($e);
}
但似乎不是。那么我需要做些什么才能在答案中用字符串获得正确的结果...
答案 0 :(得分:-1)
$client = new Zend_Soap_Client($this->config->webserviceWsdlFile);
try {
$result = $client->getTermsForService(array('universalid' => $_GET['universalid']);
var_dump($result->getTermsForServiceResponse);
} catch (Exception $e) {
// @TODO catch correctly
var_dump($e);
}
给出了正确的结果:
object(stdClass)[123]
public 'string' =>
array
0 => string '0815' (length=10)
1 => string '0816' (length=10)