CodeIgniter and WebService Consuptions (Sending xml with parameters)



Hello I am using CodeIgniter to consume a web service. I am having the following problem. I been trying with soapUI and I can send the xml well-formated and it works, which is:



<soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE" xmlns:ser="http://ift.tt/1kFTvA1">
<soapenv:Header/>
<soapenv:Body>
<ser:ExecTransaction>
<xmlMessage>
<![CDATA[
<Message>
<client>
<clientId>2323</clientId>
</client>
</Message>]]>
</xmlMessage>
</ser:ExecTransaction>
</soapenv:Body>
</soapenv:Envelope>


This works perfectly in soapUI. Now I try to send this xml well formatted through CodeIgniter in this way:


xmlMessage.xml.php



<![CDATA[
<Message>
<client>
<clientId>2323</clientId>
</client>
</Message>]]>


This is the code of the controller in CodeIgniter:



$xmlMessage = $this->load->view('xmlMessage.xml.php', $data, true);

try {
$client = @new SoapClient($this->config->item('soapTransactionService'));
}
catch (Exception $e) {
print_r ($e);
exit;
}

$result = $client->ExecTransaction(
array(
'xmlMessage' => $xmlMessage
));


And in this line where I call ExecTransaction I am getting an error ("Uncaught SoapFault exception") It is the same error that I get when I send a non-well formatted XML to the Webservice. So the problem is in the way that I formatted the XML. Any ideas how to solve this?


Thank you very much


No comments:

Post a Comment