API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Economic.Api.Exceptions.AuthorizationException

0
Hi,

i have a problem with connecting to the webservice of economic. although the login data (agreement, userid, password) is correct (can login on the website) and the api is activated/registered in the settings menu, i still can not access the soap client functions.



i always get the following error:

Soap fault soap:Sender - Economic.Api.Exceptions.AuthorizationException(E02000): Access denied. {id=356554426}.

this is the way, my soap client is connecting:


function get_soap_connection() {
    static $client;

    if (!isset($client)) {
        $settings = parse_ini_file(realpath(dirname(__FILE__)  '/economicsini'));
        $options = array(
            'soap_version' = SOAP_1_2,
            'exceptions' = 1,
            'trace' = 1,
            'cache_wsdl' = 0
        );
        try {
            $client = new SoapClient($settings'wsdl_endpoint', $options);

            $client-Connect(array(
                'agreementNumber' = $settings'agreement_number',
                'userName' = $settings'user_name',
                'password' = $settings'password'
            ));
        } catch (SoapFault $fault) {
            trigger_error(sprintf(Soap fault %s - %s, $fault-faultcode, $fault-faultstring), E_USER_ERROR);
        }
    }

    return $client;
}


thanks for any suggestions in advance.
created May 8, 2012 by sentinel777
0% Accept Rate
Q 7 A 4 C 0

4 Answers

0
Hi,

The agreement number you're connecting with is an administrator agreement number.

You must either log in using a company agreement number, or use the alternative ConnectAsAdministrator() method (supplying the administrator agreement number, user ID, password, and company agreement number whose data you wish to access):

http//wwwe-conomiccom/apidocs/Documentation/M_Economic_Api_ISession_ConnectAsAdministratorhtml


Best regards,
answered May 8, 2012 by Christian Estrup
0
thanks for the reply.

i have tried some different agreement numbers of the companies which are set up in the settings menu, but none of them worked.

then i used the ConnectAsAdministrator method, but got an other error:

Access not granted SOAP-ERROR Encoding object has no 'adminAgreementNo' property

did i miss something?


i have solved this, just take a look at the parameter names of the function definition in the xml.
answered May 10, 2012 by sentinel777
0
Hi,

Do I understand you correctly that you DID end up getting everything working?


Best regards,
answered May 10, 2012 by Christian Estrup
0
yes, i can successfully connect to the e-conomic webservice. thanks.
answered May 11, 2012 by sentinel777
Visma e-conomic A/S
...