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.AuthenticationException(E02250): Not logged in - could not resolve authenticationContext

0

HI Expert,

We have a problem while connecting our system(Salesforce) to E-conomic.

We got all the access id and now I am trying to connect to E-conomic system from SOAP UI. Result of connecting is giving some       id(<ConnectResult>nqu02eijhberkme5clbqqeqo</ConnectResult>). After this function I tried to create an Account from Soap UI which is Account_Create, But it says (<faultstring>Economic.Api.Exceptions.AuthenticationException(E02250): Not logged in - could not resolve authenticationContext (id=a4f443a7-458c-4938-a9f1-a90ffdf67caa)</faultstring>).

Please see my screen shot where I got this error.

My doubt is how to get authenticate while creating an Account in E-Conomic system through API?

Could you please help us in order to overcome this issue.

Thank you very much in advance and I appreciate for your response.

 

image

 

Warm Regards,

Ravi Teja.

created Jun 11, 2014 by raviteja
100% Accept Rate
Q 4 A 3 C 1

1 Answer

0
 
Best answer

Id generated from Connect_Element method should be stored in a cookie and put it in a output headers.

Code is here:

eConomicComConnect.EconomicWebServiceSoap es = new eConomicComConnect.EconomicWebServiceSoap();
        es.inputHttpHeaders_x = new Map<String, String>();
        es.inputHttpHeaders_x.put('Authorization', 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==');
        
        //Setting a cookie header
        es.inputHttpHeaders_x.put('Cookie', 'name=value');
        
        //Setting a custom HTTP header
        es.inputHttpHeaders_x.put('myHeader', 'myValue');
        es.outputHttpHeaders_x = new Map<String, String>();
       
        es.connectToEconomic();  // Method to connect_element. shown below
        System.debug('THE COOKIE VALUE IS ' + es.outputHttpHeaders_x.get('Set-Cookie'));
        String econCookie = es.outputHttpHeaders_x.get('Set-Cookie');
 
 
 
class to Connect_Element
public class eConomicComConnect {
    
    public class Connect_element {
        public Integer agreementNumber;
        public String userName;
        public String password;
        private String[] agreementNumber_type_info = new String[]{'agreementNumber','http://e-conomic.com',null,'1','1','false'};
        private String[] userName_type_info = new String[]{'userName','http://e-conomic.com',null,'0','1','false'};
        private String[] password_type_info = new String[]{'password','http://e-conomic.com',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://e-conomic.com','true','false'};
        private String[] field_order_type_info = new String[]{'agreementNumber','userName','password'};
        
    }
    public class ConnectResponse_element {
        public String ConnectResult;
        private String[] ConnectResult_type_info = new String[]{'ConnectResult','http://e-conomic.com',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://e-conomic.com','true','false'};
        private String[] field_order_type_info = new String[]{'ConnectResult'};
    }
    public class EconomicWebServiceSoap {
        public String endpoint_x = 'https://api.e-conomic.com/secure/api1/EconomicWebService.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://e-conomic.com', 'eConomicComConnect'};
        
        
        
        public void connectToEconomic(){
            eConomicComConnect.Connect_element  request_x = new eConomicComConnect.Connect_element();
            request_x.agreementNumber = integer.valueof(System.Label.EconomicAggrementNumber);
            
            request_x.userName = System.Label.EconomicUserName;
            request_x.password = System.Label.EconomicPassWord;
            eConomicComConnect.ConnectResponse_element  response_x;
            Map<String,eConomicComConnect.ConnectResponse_element> response_map_x = new Map<String,eConomicComConnect.ConnectResponse_element>();
                        response_map_x.put('response_x', response_x);
            if(!Test.IsRunningTest()){
            WebServiceCallout.invoke( this,
                          request_x,
                          response_map_x,
                          new String[]{endpoint_x,
                               'http://e-conomic.com/Connect',
                               'http://e-conomic.com',
                               'Connect',
                               'http://e-conomic.com',
                               'ConnectResponse',
                               'eConomicComConnect.ConnectResponse_element'
                               });
                        response_x = response_map_x.get('response_x');
                        System.debug('THE RESPONSE IS' + response_x.ConnectResult);
                }                          
            }
 
        
        
        
    }
}

 

answered Jun 18, 2014 by raviteja
Visma e-conomic A/S
...