我正在通过 SoapUi 发送 SOAP 请求来测试此 Web 服务。
我目前有这个 PHP 数组:
array(7) {
["name"]=>
string(9) "John Doe"
["date"]=>
string(23) "2021-11-30 00:00:00.000"
["job"]=>
string(31) "developer"
["where_from"]=>
string(15) "france"
["address"]=>
array(3) {
["country"]=>
string(15) "france"
["city"]=>
string(10) "paris"
["vat_number"]=>
string(1) "123456"
}
["items"]=>
array(1) {
[0]=>
array(2) {
["cook"]=>
string(7) "spoon"
["clean"]=>
string(14) "vacuum"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试将其转换为 XML:
function convertToXml($data, $name='root', &$doc=null, &$node=null){
if ($doc==null){
$doc = new DOMDocument('1.0','UTF-8');
$doc->formatOutput = TRUE;
$node = $doc;
}
if (is_array($data)){
foreach($data as $var=>$val){
if …Run Code Online (Sandbox Code Playgroud)