PHP Soap客户端\uuu getLastRequest()为空

PHP Soap客户端\uuu getLastRequest()为空,php,xml,web-services,soap,wsdl,Php,Xml,Web Services,Soap,Wsdl,我必须道歉,我意识到在堆栈溢出上有很多这样的问题……甚至可能会被它们淹没……:) 我正在使用PHP的内置soap客户端对soap服务进行web调用。 根据wsdl,它期望我传递的项是字符串。没有文档,而是wsdl,公司将其声明为xml。 因此,我构建了一个对象,并用php将其转换为xml,他们已经确认xml看起来符合他们的期望 这是我上课的方法 $options = array( 'trace' => 1, 'exceptions' => 1, "features" => SO

我必须道歉,我意识到在堆栈溢出上有很多这样的问题……甚至可能会被它们淹没……:)

我正在使用PHP的内置soap客户端对soap服务进行web调用。 根据wsdl,它期望我传递的项是字符串。没有文档,而是wsdl,公司将其声明为xml。 因此,我构建了一个对象,并用php将其转换为xml,他们已经确认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,它看起来是正确的,但是当我传递它时,soap信封是空的吗

<?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>


有人有什么想法吗?提前感谢您

我能够弄明白这一点,我不确定在每次soap调用中是否需要这样做,但我必须将传入的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());
}

这不会回答您的问题,但当我使用soapweb服务时,我使用SOAPUI(免费版本):我强烈建议您使用它。它将自动为每个方法创建(成功/失败)示例。你也可以模拟响应Hey lea-我确实有soap ui,但是我不确定如何看到成功失败的例子?如果你感兴趣,我可以告诉你如何做到这一点。为了防止噪音,我将开一个新的聊天室。那太棒了