Skip to content

Instantly share code, notes, and snippets.

@msdundar msdundar/kps.rb
Created Jan 24, 2014

Embed
What would you like to do?
KPS SOAP Client
# coding: utf-8
require 'savon'
require 'awesome_print'
class KPSSorgu
# T.C. Kimlik ile Kişi Sorgulama - Konfigürasyon
@@tc_bilgi_client = Savon.client(
wsdl: "http://192.168.33.25/KPSService/servicetckimliksorgula.asmx?WSDL",
namespace: "http://tempuriTCKimlik.org/",
soap_version: 2,
soap_header: {
"KPSUserInfo" =>
{
"UserName" => "*****",
"Password" => "*****"
},
:attributes! => {
"KPSUserInfo" =>
{
:xmlns => 'http://tempuriTCKimlik.org/'
}
}
}
)
# T.C. Kimlik ile Adres Sorgulama - Konfigürasyon
@@tc_adres_client = Savon.client(
wsdl: "http://192.168.33.25/KPSService/serviceadressorgula.asmx?WSDL",
namespace: "http://tempuriAdres.org/",
soap_version: 2,
soap_header: {
"KPSUserInfo" =>
{
"UserName" => "*****",
"Password" => "*****"
},
:attributes! => {
"KPSUserInfo" =>
{
:xmlns => 'http://tempuriAdres.org/'
}
}
}
)
# T.C. Kimlik Sorgula
def tc_bilgi_sorgula
message = {
"TCKimlikNo" => "*****"
}
response = @@tc_bilgi_client.call(:tc_kimlik_no_sorgu, message: message)
ap response.body
end
def tc_adres_sorgula
message = {
"TCKimlikNo" => "*****"
}
response = @@tc_adres_client.call(:kisi_adres_bilgisi_sorgu, message: message)
ap response.body
end
# WSDL üzerindeki servisleri liste
puts "Olası Operasyonlar: \n"
@@tc_bilgi_client.operations.each {|operation| p operation }
# Operasyonu Uygula
send = KPSSorgu.new
send.tc_bilgi_sorgula
send.tc_adres_sorgula
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.