1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<?php
//echo 'Curl: ', function_exists('curl_version') ? 'Enabled' : 'Disabled';
//Data, connection, auth
//$dataFromTheForm = $_POST['fieldName']; // request data from the form
$soapUrl = "http://secureuat.decisionsystems.co.za/AISConvergedB2BService/AISConvergedB2BService.svc?singleWsdl"; // asmx URL of WSDL
// $soapUser = "username"; // username
// $soapPassword = "password"; // password
// xml post structure
$xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:tran="http://schemas.datacontract.org/2004/07/Transunion.Auto.Convergence.B2B.BusinessModels">
<tem:GetConvergedData>
<!--Optional:-->
<tem:value>
<!--Optional:-->
<tran:ClientReference>Test002</tran:ClientReference>
<!--Optional:-->
<tran:Colour>KINETIC BLUE</tran:Colour>
<!--Optional:-->
<tran:Condition>FAIR</tran:Condition>
<!--Optional:-->
<tran:CustomerProductId>0</tran:CustomerProductId>
<!--Optional:-->
<tran:EngineNumber>DR20169</tran:EngineNumber>
<!--Optional:-->
<tran:GuideMonth>1</tran:GuideMonth>
<!--Optional:-->
<tran:GuideYear>2013</tran:GuideYear>
<!--Optional:-->
<tran:LoginId>181306</tran:LoginId>
<!--Optional:-->
<tran:OptionCodeNew>0</tran:OptionCodeNew>
<!--Optional:-->
<tran:OptionCodeUsed>0</tran:OptionCodeUsed>
<!--Optional:-->
<tran:Password>PW181306#</tran:Password>
<!--Optional:-->
<tran:RegistrationNumber>CR08RTGP</tran:RegistrationNumber>
<tran:RegistrationYear>2005</tran:RegistrationYear>
<!--Optional:-->
<tran:RequestorPerson>ANDRE</tran:RequestorPerson>
<!--Optional:-->
<tran:RequestorTelNumber>0</tran:RequestorTelNumber>
<!--Optional:-->
<tran:VehicleCode>22020110</tran:VehicleCode>
<tran:VehicleMileage>0</tran:VehicleMileage>
<!--Optional:-->
<tran:VinOrChasisNumber>MAJ1XXMRJ1DR20169</tran:VinOrChasisNumber>
</tem:value>
</tem:GetConvergedData>
</soap:Envelope>'; // data from the form, e.g. some ID number
$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: http://tempuri.org/IAISConvergedB2BService/GetConvergedData",
"Content-length: ".strlen($xml_post_string),
); //SOAPAction: your op URL
$url = $soapUrl;
// PHP cURL for https connection with auth
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of the doc
// curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// converting
$response = curl_exec($ch);
print_r ( $response );
// converting
$response1 = str_replace("<soap:Body>","",$response);
$response2 = str_replace("</soap:Body>","",$response1);
// convertingc to XML
$parser = simplexml_load_string($response2);
// user $parser to get your data out of XML response and to display it.
curl_close($ch);
?>
|