External Secure Web Service Access

Hi,
I am trying to use Centric software web service to get data into nav
web services are secured, user need to login first and should have the session to access various data
I am able to connect but I cannot read various data like customers etc.
Can you please help me, how can I keep connection active between multiple requests

This is on NAV 2009 classic

//THIS IS WORKING FINE
WebURL := 'https://myurl/session';
LoginDetails := //'{""username"": ""Administrator"",""password"": ""abcxyz123""}';
XMLHttp2.open('POST', WebURL, FALSE);
XMLHttp2.setRequestHeader('Content-type','application/json');
XMLHttp2.setRequestHeader('Accept','application/xml');
XMLHttp2.send(LoginDetails);


//NOT WORKING
CatUrl := 'https://myurl/customers';
XMLHttp2.open('GET', CatUrl, FALSE)
XMLHttp2.setRequestHeader('Content-type','application/xml');
XMLHttp2.setRequestHeader('Accept','application/xml');
XMLHttp2.send; //THIS IS GIVING ERROR FOR LOGIN/SESSION


Thanks
Ajay Jain
UK

Answers

  • ErictPErictP Member Posts: 164
  • ajayjainajayjain Member Posts: 119
    this does not work
    it returns the seesion id and token id after POS
    looks like I have to use this somehow in all my GET requests

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <session><session>centric://SESSION/7950ceb40aa47c946675d2df507a5</session>
    <token>centric://_CS_SecurityToken/7950ceb40aa47c9424532xxbe00265695</token></session>
    Ajay Jain
    UK
Sign In or Register to comment.