将SOAP数据导入php数组

时间:2021-02-17 21:38:25

I am very new to SOAP and struggling with this!

我是SOAP的新手并且正在努力解决这个问题!

I am calling for a SOAP response from an sql database

我正在从sql数据库中调用SOAP响应

$client = new SoapClient("url......");
$soapquery = array('CoCode' => $cocode, 'WAPassword' => $webpass, 'strSQL' => $sqlt);
$soapresult = $client->SQL($soapquery);
$balance = $soapresult->SQLResult;
print_r($balance);

The result shows in Chrome as the value requested, but when inspecting the source it shows as an xml

结果在Chrome中显示为请求的值,但在检查源时它显示为xml

<NewDataSet>
  <Table>
    <TOTAL>3348.1200</TOTAL>
  </Table>
</NewDataSet>

How can i get this information into either a PHP string or if i am calling more than one field into an array?

如何将这些信息输入PHP字符串或者如果我将多个字段调用到数组中?

Thanks in advance.

提前致谢。

1 个解决方案

#1


1  

I don't know why soapClient isn't parsing your response, but for a quick fix, you can use the php function simplexml_load_string.

我不知道为什么soapClient没有解析你的响应,但是为了快速修复,你可以使用php函数simplexml_load_string。

Here is an example: How to parse SOAP response without SoapClient

下面是一个示例:如何在没有SoapClient的情况下解析SOAP响应

#1


1  

I don't know why soapClient isn't parsing your response, but for a quick fix, you can use the php function simplexml_load_string.

我不知道为什么soapClient没有解析你的响应,但是为了快速修复,你可以使用php函数simplexml_load_string。

Here is an example: How to parse SOAP response without SoapClient

下面是一个示例:如何在没有SoapClient的情况下解析SOAP响应