I have to apologize, I realize there a ton of questions like this on Stack Overflow....maybe even overflowing with them... :)
I am making a web call to a soap service using PHP's built in soap client. Per the wsdl it is expecting the item I am passing to be a string. There is no documentation rather then the wsdl and the company states its to be xml. So I hae built an object, and convert it to xml in php and they have confirmed the xml looks correct for what they are expecting.
here is my method in my class
$options = array( 'trace' => 1, 'exceptions' => 1, "features" => SOAP_SINGLE_ELEMENT_ARRAYS);
$client = new SoapClient($this->submitUrl."?WSDL", $options);
$client->InsertLeadInformation($xml);
print_r($client->__getLastRequest());
i have echoed out the xml above the call and it looks correct but when i pass it __getLastRequest() the soap envelope is empty?
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://xxxxxxxx.com/webservices2"><SOAP-ENV:Body><ns1:InsertLeadInformation/></SOAP-ENV:Body></SOAP-ENV:Envelope>
anyone have any ideas? thank you in advance
I was able to figure this out, I'm not sure if it needs to be this way on every soap call but I had to add the xml I passed in to an array with a index of sLeadInfo as that is the containing element in the xml. I had previously added the around my xml and that did not seem to work for whatever reason this did. You can see the edit on the second to last line of gerenateXML()
This was for saleslogix just incase anyone is curious and looking for answers
private function generateXML(){
$xml = new stdClass();
$xml->LeadCapture = new stdClass();
$xml->LeadCapture->Common = new stdClass();
$xml->LeadCapture->Common->DataSource = $this->dataSource;
$xml->LeadCapture->Common->TrackId = $this->trackId;
$xml->LeadCapture->Common->leadSourceCode = $this->leadSourceCode;
$xml->LeadCapture->Person = new stdClass();
$xml->LeadCapture->Person->FirstName = $this->firstname;
$xml->LeadCapture->Person->LastName = $this->lastName;
$xml->LeadCapture->Person->Title = $this->title;
$xml->LeadCapture->Person->Email = $this->email;
$xml->LeadCapture->Person->Phone = $this->phone;
$xml->LeadCapture->Person->Fax = $this->fax;
$xml->LeadCapture->Person->Address1 = $this->address1;
$xml->LeadCapture->Person->Address2 = $this->address2;
$xml->LeadCapture->Person->City = $this->city;
$xml->LeadCapture->Person->State = $this->state;
$xml->LeadCapture->Person->PostalCode = $this->postalCode;
$xml->LeadCapture->Person->Note = $this->note;
$xml->LeadCapture->Company = new stdClass();
$xml->LeadCapture->Company->CompanyName = $this->companyName;
$xml->LeadCapture->Company->Address1 = $this->companyAddress1;
$xml->LeadCapture->Company->Address2 = $this->companyAddress2;
$xml->LeadCapture->Company->City = $this->companyCity;
$xml->LeadCapture->Company->State = $this->companyState;
$xml->LeadCapture->Company->PostalCode = $this->companyPostalCode;
$xml->LeadCapture->Company->Country = $this->companyCountry;
$result = array('sLeadInfo'=>php_object_to_xml::object_to_xml($xml));
return $result;
private function submitDataSoap($xml) {
$xmlstring = $xml;
$options = array( 'trace' => 1, 'exceptions' => 1, "features" => SOAP_SINGLE_ELEMENT_ARRAYS);
$client = new SoapClient($this->submitUrl."?WSDL", $options);
$result = $client->InsertLeadInformation($xmlstring);
print_r($result);
//print_r($xml);
//print_r($client->__getLastRequest());
}