如何将多维数组从php传递到.net webservice

时间:2015-04-28 20:14:23

标签: php .net web-services multidimensional-array nusoap

我有一个.Net网络服务,我用php使用nusoap消费。使用以下内容可以很好地完成所有工作:

require_once('libs/nusoap/lib/nusoap.php');
$client = new nusoap_client("mylocation", 'wsdl','','','','');
$PassedVariable = strtolower(trim(["PassedVariable"]));
$params = array(
    "PassedVariable"=>$PassedVariable
);
$result = $client->call('FunctionName', $params, '', '', false, true);
$success = $result["FunctionNameResult"];
$rs = $success["ObjectName"];
$json = '{success:true, data:' . json_encode($rs).'}';
echo $json; 

使用$ params的简单关联数组,如:

Array
(
    [username] => myuser
    [entereddt] => Thu Apr 23 2015 09:29:03 GMT-0500 (Central Standard Time)
    [qversion] => 1
    [rversion] => 2
)

在Web服务中,显式输入参数值,一切都很好。

我的问题是我的param数组现在包含这样的嵌套数组:

Array
(
    [username] => myuser
    [entereddt] => Thu Apr 23 2015 09:29:03 GMT-0500 (Central Standard Time)
    [qversion] => 1
    [rversion] => 2
    [tickets] => Array
        (
            [1] => Array
                (
                    [response] => TRUE
                    [comments] => N/A
                )
            [2] => Array
                (
                    [response] => TRUE
                    [comments] => N/A
                )
        )
    [members] => Array
        (
            [4] => Array
                (
                    [member1] => Array
                        (
                            [response] => TRUE
                            [comments] => N/A
                        )
                    [member2] => Array
                        (
                            [response] => TRUE
                            [comments] => N/A
                        )
                    [member4] => Array
                        (
                            [response] => TRUE
                            [comments] => N/A
                        )
                )
        )
    [otherinfo] => N/A
    [summary] => This is a test
)

但是当它从soap调用传递给.net webservice时," ticket"作为System.XML.XmlNode []出现。当Web服务评估时,它似乎没有任何内容。节点的innertext只是" Array"。如何"门票"从肥皂电话中传出,我将如何访问它的内容?

0 个答案:

没有答案