I have some working PHP example (see below) for accessing a secure webservice. I am trying to access the webservice with Savon. First, I tried:
>> 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:>>>
First problem, SOAP actions seem to be empty:
>> client.wsdl.soap_actions
warning: peer certificate won't be verified in this SSL session
=> []
And trying to access the webservice with wsse credentials like this:
>> client = Savon::Client.new do |wsdl, http|
?> wsdl.document = "https://secure.service.com/soa/soap/?WSDL"
>> wsdl.wsse.credentials "user", "encrypted-md5-string"
>> end
results in:
ArgumentError: wrong number of arguments (0 for 1)
What could be taken from this working PHP example below in Ruby, to set some basic requests to the webservice?
PHP example:
$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);