Laravel将数组传递给SOAP调用

时间:2017-10-04 07:18:33

标签: php arrays laravel soap

我生成以下数组:

编辑这是dd($ pointsObject);

的结果
array:1 [▼
  "Points" => array:1 [▼
    "Point" => array:2 [▼
      0 => array:2 [▼
        "Type" => 3
        "Zone" => "Boot"
      ]
      1 => array:2 [▼
        "Type" => 4
        "Zone" => "Boot"
      ]
    ]
  ]
]

执行我在SoapUI中测试过的SOAP调用

 <Points xsi:type="test:ArrayOfPoint" soapenc:arrayType="test:Point[]" xmlns:test="https://XXXXXXXX.com">
       <Point>
           <Type type="xsd1:DType">1</Type>
           <Zone type="xsd1:Zone">Boot</Zone>
       </Point>
       <Point>
           <Type type="xsd1:DType">1</Type>
           <Zone type="xsd1:Zone">Boot</Zone>
       </Point>
 </DamagePoints>

出于某种原因,我在Laravel应用程序中收到此错误:

  

SOAP-ERROR:编码:对象没有&#39;类型&#39;属性

以下是生成我的数组的代码:

$pointsObject = array();

foreach ($points as $point) {
    $pointsObject['Points']['Point'][] = array(
        'Type'  => $point->type_id,
        'Zone'  => $point->zone
    );
}

dd($pointsObject);

0 个答案:

没有答案