I rewrite sample which I wrote for 2012. When I write the service I used Microsoft'un white page about consume web services in 2009. White page written for a web service which is not avaliable than but anyway worked.
First run AOT->References->Add service reference:
Write https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL to WSDL URL field.
I wrote TCSorgula to .NET code namespace field. I left reference name field with default written TCSorgula value.
After I wrote this method:
public server static boolean Sorgula(Int64 _TCID,str _name,str _surname, int _birthDate, boolean _interActive = false)
{
TCSorgula.KPSPublicSoapClient cl;
boolean ret;
System.Exception ex;
str st;
;
try
{
new InteropPermission(InteropKind::ClrInterop).assert();
cl = new TCSorgula.KPSPublicSoapClient("KPSPublicSoap");
ret = cl.TCKimlikNoDogrula(_TCID,_name,_surname,_dogumYili);
CodeAccessPermission::revertAssert();
}
catch(Exception::CLRError)
{
exceptionTextFallThrough();
}
if (_interActive)
{
if (ret)
info("TC ID verified!..");
else
warning("Failed TC ID verification!..");
}
return ret;
}
My job for run code:
static void TCKimlikTest(Args _args)
{
;
TCKimlik::Sorgula(11111111111,"METİN","EMRE",1911,true);
}
TC
ID verification service returns false when name or birthdate is wrong in case invalid ID strangely run exception. I was catching this case in AX 2012 with search "T.C.
Kimlik No alanına girdiğiniz değer geçerli bir T.C. Kimlik Numarası
değildir" value in return error string. Unfortunately I failed this with 2009. So I can just catch correct ID or invalid ID/failed service.
If VS doesn't installed you can install .NET framework SDK.
Id etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
Id etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
5 Ağustos 2015 Çarşamba
25 Aralık 2014 Perşembe
AX 2012 - Consume web service with sample turkish citizen ID check
I used a blog when developing this sample. You can download to ready use XPO from there .
1- Create a new Class Library type C# project at Visual Studio.
2- Press right click at project name, select Add service reference and write https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL to Address, write Sorgula to Namespace and press GO so service reference will be shown.
3- Add your project to AOT with Add to AOT .
4- Go to project properties and make
Debug Target = No
Deploy to Client = Yes
Deploy to EP = No
Deploy to Server = Yes
Deploy to SSRS = No
5. Deploy project and down all AX clients. If you don't down all clients at deploy, deploy will fail accoring to blog writer.
This is my sample job:
//Metin Emre, 2.10.2014
static void TCIDTest(Args _args)
{
CLRObject clientType;
TCKimlik.Sorgula.KPSPublicSoapClient cl;
System.Exception ex;
boolean s,erOccured;
System.Exception e;
str ret;
new InteropPermission(InteropKind::ClrInterop).assert();
try
{
clientType = CLRInterop::getType("TCKimlik.Sorgula.KPSPublicSoapClient");
cl = AifUtil::createServiceClient(clientType);
s = cl.TCKimlikNoDogrula(11111111111,"METİN","EMRE",1999);
}
catch(Exception::CLRError)
{
Ex=CLRInterop::getLastException();
ret = Ex.ToString();
if (!strScan(ret,"Not a valid citizen ID",1,strLen(Ret)))
{
info(Ex.ToString());
erOccured = true;
}
}
if (!erOccured)
info(strFmt("%1",s));
}
11111111111 is citizen ID, name and surname after citizen ID and the last born year. If all these are correct, returns true else false.
1- Create a new Class Library type C# project at Visual Studio.
2- Press right click at project name, select Add service reference and write https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL to Address, write Sorgula to Namespace and press GO so service reference will be shown.
3- Add your project to AOT with Add to AOT .
4- Go to project properties and make
Debug Target = No
Deploy to Client = Yes
Deploy to EP = No
Deploy to Server = Yes
Deploy to SSRS = No
5. Deploy project and down all AX clients. If you don't down all clients at deploy, deploy will fail accoring to blog writer.
This is my sample job:
//Metin Emre, 2.10.2014
static void TCIDTest(Args _args)
{
CLRObject clientType;
TCKimlik.Sorgula.KPSPublicSoapClient cl;
System.Exception ex;
boolean s,erOccured;
System.Exception e;
str ret;
new InteropPermission(InteropKind::ClrInterop).assert();
try
{
clientType = CLRInterop::getType("TCKimlik.Sorgula.KPSPublicSoapClient");
cl = AifUtil::createServiceClient(clientType);
s = cl.TCKimlikNoDogrula(11111111111,"METİN","EMRE",1999);
}
catch(Exception::CLRError)
{
Ex=CLRInterop::getLastException();
ret = Ex.ToString();
if (!strScan(ret,"Not a valid citizen ID",1,strLen(Ret)))
{
info(Ex.ToString());
erOccured = true;
}
}
if (!erOccured)
info(strFmt("%1",s));
}
11111111111 is citizen ID, name and surname after citizen ID and the last born year. If all these are correct, returns true else false.
1 Aralık 2011 Perşembe
AXAPTA TC Id field
This is just about turkish users:
There is an extended data type for TC id: IdentityNum_TR . But it's lenght incorrect (12). Should be 11.
There is an extended data type for TC id: IdentityNum_TR . But it's lenght incorrect (12). Should be 11.
Kaydol:
Kayıtlar (Atom)