简体   繁体   English

PHP的SOAP不发送certificate.pem

[英]php SOAP not sending certificate.pem

I can load in the wsdl, pull out the functions and data types just fine but when I try to call a function on the server I get a connection error. 我可以加载wsdl,拉出函数和数据类型就可以了,但是当我尝试在服务器上调用函数时,出现连接错误。 When I look at the soap data passed in the $request it doesn't contain any of the security certificate and no errors are generated. 当我查看$ request中传递的soap数据时,它不包含任何安全证书,并且不会生成任何错误。

My code looks like this: 我的代码如下所示:

  // setup the transaction array
  $header = array('local_cert' => "certificate.pem",
                  'logonUser'  => "user_name",
                  'style'      => SOAP_DOCUMENT,
                  'use'        => SOAP_LITERAL,
                  'exceptions' => true,
                  'trace'      => true);                  

  // create the soap client, this will log us in
  $client = new SoapClient($wsdl, $header);

  try
  { 
    $response = $client->getMessage($parameters);
  }
  catch (Exception $e) 
  {
    dumpVars($client->__getLastRequest()); 
    echo 'Caught exception: ',  $e->getMessage(), "\n"; 
  }
?>

So my question is this, what do I have to do to get the security certificate to be passed? 所以我的问题是,我该怎么做才能使安全证书通过?

Thanks, 谢谢,

Pete 皮特

The purpose of local_cert in $header is not sending it in the SOAP call itself. $ header中local_cert的目的不是在SOAP调用本身中发送它。 It's only being used as an SSL client certificate. 它仅用作SSL客户端证书。 Also, according to this comment on php.net you need to read the file contents of the certificate in order to use it. 另外,根据php.net上的此注释,您需要阅读证书的文件内容才能使用它。

2 (small) things : 2(小)件东西:

  • 'logonUser' does not seem to be a valid option for the SoapClient constructor . 对于SoapClient构造函数, 'logonUser'似乎不是有效的选项。 If it is a required header for this service, consider using soapClient::setSoapHeaders . 如果它是此服务的必需标头,请考虑使用soapClient :: setSoapHeaders If it is a standard HTTP login param, use the 'login' key. 如果它是标准的HTTP登录参数,请使用“登录”键。

  • try to use the full path of the pem certificate, and make sure it is readable by php 尝试使用pem证书的完整路径,并确保php可读

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM