Skip to main content

Session cookies

Számla Agent is optimized in a way that the caller side must take care of storing the session cookie and make sure that it is sent to Számla Agent during the call. One single user has to handle all Agent related actions in the webshop, so all the requests need to be handled by the same user.

Process details:

  1. First call towards Számla Agent, there is no session cookie stored for the webshop, and an XML file is sent to Számla Agent. Számla Agent perceives that there is no cookie yet so it generates a new session and a session cookie, reads the XML, etc.

  2. First answer: there is a single PDF file in the response body, and a few other information in the response header that contains the cookie as well as the JSESSIONID in the session cookie. The received pdf and session cookie must be saved for later use.

  3. Second call towards Számla Agent: send the XML as for the first call and include the session cookie in the request header as well.

  4. Second answer: there is one PDF in the response body, and the same session cookie in the header. No action needed in terms of the cookie. After that only the 3rd and 4th steps are repeated. In case there is no Számla Agent calls from a session cookie for 90 minutes, the Számlázz.hu system deletes this cookie. The next time there is a call towards Számla Agent, a new cookie will be generated. In light of these the following working mechanism is required in the calling of the code.

Számla Agent:

  1. To call Számla Agent, you need an XML file and a cookie file, if there is no cookie yet, call the Agent without it.

  2. When you receive the answer, you need to save the cookie file and the PDF invoice.

Important notice:

At the 3rd step, if no session cookie is sent back to the Számla Agent, it perceives that there is no cookie yet so it generates a new session. This could cause an event, where the new session and the generated pdf will be handled in different places, resulting a missing pdf error message.