How to send data to Rainbow connected V1
WSDL schema v1
1. Example code when using PHP and CURL
Structure of the XML (basic xml nodes)
$xml = '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<PostDataIn xmlns="https://leads.rcdata.co.uk/">
<sUN>USER</sUN>
<sPW>PASSWORD</sPW>
<sData>
<clientdata>
<title>Mr</title>
<firstname>test</firstname>
<lastname>test</lastname>
<company>test company</company>
<phone1>07123456789</phone1>
<phone2>07123456789</phone2>
<email>test@test.com</email>
<address>Rainbow UK Ltd</address>
<address2>Warley Street, Upminster Trading Park</address2>
<address3>Warley Street</address3>
<towncity>Upminster</towncity>
<postcode>RM14 3PJ</postcode>
<dob>13/12/1988</dob>
<insureddate>20/10/2017</insureddate>
</clientdata>
</sData>
</PostDataIn>
</soap12:Body>
</soap12:Envelope>';
Link to send the data
$url = "https://leads.rcdata.co.uk/v1/inbound.php?wsdl";
Header parameters
$headers[] = "Content-type: text/xml;charset=utf-8";
$headers[] = "Accept: application/soap+xml";
$headers[] = "Cache-Control: no-cache";
$headers[] = "Pragma: no-cache";
$headers[] = "Content-length: ".strlen($xml);
Sending data
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $sURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$output = curl_exec($ch);
curl_close($ch);
Information contained in the server response
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="https://leads.rcdata.co.uk/">
<env:Body>
<ns1:PostDataInResponse>
<ns1:PostDataInResult>123456789</ns1:PostDataInResult>
<ns1:PostDataInResponse>Success</ns1:PostDataInResponse>
<ns1:ResponseCode>0</ns1:ResponseCode>
<ns1:RequestResponse>Success</ns1:RequestResponse>
</ns1:PostDataInResponse>
</env:Body>
</env:Envelope>
2. Example code when using PHP and SOAP Client
Login credentials
$sUN = 'USER';
$sPW = 'PASSWORD';
Link to send the data
$sURL = "https://leads.rcdata.co.uk/v1/inbound.php?wsdl";
Structure of the XML (basic xml nodes)
$xml = '<clientdata>
<title>Mr</title>
<firstname>test</firstname>
<lastname>test</lastname>
<company>test company</company>
<phone1>07123456789</phone1>
<phone2>07123456789</phone2>
<email>test@test.com</email>
<address>Rainbow UK Ltd</address>
<address2>Warley Street, Upminster Trading Park</address2>
<address3>Warley Street</address3>
<towncity>Upminster</towncity>
<postcode>RM14 3PJ</postcode>
<dob>13/12/1988</dob>
<insureddate>20/10/2017</insureddate>
</clientdata>';
Sending data
try{
$client = new SoapClient($sURL, array('trace' => 1, 'login' => $sUN, 'password' => $sPW, "exception" => 1, 'soap_version' => SOAP_1_2));
$data = array('sData' => $xml, 'sUN' => $sUN, 'sPW' => $sPW);
$result = $client->PostDataIn($data);
} catch (Exception $exc){
echo $exc->getMessage();
}
Information contained in the server response is STD class Object
stdClass Object
(
[PostDataInResult] => 123456789
[PostDataInResponse] => Success
[ResponseCode] => 0
[RequestResponse] => Success
)
Extract std object values as follow:
$result->PostDataInResult;
$result->PostDataInResponse;
$result->ResponseCode;
$result->RequestResponse;