Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i import a https webservice (wcf) with Delphi 2010?

I have a problem so i wanna help from you. There is a webservice and it's url : https://kps.saglik.gov.tr/Services/KPSTestServices.svc

We can import this url on visual studio c# easily, but we couldn't import it on delphi 2010.

Also we have a user id and password from saglik.gov.tr, but the result is same : can't import this service. What can we do now ?

Thanks for any idea from at the moment.

Visual Studio Sample : https://kps.saglik.gov.tr/kps_ornek1.zip


I was able to import files to your local hard disk recording.

  • https://kps.saglik.gov.tr/Services/KPSTestServices.svc?wsdl = services.wsdl
  • https://kps.saglik.gov.tr/Services/KPSTestServices.svc?wsdl=wsdl0 = secondry.wsdl
  • https://kps.saglik.gov.tr/Services/KPSTestServices.svc?xsd=xsd0 = xsd0.xsd
  • https://kps.saglik.gov.tr/Services/KPSTestServices.svc?xsd=xsd1 = xsd1.xsd
  • https://kps.saglik.gov.tr/Services/KPSTestServices.svc?xsd=xsd2 = xsd2.xsd

When I call service , Now I get the https connection failed error.

Xml created by the WCFStorm (http://www.wcfstorm.com/wcf/home.aspx)

Header 

POST https://kps.saglik.gov.tr/Services/KPSTestServices.svc HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Host: kps.saglik.gov.tr
Content-Length: 1256
Expect: 100-continue
Connection: Keep-Alive


<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><s:Header><a:Action s:mustUnderstand="1">http://www.saglik.gov.tr/KPS/2011/KPSServices/TcKimlikNoIleKisiSorgula</a:Action><a:MessageID>urn:uuid:b99c1ef4-9e44-42b9-ae1f-9844bfc0f997</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">https://kps.saglik.gov.tr/Services/KPSTestServices.svc</a:To><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><u:Timestamp u:Id="_0"><u:Created>2011-09-13T11:17:27.234Z</u:Created><u:Expires>2011-09-13T11:22:27.234Z</u:Expires></u:Timestamp><o:UsernameToken u:Id="uuid-d7a725d3-aa3c-4336-8651-304ecdb8d5e0-4"><o:Username>myUserName</o:Username><o:Password o:Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">myPassword</o:Password></o:UsernameToken></o:Security></s:Header><s:Body><TcKimlikNoIleKisiSorgula xmlns="http://www.saglik.gov.tr/KPS/2011"><tcNo>1842715****</tcNo></TcKimlikNoIleKisiSorgula></s:Body></s:Envelope>

Response XML

Header
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 1519
Content-Type: application/soap+xml; charset=utf-8
Server: Microsoft-IIS/7.5
Set-Cookie: ASP.NET_SessionId=0vdbbkozgztz4falycku4gr0; path=/; HttpOnly
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 13 Sep 2011 11:19:40 GMT

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><s:Header><a:Action s:mustUnderstand="1">http://www.saglik.gov.tr/KPS/2011/KPSServices/TcKimlikNoIleKisiSorgulaResponse</a:Action><a:RelatesTo>urn:uuid:b99c1ef4-9e44-42b9-ae1f-9844bfc0f997</a:RelatesTo><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><u:Timestamp u:Id="_0"><u:Created>2011-09-13T11:19:41.255Z</u:Created><u:Expires>2011-09-13T11:24:41.255Z</u:Expires></u:Timestamp></o:Security></s:Header><s:Body><TcKimlikNoIleKisiSorgulaResponse xmlns="http://www.saglik.gov.tr/KPS/2011"><TcKimlikNoIleKisiSorgulaResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Hata i:nil="true"/><Sonuc><Ad>MUSTAFA</Ad><AileSiraNo>12</AileSiraNo><AnaAd>LEYLA</AnaAd><BabaAd>OSMAN</BabaAd><BireySiraNo>*</BireySiraNo><CiltAd>-</CiltAd><CiltKod>-</CiltKod><Cinsiyet>Erkek</Cinsiyet><Din i:nil="true"/><DogumTarihi>21.9.0000</DogumTarihi><DogumYer>*</DogumYer><Durum>Açık</Durum><Hata i:nil="true"/><IlAd>*</IlAd><IlKod>*</IlKod><IlceAd>Abana</IlceAd><IlceKod>*</IlceKod><MedeniHal>Bekar</MedeniHal><OlumTarih>0.0.0</OlumTarih><Soyad>*</Soyad><TCKimlikNo>18427***</TCKimlikNo><Yakinlik>Kendisi</Yakinlik></Sonuc></TcKimlikNoIleKisiSorgulaResult></TcKimlikNoIleKisiSorgulaResponse></s:Body></s:Envelope>

Delphi 2010

My Request

CONNECT kps.saglik.gov.tr:443 HTTP/1.0
User-Agent: Borland SOAP 1.2
Host: kps.saglik.gov.tr:443
Content-Length: 0
Proxy-Connection: Keep-Alive
Pragma: no-cache

No XML

My Response

Header 
HTTP/1.1 502 Unable to Secure Connection
Via: 1.1 SYSTMG07
Connection: Keep-Alive
Proxy-Connection: Keep-Alive

No XML

like image 696
Delphi2010 Avatar asked Feb 22 '26 00:02

Delphi2010


1 Answers

You need to point delphi towards the WSDL of the service. just append ?wsdl to the end of the first URL you gave: https://kps.saglik.gov.tr/Services/KPSTestServices.svc?wsdl and open this URL.

Save the file as a wsdl file and import it using: File -> New -> Other -> Delphi Projects -> Webservices -> WSDL Importer.

Please note: when the webservice changes you need to reimport. Also, using the webservice this way, you might need to deploy the wsdl with your application, depending on wether or not you are using the wsdl when consuming the webservice.

like image 179
R-D Avatar answered Feb 24 '26 14:02

R-D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!