I need to create an xml to send via soap, but I can not. I need an xml with a CDATA tag and I can not do it. The xml must be in this format:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="url-here">
<soapenv:Header/>
<soapenv:Body>
<ser:callServiceMethod>
<!--Optional:-->
<xml>
<![CDATA[<fruits>
<type>G</type>
<flav>grape</flav>
<orders>
<order>
<client>12345</client>
<itens>
<item>
<cod>1</cod>
<name>Grape</name>
</item>
<item>
<cod>2</cod>
<name>Apple</name>
</item>
</itens>
</order>
</orders>
</fruits>]]>
</xml>
</ser:callServiceMethod>
</soapenv:Body>
</soapenv:Envelope>
I tried to create an array to generate the xml, this works, but without the CDATA, like this:
$soapArgs = array(
'xml' => array(
//need CDATA here
'fruits' => array(
'type' => 'G',
'flav' => 'grape',
'orders' => array(
'order' => array(
'client' => 12345,
'itens' => array(
'item' => array(
'cod' => 1,
'name' => 'Grape',
),
'item' => array(
'cod' => 2,
'name' => 'Apple',
),
)
)
)
)
)
);
$soapClient = new SoapClient($params);
$serviceResponse = $soapClient->callServiceMethod($soapArgs);
How do I generate this xml with CDATA to be able to send via SOAP?
Thank you guys!