更新时间:2023-02-21 21:19:05
我在soap调用中使用SSL证书.
I'm using SSL certificate in my soap call.
就我而言,我在服务器上为 wsdl
和 local_cert
提供绝对路径我已经在我的班级中定义了这些.请注意,我使用的是 .pem
格式的证书.
In My case I'm giving absolute path on my server for wsdl
and for local_cert
I've already defined those in my class. Please note that I'm using my certificate in .pem
format.
public $local_cert = "/var/www/.../webroot/cert.pem";
public $wsdl = "/var/www/.../webroot/my_wsdl.wsdl";
$this->client = new SoapClient($this->wsdl, array(
"trace" => 1,
"exceptions" => true,
"local_cert" => $this->local_cert,
"uri" => "urn:xmethods-delayed-quotes",
"style" => SOAP_RPC,
"use" => SOAP_ENCODED,
"soap_version" => SOAP_1_2 ,
"location" => $this->location
)
);
在我的证书中有两部分.证书和 RSA 私钥.
In my certificate there are 2 parts. Certificate and RSA Private Key.
(1)-----BEGIN CERTIFICATE-----
MIIFjzCC....
....
-----END CERTIFICATE-----
(2)-----BEGIN RSA PRIVATE KEY-----
MIIEpAI....
....
ww==
-----END RSA PRIVATE KEY----
最重要的是,您应该使用 https
链接进行肥皂调用.这对我来说很好用.
And most important you should use https
link for making a soap call. This is working fine for me.
希望对你有帮助.