Salve, dovrei codificare un messaggio SOAP in questa maniera
codice:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns1:funzioneTest xmlns:ns1="namespace">
<Tag1>
<Tag2>
<campo1>test</campo1>
<campo2>test</campo2>
<campo3>test</campo3>
</Tag2>
</Tag1>
</ns1:funzioneTest>
</soapenv:Body>
</soapenv:Envelope>
Ho scritto due righe in questo modo:
codice:
$array = array();
$array[] = new SoapVar('test', XSD_STRING, null, null, 'campo1');
$array[] = new SoapVar('test', XSD_STRING, null, null, 'campo2');
$array[] = new SoapVar('test', XSD_STRING, null, null, 'campo3');
$parametro = new SoapVar($array, SOAP_ENC_OBJECT, null, null, 'Tag2');
$secondo = array($parametro);
$Tag1Parameter = new SoapVar($secondo, SOAP_ENC_OBJECT, null, null, 'Tag1');
$sess = $client->__soapCall('funzioneTest', array($parametro));
Se eseguo __getLastRequest() dopo la chiamata a funzioneTest, ciò che ottengo è
codice:
REQUEST: <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namaespace/">
<SOAP-ENV:Body>
<ns1:funzioneTest>
<campo1>test</campo1>
<campo2>test</campo2>
<campo3>test</campo3>
</ns1:funzioneTest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
senza aver i tag principali tag1 e tag2... che tra l'altro se eseguo un var_dump($Tag1Parameter) ci sono...
codice:
object(SoapVar)#8 (3) { ["enc_type"]=> int(301) ["enc_value"]=>
array(1) { [0]=> object(SoapVar)#7 (3)
{ ["enc_type"]=> int(301) ["enc_value"]=> array(3) {
[0]=> object(SoapVar)#4 (3) { ["enc_type"]=> int(101) ["enc_value"]=> string(4) "test" ["enc_name"]=> string(6) "campo1" }
[1]=> object(SoapVar)#5 (3) { ["enc_type"]=> int(101) ["enc_value"]=> string(4) "test" ["enc_name"]=> string(6) "campo2" }
[2]=> object(SoapVar)#6 (3) { ["enc_type"]=> int(101) ["enc_value"]=> string(4) "test" ["enc_name"]=> string(6) "campo3" }
} ["enc_name"]=> string(4) "Tag2" }
} ["enc_name"]=> string(4) "Tag1" }
Suggerimenti per far uscure correttamente i tag innestati?