Help with SOAP Request and Response

I’m new to this SOAP thing, 'been doing some googling
but haven’t found what I’m looking for.

There is a soap request in this format:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://url.com/" xmlns:web="http://schemas.url2.org">
  <soapenv:Header/>
  <soapenv:Body>
  <ser:GetTransactionData>
  <ser:transactionQueryRequest>
  <web:Hash>xyz123</web:Hash>
   <web:ProductId>1122</web:ProductId>
    <web:TransactionReference>889900</web:TransactionReference>
    </ser:transactionQueryRequest>
    </ser:GetTransactionData>
    </soapenv:Body>
    </soapenv:Envelope>

The respose will be in this format:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 <s:Body>
<GetTransactionAcquirerDataResponse xmlns="http://url.com/">
<GetTransactionAcquirerDataResult xmlns:a="http://schemas.url2.org" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:ResponseCode>01</a:ResponseCode>
<a:ResponseDescription>OK</a:ResponseDescription>
<a:Amount>1000000</a:Amount>
<a:CardNumber>0</a:CardNumber>
<a:MerchantReference>889900</a:MerchantReference>
<a:PaymentReference>MER|REF|007</a:PaymentReference>
 <a:RetrievalReferenceNumber>34343883498349834</a:RetrievalReferenceNumber>
</GetTransactionAcquirerDataResult>
</GetTransactionAcquirerDataResponse>
</s:Body>
</s:Envelope>

How do I make the SOAP request within a PHP script and how do I
process the response and extract the needed values out; ResponseCode, Amount, CardNumber etc.

Many Thanks.

Use cURL http://uk3.php.net/curl to transfer the data, something like:


$data=	'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://url.com/" xmlns:web="http://schemas.url2.org">
<soapenv:Header/>
<soapenv:Body>
<ser:GetTransactionData>
<ser:transactionQueryRequest>
<web:Hash>xyz123</web:Hash>
<web:ProductId>1122</web:ProductId>
<web:TransactionReference>889900</web:TransactionReference>
</ser:transactionQueryRequest>
</ser:GetTransactionData>
</soapenv:Body>
</soapenv:Envelope>';
				
$url = 'WhereverYouAreSendingIt.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
		
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml","SOAPAction: \\"/soap/action/query\\"", "Content-length: ".strlen($data)));
	
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	
$response = curl_exec($ch);
echo "<pre>";
print_r($reponse);
echo "</pre>"


Thanks, but I don’t understand this bit :

$url = ‘WhereverYouAreSendingIt.com’;

What url.

There should be a service or URL that you are to send your SOAP message to, that is what the URL should be.

I’m getting an Internal Server Error as the response, please can you help double check this bit
whether it is really ok:

“SOAPAction: \”/soap/action/query\“”,

You should have an error.log file somewhere with a detailed message.