php soap对象数组


在实现某个soap的时候遇到了点麻烦,实在无解,求问:

soap要求参数格式


 <fieldList>
    <KeyValue>
        <Key>string</Key>
        <Value>string</Value>
    </KeyValue>
    <KeyValue>
        <Key>string</Key>
        <Value>string</Value>
    </KeyValue>
</fieldList>

实际PHP需要这样实现:


 array (
    'filedlit' => array (
            'keyvalue' => array (
                    'key' => 'a1sd',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'as2d',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'as3d',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'as4d',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'asd',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'asd',
                    'value' => 'asd' 
            ) 
    )

);

当然我也构建了 obj版


 array('listfiled'=>array (
            new KeyValue ( 'asd', 'ccccc' ),
            new KeyValue ( 'asd', 'ccccc' ),
            new KeyValue ( 'asd', 'ccccc' ),
            new KeyValue ( 'asd', 'ccccc' ),
            new KeyValue ( 'asd', 'ccccc' )
));

obj版本服务器无法识别,求解

php soap

白、夜茶ぃ默 9 years, 6 months ago

生成xml格式

dar@k answered 9 years, 6 months ago

Your Answer