Hi there
I'm new to soap and I'm using the NuSOAP library. I'm trying to send xml to a soap server and then receive a response. I'm getting nowhere with this and it's beginning to frustrate me.
Here is what I was provided with:
First Snippet
POST /Submit.asmx HTTP/1.1
Host: xxxxxxx.co.za
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.xxxxxxx.co.za/SubmitLead"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SubmitLead xmlns="http://www.xxxxxxx.co.za/">
<xmlLead>xml</xmlLead>
</SubmitLead>
</soap:Body>
</soap:Envelope>
Second Snippet
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SubmitLeadResponse xmlns="http://www.xxxxxxx.co.za/">
<SubmitLeadResult>string</SubmitLeadResult>
</SubmitLeadResponse>
</soap:Body>
</soap:Envelope>
As far as I can tell, the first code snippet is for submitting to the soap server and the second snippet is for receiving a response. I've had no luck receiving a response and I'm not even sure if the data I'm sending is actually being received from the server.
Here is my code:
$name = 'test';
$email = 'test@test.com';
$cell = '0123456789';
$stockid = '1234567';
$ref = time();
$xmlLead = '<?xml version="1.0" encoding="UTF-8"?>
<Lead>
<General>
<dealer type="IX">419</dealer>
<source ref="'.$ref.'">string</source>
<enquiry>1</enquiry>
<subtype>4</subtype>
<comment />
</General>
<Prospect>
<title />
<name>'.$name.'</name>
<surname />
<email>'.$email.'</email>
<home />
<work />
<mobile>'.$cell.'</mobile>
<idnumber />
<comment />
<area />
<national>true</national>
<license>true</license>
</Prospect>
<Item>
<id>'.$stockid.'</id>
<purchaseDate />
</Item>
</Lead>';
require_once('lib/nusoap.php');
$soapclient = new nusoap_client('http://xxxxxxx.co.za/Submit.asmx?WSDL');
$submit_lead = $soapclient->call('SubmitLead',
$xmlLead,
NULL,
'http://www.xxxxxxx.co.za/SubmitLead'
);
$lead_response = $soapclient->call('SubmitLeadResponse',
array('SubmitLeadResult'),
NULL,
'http://www.xxxxxxx.co.za/SubmitLead'
);
echo $lead_response;
Please help me figure out what I'm doing wrong?