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();

        clientType = CLRInterop::getType("TCKimlik.Sorgula.KPSPublicSoapClient");
        cl = AifUtil::createServiceClient(clientType);
        s = cl.TCKimlikNoDogrula(11111111111,"METİN","EMRE",1999);
        ret = Ex.ToString();
        if (!strScan(ret,"Not a valid citizen ID",1,strLen(Ret)))
            erOccured = true;
    if (!erOccured)

11111111111 is citizen ID, name and surname after citizen ID and the last born year. If all these are correct, returns true else false.