SOAP XML - Object reference not set to an instance of an object

Hi, this is my first time using this forum.

I´m trying to send and recieve XML data using curl.
The response is written to a file on the server. But I only get this response:

<faultstring>Server was unable to process request. ---> Object reference not set to an instance of an object.</faultstring>
<detail />

Here is my code:

echo 'POST /checkout_process.php HTTP/1.1
Content-Type: application/soap+xml; charset=ISO-8859-1
SOAPAction: ""';

$data='<?xml version="1.0" encoding="ISO-8859-1"?>
<soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="">
    <CreditTemplatePerson xmlns="">

	if (file_exists($f_name)) {

	$file=fopen($f_name,"w+") or exit("Unable to open file!");
	  $ch = curl_init();
	  curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml;charset=ISO-8859-1"));
	  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
	  curl_setopt($ch, CURLOPT_URL, $soap_url);
	  curl_setopt($ch, CURLOPT_USERPWD, "$UserLoginName:$Password");
	  //curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
	  curl_setopt($ch, CURLOPT_POST, 1);
	  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	  $response = curl_exec($ch);
 $fp = fopen("XML/ADDRESS/".$customer_id."_response.xml", "w+");

Can you see what I am doing wrong?
Any help would be gratefully appreciated.

Sounds like the soap server is expecting an object and getting something else. I’d check the soap server’s documentation. I don’t see any classes in your code, so it doesn’t look like there is an object to pass in the xml.

Thanks for your reply!

However, it seems that the problem was due to a simple mistake on my part.
I forgot to include empty strings for the fields I don´t need to use :rolleyes:.

Again, thanks for your time!