1

安全な Web サービスにアクセスするための実際の PHP の例 (以下を参照) があります。Savon で Web サービスにアクセスしようとしています。まず、私は試しました:

>> client = Savon::Client.new("https://secure.service.com/soa/soap/?WSDL")
=> #<Savon::Client:0x114053358 @wsdl=#<Savon::WSDL:0x1140532b8 @request=#<Savon::Request:0x1140532e0 @endpoint=#<URI::HTTPS:0x114053038 URL:https://secure.service.com/soa/soap/?WSDL>, @proxy=#<URI::Generic:0x114052fc0 URL:>>>, @request=#<Savon::Request:0x1140532e0 @endpoint=#<URI::HTTPS:0x114053038 URL:https://secure.service.com/soa/soap/?WSDL>, @proxy=#<URI::Generic:0x114052fc0 URL:>>>

最初の問題、SOAP アクションが空に見える:

>> client.wsdl.soap_actions
warning: peer certificate won't be verified in this SSL session
=> []

そして、次のように wsse 資格情報を使用して Web サービスにアクセスしようとしています。

>> client = Savon::Client.new do |wsdl, http|
?>   wsdl.document = "https://secure.service.com/soa/soap/?WSDL"
>>   wsdl.wsse.credentials "user", "encrypted-md5-string"
>> end

結果:

ArgumentError: wrong number of arguments (0 for 1)

以下のRubyで動作するPHPの例から、いくつかの基本的なリクエストをWebサービスに設定するために何が得られるでしょうか?

PHP の例:

$foo = "+++hashkey+++";

$authUser = "user";
$authPass = "password";

$passphrase = md5($foo.$authPass.".wsdl");

echo "User: ".$authUser."<br>";
echo "Passphrase: ".$foo.$authPass.".wsdl<br>";
echo "Digest Passphrase: ".$passphrase."<br>";

$soapClient = new SoapClient( "https://secure.service.com/soa/soap/?WSDL", 
     array( "exceptions"  => true,
            "cache_wsdl" => WSDL_CACHE_NONE,
            "login" => $authUser,
            "password" => $passphrase));

$param = new stdClass();

$param->bankaccount = "1111111";
$param->bankcountry = "US";

$soaMethod = "SoaBank.getBank"; 
$soaParams = array($param);
$result = $soapClient->__soapCall($soaMethod, $soaParams);

print "<h1>Result</h1>";
print_r($result);
4

2 に答える 2

2

Savon 2の場合、使用できます:ssl_verify_mode => :none

Savon.client(:wsdl => 'https://blahService?wsdl', :ssl_verify_mode => :none)
于 2014-02-28T16:29:35.883 に答える
1

SSL 検証をオフにしてみてください。

    client = Savon::Client.new("http://wsdl") do
      http.auth.ssl.verify_mode = :none          
    end
于 2012-02-01T19:32:06.980 に答える