Я должен извиниться, я понимаю, что там много вопросов, подобных этому в переполнении стека.... может быть, даже переполняется ими... :)
Я делаю веб-звонок для мыльной службы, используя PHP, встроенный в мыльный клиент. В wsdl ожидается, что элемент, который я передаю, является строкой. Нет документации, а не wsdl, и компания заявляет, что она является xml. Поэтому я построил объект и преобразовал его в xml в php, и они подтвердили, что xml выглядит правильно для ожидаемого.
вот мой метод в моем классе
$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());
Я выделил xml над вызовом, и он выглядит корректно, но когда я передаю его __getLastRequest(), мыльный конверт пуст?
<?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>
у кого есть идеи? заранее спасибо
Я был в состоянии понять это, я не уверен, что это должно быть так на каждом вызове мыла, но мне пришлось добавить xml, который я передал в массив с индексом sLeadInfo, так как это содержащийся элемент в XML. Я ранее добавлял вокруг моего xml и, похоже, не работал по какой-либо причине. Вы можете увидеть редактирование на второй до последней строки gerenateXML()
Это было для saleslogix, просто для кого-то любопытно и ищет ответы
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());
}