问题描述
<s:element name="RecordDataResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RecordDataResult" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="message" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
我尝试了此操作,但想出了一个无效的函数结果。.我只想从此函数中获取值
$response2 = $soapclient->RecordDataResponse()->RecordDataResult;
但出现此错误
Uncaught SoapFault exception: [Client] Function ("RecordDataResponse") is not a valid method for this service in ...
有什么提示吗?使用Windows PHP,我可以将数据放入..
解决方法
该函数名称实际上是ImportData1
,并且属性RecordDataResult
可能在响应中存在,也可能不存在。所以这里是:
$responseObject = $soapclient->ImportData1(/* put parameters here if any */);
if (isset($responseObject -> RecordDataResult))
{
$response2 = $responseObject -> RecordDataResult;
}
else
{
$response2 = 'N/A'; // For example
};