2
多くの質問がこのように似ています。しかし、私は試したときに解決策を得ていませんでした。PHPソープフォルト:ホストに接続できません
ソープXML::の下に私のコードを探す
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pos="http://PostWebService.org/">
<soap:Header>
<pos:Authentication>
<!--Optional:-->
<pos:UserName>xxxxxxx</pos:UserName>
<!--Optional:-->
<pos:Password>yyyyyyyy</pos:Password>
</pos:Authentication>
</soap:Header>
<soap:Body>
.....
</soap:Body>
</soap:Envelope>
PHPコード:
$client = new SoapClient({soapurl},$params);
$auth = new stdClass();
$auth->UserName = 'xxxxxxx';
$auth->Password = 'yyyyyyyy';
$header = new SoapHeader('NAMESPACE','Authentication',$auth,false);
$client->__setSoapHeaders($header);
$result = $client->__soapCall('{soap function}',array()); // when this line executes it throws me the error "Could not connect to the host"
は注意してください、私のソープURLがhttpsです。私はスタックオーバーフローから他の多くのソリューションを試しましたが、どれもうまくいきません。私は誰もがなぜ私はそのエラーを取得していると私は要求で間違っていたことを教えてください。
別のコードを試みたが、まだ同じ:
$opts = array(
'ssl' => array('ciphers'=>'RC4-SHA', 'verify_peer'=>false, 'verify_peer_name'=>false)
);
// SOAP 1.2 client
$params = array ('encoding' => 'UTF-8', 'verifypeer' => false, 'verifyhost' => false, 'soap_version' => SOAP_1_2, 'keep_alive' => false,'trace' => 1, 'exceptions' => 1, "connection_timeout" => 180, 'stream_context' => stream_context_create($opts));
$client = new SoapClient({soapurl},$params);
//Remaining as the same above
私はSOAPUIと試みたとき、それは私に応答を与えます。