KiCompany en: Difference between revisions

From services.krediidiinfo.ee
Jump to navigation Jump to search
No edit summary
No edit summary
Line 59: Line 59:
| Maximum number of companies found in the result of the method (The method does not return at once more than 100 companies)  
| Maximum number of companies found in the result of the method (The method does not return at once more than 100 companies)  
|-
|-
| <b>Väljundparameeter:</b>
| <b>Output parameter:</b>
| companies
| companies
| ResultCompanyIDDataArray
| ResultCompanyIDDataArray
| Indekseeritud massiiv, mille elementideks on ResultCompanyIDData tüüpi elemendid.
| Indexed array which elements are ResultCompanyIDData array elements.
|}
|}


ResultCompanyIDData on kirje järgmise struktuuriga:
 
ResultCompanyIDData is a record with the following structure:


{| style="border-style: solid; border-width: 1px;"
{| style="border-style: solid; border-width: 1px;"
! Nimi
! Name
! Tüüp
! Type
! Kirjeldus
! Description
|-
|-
| regCode
| regCode
| xs:string
| xs:string
| Ettevõtte äriregistri kood
| Company’s registry code
|-
|-
| name
| name
| xs:string
| xs:string
| Ettevõtte nimi.
| Company’s name.
|}
|}


== getBasicData ==
== getBasicData ==


Ettevõtte põhiandmete pärimine.  
Requesting company’s basic data.  


{| style="border-style: solid; border-width: 1px;"
{| style="border-style: solid; border-width: 1px;"
!  
!  
! Nimi
! Name
! Tüüp
! Type
! Kirjeldus
! Description
|-
|-
| <b>Sisendparameetrid:</b>  
| <b>Input parameter:</b>  
| regCode
| regCode
| xs:string
| xs:string
| Ettevõtte äriregistri kood.
| Company’s registry code.
|-
|-
| <b>Väljundparameeter:</b>
| <b>Output parameter:</b>
| data
| data
| CompanyBasicDataType
| CompanyBasicDataType
| Kirje ettevõtte andmetega.
| A record with company’s data.  
|}
|}


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


CompanyBasicDataType tüüpi kirje järgmise struktuuriga:
If the company according '''regCode''' is not found, the SOAP error message code -10231 will be returned.
 
CompanyBasicDataType record with the following structure:


{| style="border-style: solid; border-width: 1px;"
{| style="border-style: solid; border-width: 1px;"
! Nimi
! Name
! Tüüp
! Type
! Kirjeldus
! Description
|-
|-
| regCode
| regCode
| xs:string
| xs:string
| ettevõtte äriregistri kood
| Company’s registry code
|-
|-
| name
| name
| xs:string
| xs:string
| ettevõtte nimi.
| Company’s name.
|-
|-
| street
| street
| xs:string
| xs:string
| tänava nimi turunduseks kasutatavas postiaadressis
| Street name in postal address (for marketing activities)
|-
|-
| postCode
| postCode
| xs:string
| xs:string
| posti indeksi number turunduseks kasutatavas postiaadressis
| Postcode in postal address (for marketing activities)
|-
|-
| city
| city
| xs:string
| xs:string
| linna nimi turunduseks kasutatavas postiaadressis
| Name of the city in postal address (for marketing activities)
|-
|-
| legalStreet
| legalStreet
| xs:string
| xs:string
| tänava nimi juriidilises aadressis
| Street name in legal address
|-
|-
| legalPostCode
| legalPostCode
| xs:string
| xs:string
| posti indeksi number juriidilises aadressis
| Postcode in legal address
|-
|-
| legalCity
| legalCity
| xs:string
| xs:string
| linnanimi juriidilises aadressis
| Name of city in legal address
|-
|-
| phones
| phones
| xs:string
| xs:string
| telefonide numbrid
| Phone numbers
|-
|-
| faxes
| faxes
| xs:string
| xs:string
| fakside numbrid
| Fax numbers
|-
|-
| web
| web
| xs:string
| xs:string
| interneti kodulehekülje URL
| Website URL  
|-
|-
| emails
| emails
| xs:string
| xs:string
| e-posti aadressid
| E-post addresses
|-
|-
| legalForm
| legalForm
| xs:string
| xs:string
| juriidiline vorm
| Legal form
|-
|-
| shareCapital  
| shareCapital  
| xs:int
| xs:int
| osakapitali suurus
| Amount of share capital
|-
|-
| shareCapitalCur
| shareCapitalCur
| xs:string
| xs:string
| valuuta tähis, milles on osakapitali suurus antud
| Currency of share capital
|-
|-
| regTime
| regTime
| xs:string
| xs:string
| ettevõtte registreerimise aeg Äriregistris. Formaat: yyyy-mm-dd
| Company’s registration time in Commercial Register. Format: yyyy-mm-dd  
|-
|-
| regPlace
| regPlace
| xs:string
| xs:string
| registriosakonna nimetus kus ettevõte registreeriti
| Name of registration department where company was registered
|-
|-
| activities  
| activities  
| xs:string
| xs:string
| ettevõtte tegevusalade loetelu. Iga tegevusala ees on string '* ' (tärn ja tühik). Alates 29.07.2011 saab tegevusalade infot vaid erikokkuleppel. Kui kokkulepet pole, siis on  väärtuseks tühistring.  
| 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
| status
| xs:string
| xs:string
| äriregistri staatuse nimetus
| Status in Commercial Register
|-
|-
|}
|}


== getContactData ==
== getContactData ==


Ettevõtte kontaktandmete pärimine.
Requesting company’s contact data.


{| style="border-style: solid; border-width: 1px;"
{| style="border-style: solid; border-width: 1px;"
!  
!  
! Nimi
! Name
! Tüüp
! Type
! Kirjeldus
! Description
|-
|-
| <b>Sisendparameetrid:</b>  
| <b>Input parameter:</b>  
| regCode
| regCode
| xs:string
| xs:string
| ettevõtte äriregistri kood.
| company’s registry code.
|-
|-
| <b>Väljundparameeter:</b>
| <b>Output parameter:</b>
| data
| data
| CompanyContactDataType
| CompanyContactDataType
| kirje kontaktandmetega
| A record with contact data
|}
|}


Kui ''regCode''-ile vastavat ettevõtet ei leita, siis tagastatakse SOAP veateade koodiga -10231.
If the company according '''regCode''' is not found, the SOAP error message code -10231 will be returned.


CompanyContactDataType tüüpi kirje on järgmise struktuuriga:
CompanyContactDataType record is with the following structure:


{| style="border-style: solid; border-width: 1px;"
{| style="border-style: solid; border-width: 1px;"
! Nimi
! Name
! Tüüp
! Type
! Kirjeldus
! Description
|-
|-
| street
| street
| xs:string
| xs:string
| tänava nimi turunduseks kasutatavas postiaadressis
| Street name in postal address (for marketing activities)
|-
|-
| postCode
| postCode
| xs:string
| xs:string
| posti indeksi number turunduseks kasutatavas postiaadressis
| Postcode in postal address (for marketing activities)
|-
|-
| city
| city
| xs:string
| xs:string
| linna nimi turunduseks kasutatavas postiaadressis
| Name of the city in postal address (for marketing activities)
|-
|-
| phones
| phones
| xs:string
| xs:string
| telefonide numbrid
| Phone numbers
|-
|-
| faxes
| faxes
| xs:string
| xs:string
| fakside numbrid
| Fax numbers
|-
|-
| web
| web
| xs:string
| xs:string
| interneti kodulehekülje URL
| Website URL  
|-
|-
| emails
| emails
| xs:string
| xs:string
| e-posti aadressid
| E-post addresses
|}
|}



Revision as of 13:05, 6 June 2012

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.