KiCompany en

From services.krediidiinfo.ee
Revision as of 14:05, 6 June 2012 by Kart (talk | contribs)
Jump to navigation Jump to search
Flag of Estonia.svg eesti keeles

Introduction

KiCompany is the name of a Web Service based on SOAP protocol for requesting basic data about companies, non-profit organizations and state agencies. The interface is designed clients who want to integrate the functionality of company request into their own system.

WSDL

KiCompany WDSL is located at http://services.krediidiinfo.ee/KiCompany.wsdl.

WSDL for users of Microsoft Development Tools is located at: http://services.krediidiinfo.ee/KiCompanyLit.wsdl. It differs from the previous WSDL in that RPC/litteral is used instead of RPC/encode.

Methods

getName

Requesting company’s name.

Name Type Description
Input parameter: regCode xs:string Company’s registry code.
Output parameter: name xs:string Company’s name. Output value is an empty string if the name is not found (compnay does not exist, error in the registry code etc).


findCompanies

Searching companies by name. The result is an array, which includes companies’ names and registry codes according to the search string.

Name Type Description
Input parameter: regCode xs:string Company’s registry code
count xs:int Maximum number of companies found in the result of the method (The method does not return at once more than 100 companies)
Output parameter: companies ResultCompanyIDDataArray Indexed array which elements are ResultCompanyIDData array elements.


ResultCompanyIDData is a record with the following structure:

Name Type Description
regCode xs:string Company’s registry code
name xs:string Company’s name.


getBasicData

Requesting company’s basic data.

Name Type Description
Input parameter: regCode xs:string Company’s registry code.
Output parameter: data CompanyBasicDataType A record with company’s data.


If the company according regCode is not found, the SOAP error message code -10231 will be returned.

CompanyBasicDataType record with the following structure:

Name Type Description
regCode xs:string Company’s registry code
name xs:string Company’s name.
street xs:string Street name in postal address (for marketing activities)
postCode xs:string Postcode in postal address (for marketing activities)
city xs:string Name of the city in postal address (for marketing activities)
legalStreet xs:string Street name in legal address
legalPostCode xs:string Postcode in legal address
legalCity xs:string Name of city in legal address
phones xs:string Phone numbers
faxes xs:string Fax numbers
web xs:string Website URL
emails xs:string E-post addresses
legalForm xs:string Legal form
shareCapital xs:int Amount of share capital
shareCapitalCur xs:string Currency of share capital
regTime xs:string Company’s registration time in Commercial Register. Format: yyyy-mm-dd
regPlace xs:string Name of registration department where company was registered
activities xs:string The list of company’s activities. Before every activity there is a string '* ' (asterisk and space). From 7/29/2011 the activity information is available only by special agreement. If there is no agreement, an empty string will be given as a result.
status xs:string Status in Commercial Register


getContactData

Requesting company’s contact data.

Name Type Description
Input parameter: regCode xs:string company’s registry code.
Output parameter: data CompanyContactDataType A record with contact data

If the company according regCode is not found, the SOAP error message code -10231 will be returned.

CompanyContactDataType record is with the following structure:

Name Type Description
street xs:string Street name in postal address (for marketing activities)
postCode xs:string Postcode in postal address (for marketing activities)
city xs:string Name of the city in postal address (for marketing activities)
phones xs:string Phone numbers
faxes xs:string Fax numbers
web xs:string Website URL
emails xs:string E-post addresses


getLegalPostAddress

Ettevõtte juriidilise aadressi pärimine.

Nimi Tüüp Kirjeldus
Sisendparameetrid: regCode xs:string ettevõtte äriregistri kood.
Väljundparameeter: data CompanyPostAddressType kirje juriidilise aadressi andmetega

Kui regCode-ile vastavat ettevõtet ei leita, siis tagastatakse SOAP veateade koodiga -10231.

CompanyPostAddressType tüüpi kirje on järgmise struktuuriga:

Nimi Tüüp Kirjeldus
street xs:string tänava nimi
postCode xs:string indeks
city xs:string linn


isRegCodeValid

Ettevõtte äriregistri korrektsuse kontrollimine.

Nimi Tüüp Kirjeldus
Sisendparameetrid: regCode xs:string Ettevõtte äriregistri kood
Väljundparameeter: isValid xs:boolean Tõene, kui parameetriga ette antud äriregistri kood on kaheksakohaline arv ja viimane kontrollnumber on õige.


getVATNo

Ettevõtte käibemaksukohustuslase numbri pärimine.

Nimi Tüüp Kirjeldus
Sisendparameetrid: regCode xs:string Ettevõtte äriregistri kood.
Väljundparameeter: vatNo xs:string KMK number. Kui KMK number ei kehti või ettevõte ei ole käibemaksukohuslane, siis tagastatakse tühistring


Veakoodid

-10231 No company found!

Krediidiinfo andmebaasist ei leitud parameetriga ette antud registrikoodile vastavat ettevõtet. Kontrollida registrikoodi.

(vt lisaks üldiseid veakoode)

Programmi näidis PHP-s

Järgnevalt on toodud PHP-s kirjutatud KiCompany veebiteenuse kasutamise näide.

<?php
/**
 * Example of using KiCompany web service of Krediidiinfo AS
 * 
 * @author Rait Kapp <rait@krediidiinfo.ee>
 * @created 15.02.2011
 */
$wsdl_url = 'http://services.krediidiinfo.ee/KiCompany.wsdl';
$server_url = 'https://services.krediidiinfo.ee/soap.php?name=KiCompany'; 


$params = array('location' => $server_url
              , 'login'         => 'online_code' // Online Code issued by Krediidiinfo client management. Make sure that login value is string type (PHP bug?).
              , 'password'      => 'passwd'
//              , 'proxy_host'    => 'cache.neti.ee'   // If necessary use proxy and proxy port.
//              , 'proxy_port'    => 8080
              , 'encoding' => 'ISO-8859-13'
               );


$client = new SoapClient($wsdl_url, $params);


$name = 'KREDIIDI';
$companies = $client->findCompanies($name, 3);
print_r($companies);

$regCode = '10256137';
$name = $client->getName($regCode);
echo "Äriregistri kood {$regCode} kuulub ettevõttele {$name}\n";

$data = $client->getBasicData($regCode);
echo "Aadress: {$data->street} {$data->postCode} {$data->city}\n";

$regCode = '10256136'; // kontrollnumber on vale!
if (!$client->isRegCodeValid($regCode)) {
    echo "Äriregistri kood {$regCode} on vigane.\n";
} else {
    echo "Äriregistri kood {$regCode} on korrektne\n";
}

?>

Programmi väljund:

Array
(
    [0] => stdClass Object
        (
            [regCode] => 90006012
            [name] => KREDIIDI JA EKSPORDI GARANTEERIMISE SIHTASUTUS KREDEX
        )

    [1] => stdClass Object
        (
            [regCode] => 10704587
            [name] => KREDIIDI JÄRELVALVE OÜ
        )

    [2] => stdClass Object
        (
            [regCode] => 11626688
            [name] => KREDIIDIBÜROO OÜ
        )

)
Äriregistri kood 10256137 kuulub ettevõttele KREDIIDIINFO AS
Aadress: Narva mnt 5 10117 Tallinn
Äriregistri kood 10256136 on vigane.


HTTP päringute näidised

Failis kiCompany_request_examples.zip on KiCompany HTTP päringute ja päringu vastuste näidised. Kui KiCompany integreeritakse süsteemi saates otse HTTP päringuid, siis HTTP vastuse parsimisel kasutada XML vahendeid. Mitte käsitleda HTTP vastuseid kui stringe ja parsida neid nö käsitsi. Kui Krediidiinfo uuendab SOAP serveri tarkvara, siis võib vastuse sõnumi kuju muutuda.