PHP Curl Soap带有Action''的消息由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理

时间:2017-03-17 14:27:26

标签: php curl soap wsdl soap-client

我将在php中使用curl感谢这个请求肥皂的帮助。

我的代码:

$soap_request  = "<?xml version=\"1.0\"?>\n";
  $soap_request .= '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" 
xmlns:atma="http://schemas.datacontract.org/2004/07/Atma.Plugin.Misc.ServiceAPI.DTOs.Re quest"> 
   <soapenv:Header/> 
   <soapenv:Body> 
      <tem:Login> 
         <!--Optional:--> 
         <tem:login> 
            <!--Optional:--> 
            <atma:Senha>123456</atma:Senha> 
            <!--Optional:--> 
            <atma:Usuario>user@email.com</atma:Usuario> 
         </tem:login> 
      </tem:Login> 
   </soapenv:Body> 
</soapenv:Envelope> ';

  $header = array(
    "Content-type: text/xml;charset=\"utf-8\"",
    "Accept: text/xml",
    "Cache-Control: no-cache",
    "Pragma: no-cache",
    "Content-length: ".strlen($soap_request),
  );

  $soap_do = curl_init();
  curl_setopt($soap_do, CURLOPT_URL, "http://homolog.snd.com.br/Plugins/Atma.Plugin.Misc.ServiceAPI/Controllers/ServiceAPIEndpoint.svc?wsdl" );
  curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
  curl_setopt($soap_do, CURLOPT_TIMEOUT,        10);
  curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
  curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($soap_do, CURLOPT_POST,           true );
  curl_setopt($soap_do, CURLOPT_POSTFIELDS,     $soap_request);
  curl_setopt($soap_do, CURLOPT_HTTPHEADER,     $header);

  if(curl_exec($soap_do) === false) {
    $err = 'Curl error: ' . curl_error($soap_do);
    curl_close($soap_do);
    print $err;
  } else {
    $xml = curl_exec($soap_do);
    $err = curl_error($soap_do);
    curl_close($soap_do);
    print_r($err);
    print_r($xml);
    print 'Operation completed without any errors';
  }

错误是:

  

带有操作的消息&#39;&#39;由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理。这可能是由于合同不匹配(发送方与接收方之间的操作不匹配)或发送方与接收方之间的绑定/安全性不匹配。检查发件人和收件人是否具有相同的合同和相同的约束(包括安全要求,例如邮件,传输,无)。

0 个答案:

没有答案