PHP SoapClient - 节点属性

时间:2011-07-13 16:21:24

标签: php arrays soap encoding base64

虽然有答案,但似乎都没有。如何在PHP SoapClient中设置节点属性?目前我有:

array("BinaryImage" => array("_" => $imgarr, "xsi:type" => "base64Binary")

($ imgarr)是base64编码的图像文件。

但是当我使用它时,它会返回

<ns1:binaryimage>QXJyYXk=</ns1:binaryimage>

使用$ client-&gt; __ getLastRequest();所以数据显然是错误的。

我也收到此通知:

Notice: Array to string conversion in /var/www/vhosts/propertylogic.net/httpdocs/soap_feed/property24/add_property.php on line 303

但是如果我只是发送:

array("BinaryImage" => $imgarr)

SOAPClient正确接收数据,然后给我一个“缓冲区”错误。

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

基本上,WSDL将它定义为baseEncode,所以我试图a),baseEncode两次和b)baseEncode尝试定义属性时的数组。如果WSDL定义它是base64Binary字段,只需传递原始数据,它将为您完成所有工作。希望这有助于其他人。

相关问题