Response
The received response depends on the value of the valaszVerzio
variable sent in the request.
-
in case it is 1 or not provided, the response might be:
-
text – if
<valaszVerzio>1</valaszVerzio>
-
PDF file – if
<valaszVerzio>2</valaszVerzio>
-
-
in case it is 2 the answer will be XML in all cases.
Text response
[ERR] Számla mentés sikertelen. Már létező rendelésszám: XX. ---------- t.getMessage(): Már létező rendelésszám: XX. ---------- [CEG:978]
[MODUL:SZAMLAZZGUI] [INSTANCE:hu.kboss.szamlazz.gui.action.AcXmlSzamla] Már létező rendelésszám: XX.
[LOCATION:hu.kboss.szamlazz.api.bean.SzFej.insert (SzFej.java) #1700]
hu.kboss.szamlazz.api.bean.SzFej.insert(SzFej.java:1700)
hu.kboss.szamlazz.gui.action.AcXmlSzamla.performAction(AcXmlSzamla.java:242)
hu.kboss.szamlazz.controller.Controller.executeAction(Controller.java:715)
hu.kboss.szamlazz.controller.Controller.doGet(Controller.java:468)
hu.kboss.szamlazz.controller.Controller.doPost(Controller.java:639)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:662)
There may be three different kinds of answers. In the XML you can choose to receive the invoice in PDF format <szamlaLetoltes>true/false</szamlaLetoltes>
:
-
if it is
TRUE
(you need the option to download the PDF invoice) and everything went well, the response will be the PDF that is the invoice itself -
if it is
FALSE
(you do not need the option to download the PDF invoice) and everything went well, the answer is a text with the following structure:
Text indicating success: xmlagentresponse=DONE
The number of the created invoice, such as: “2011-123”
So the value of the response after successful invoice creation should look like the following:
xmlagentresponse=DONE;2011-123
In case there was an error during invoice creation, you will receive one or more error messages.
The format of the error message will be as it can be seen below. The part between [ERR]
and ------------
is important.
In case you request a paper-based non e-invoice creation and you need the download option <szamlaletoltes>true</szamlaletoltes>
, then you can indicate that you not only need the original version of the invoice but a copy as well in a single PDF.
We can mark this in the <szamlaletoltesPld>2</szamlaletoltesPld>
variable.
XML response
XML response in case of success when
<szamlaletoltes>
isFALSE
:
<?xml version="1.0" encoding="UTF-8"?>
<xmlszamlavalasz xmlns="http://www.szamlazz.hu/xmlszamlavalasz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sikeres>true</sikeres>
<szamlaszam>XXX-2012-3</szamlaszam>
<szamlanetto>30000</szamlanetto>
<szamlabrutto>38100</szamlabrutto>
</xmlszamlavalasz>
XML response in case of success when
<szamlaletoltes>
isTRUE
:
<?xml version="1.0" encoding="UTF-8"?>
<xmlszamlavalasz xmlns="http://www.szamlazz.hu/xmlszamlavalasz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sikeres>true</sikeres>
<szamlaszam>XXX-2012-3</szamlaszam>
<szamlanetto>30000</szamlanetto>
<szamlabrutto>38100</szamlabrutto>
<pdf>JVBERi0xLjQKJdDUxdgKMSAwIG9iago8PCAvUyAvR29UbyAvRCBbMiAwIFIgIC9GaXQgXSA+Pgpl
bmRvYmoKNCAwIG9iaiA8PAovTGVuZ3RoIDE4MDggICAgICAKL0ZpbHRlciAvRmxhdGVEZWNvZGUK Pj4Kc3RyZWFtCnjaxVjLbttGFN37K7gpQAHlZN4P72zUTpvATVu72aRZqBLtKHqlEm0jAor8es88
RJESLduRgXoRTTjDO+fee+6LNLvJaPb66PTq6NU5c5kjTnOdXV1nmhJnMqMEMUJkV8PsQ85I7+PV
m1fntnGMCSKEg4xw4kuP2/wvykVPGp6Xk2FYK0rz/sxvfe0VQgicULRclMOyGmHJegVXxtH8crU5
Pp30l83/HvcKxrH66fXrglPGC+GxHNGEf/sXyuiMS2KsYQGmsUQLmxVcE6VtRHu56iW0SqlwZafM
....
MDAwMDg2NTIxIDAwMDAwIG4gCjAwMDAwODY2NTcgMDAwMDAgbiAKMDAwMDA4NjY5MyAwMDAwMCBu
IAowMDAwMDg2Nzk4IDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNDIKL1Jvb3QgNDAgMCBSCi9J
bmZvIDQxIDAgUgovSUQgWzxENDhERjNFQTdFM0MwQ0QyNDY0RUIzNzYwRTJBQzdBRj4gPEQ0OERG
M0VBN0UzQzBDRDI0NjRFQjM3NjBFMkFDN0FGPl0gPj4Kc3RhcnR4cmVmCjg3MTIzCiUlRU9G</pdf>
</xmlszamlavalasz>
XML response in case of unsuccessful creation:
<?xml version="1.0" encoding="UTF-8"?>
<xmlszamlavalasz xmlns="http://www.szamlazz.hu/xmlszamlavalasz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sikeres>false</sikeres>
<hibakod>3</hibakod>
<hibauzenet><![CDATA[Bejelentkezési hiba - a megadott login név és jelszó pároshoz nem létezik
felhasználó]]></hibauzenet>
</xmlszamlavalasz>
The response complies with the following XSD scheme:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.szamlazz.hu/xmlszamlavalasz" xmlns:tns="http://www.szamlazz.hu/xmlszamlavalasz" elementFormDefault="qualified">
<complexType name="szamlavalasz">
<sequence>
<element name="sikeres" type="boolean" maxOccurs="1" minOccurs="1"></element>
<element name="hibakod" type="string" maxOccurs="1" minOccurs="0"></element>
<element name="hibauzenet" type="string" maxOccurs="1" minOccurs="0"></element>
<element name="szamlaszam" type="string" maxOccurs="1" minOccurs="0"></element>
<element name="szamlanetto" type="double" maxOccurs="1" minOccurs="0"></element>
<element name="szamlabrutto" type="double" maxOccurs="1" minOccurs="0"></element>
<element name="kintlevoseg" type="double" maxOccurs="1" minOccurs="0"></element>
<element name="vevoifiokurl" type="string" maxOccurs="1" minOccurs="0"></element>
<element name="pdf" type="base64Binary" maxOccurs="1" minOccurs="0"></element>
</sequence>
</complexType>
<element name="xmlszamlavalasz" type="tns:szamlavalasz"></element>
</schema>
The structure of the response is very different, but the logic behind it is similar.
You still get the information described above in the header of the XML response.
In case the <szamlaletoltes>
value is set to TRUE
, the invoice PDF will appear between the <PDF></PDF>
tags with base64 encryption.
How do I know the number of an invoice and its gross or net value?
Every HTTP response consists of two parts. The first one is the header, and the second one is the body. If the calling party requests the invoice, the body will be a pdf file. The header is always a name=value
pair. In all programming languages that support HTTP requests there is an option to get the values in the header. In Számla Agent you can insert data in the header using the following names always starting with szlahu_
:
-
szlahu_szamlaszam
: the number of the created invoice, URL encoded -
szlahu_nettovegosszeg
: number type data, not URL encoded -
szlahu_bruttovegosszeg
: number type data, not URL encoded -
szlahu_vevoifiokurl
: this is the URL which was sent to the customer in the invoice notification. If online payment is availabe, the customer can use this link for payment. -
szlahu_error
: text of error message, a single sentence, URL encoded -
szlahu_error_code
: number type data, not URL encoded
If there are error codes in the header, the other data (invoice number, gross and net value) will not be present in the header. In case of an XML response, the XML will include that information besides the header fields.