nav-gov-hu / Online-Invoice

Public repository of the Online Invoice System
Other
139 stars 52 forks source link

Response type #75

Closed Antonikas58 closed 5 years ago

Antonikas58 commented 5 years ago

Hi team, I have one question regarding response structures. When we got the response for ManageInvoice for example, the structure is looking like:

ERROR The endpoint is currently down. It will serve requests in the near future.

In xsd scheme we have "http://schemas.nav.gov.hu/OSA/2.0/data" namespace for tag 'message' but not the "http://schemas.nav.gov.hu/OSA/2.0/api". Also i met the similar issue in getToken response. I doesn't only connected with tag 'message', but another tags with "http://schemas.nav.gov.hu/OSA/2.0/data" namespace are involved. Could you please clarify, if it would be changed when webservice will start to work? Because in a such case we have some kind of inconsistency in comparison with xsd scheme.

NTCA-developer commented 5 years ago

Hi @Antonikas58,

I'm guessing you are trying to POST to the v2 endpoints of the system. The v2/manageInvoice and v2/manageAnnulment endpoints are deliberately disabled on both the public test and on the production environment at the moment.

You can get the official deployment schedule on https://onlineszamla.nav.gov.hu/home (switch to english on the upper right corner).

TLDR: you will be able to use all the v2 endpoint tomorrow on the public test system, but the production system will remain closed until february, 2020 for v2 data disclosures.

Antonikas58 commented 5 years ago

Hi Team, Today i tried to send a request to new webservice but the issue is the same. I got the response without declared prefixes for several tags: header - timestamp; result - errorCode, message; software - softwareName,softwareMainVersion,softwareDevName,softwareDevContact,softwareDevCountryCode,softwareDevTaxNumber;

The response is looking like (please don't consider invalid request signature, that is because of our old hash mechanism sha-512, later it would be switched):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

20191016065933711 2019-10-16T06:59:32.000Z 2.0 1.0
ERROR INVALID_REQUEST_SIGNATURE Érvénytelen kérés aláírás! SAP-S4HANA-1909-OP SAP LOCAL_SOFTWARE SAP-S4HANA-2009 SAP SE info@sap.com

So what i expect to see is prefix ns2 for all that tags that were mentioned.

Best regards Anton Liolia

NTCA-developer commented 5 years ago

Hi @Antonikas58,

I apologize in advance if I did not get the question correctly.

The responses of the API have the xmlns="http://schemas.nav.gov.hu/OSA/2.0/api" attribute, which means that each tag without a specific namespace attribute is considered the part of the default ns, in this case, the xmlns="http://schemas.nav.gov.hu/OSA/2.0/api". There won't be any other namespace element concerning the tags you mention. This is exactly how the v1 endpoints behaved, and the v2 endpoint will do the same.

Did I answer your question? If not, please post an example.

Antonikas58 commented 5 years ago

Hi team, I understand this, but the difference is that in your previous xsd schemas for v1 all tags were of xmlns="http://schemas.nav.gov.hu/OSA/2.0/api". But now based on your new xsd some tags now should have another namespace. Let me try to explain. For example. Element 'ManageInvoiceresponse', based on xsd v2 have type 'TransactionResponseType'->'BasicResponseType'->'BasicResultType'->'errorCode' has type (data:SimpleText50NotBlankType) data prefix in file InvoiceApi.xsd is - "http://schemas.nav.gov.hu/OSA/2.0/data". So the namespace of that element should be "http://schemas.nav.gov.hu/OSA/2.0/data" but not the "http://schemas.nav.gov.hu/OSA/2.0/api".

Antonikas58 commented 5 years ago

Hi team, Are there any updates for this topic?

NTCA-developer commented 5 years ago

Hi @Antonikas58,

I see what you are referring to, but this is not exactly the way namespaces work. I'm going to give you examples for a better understanding.

In case when a schema imports another - and because of that it has more than one namespace -, the namespace belonging to a specific element is not defined by where (under which namespace) the type of the specific element resides, but where the element is actually declared.

Let's take your example, the errorCode element. You are right in that, that it's type is imported from the invoiceData XSD (data:SimpleText50NotBlankType) but there is not an errorCode named element in there. The element is declared only in the invoiceApi schema, therefore it belongs to the default namespace.

What you say is implicitly true for complex types, because they normally contain the element definition too. The positive example for this is the QueryTaxpayerResponse example. Notice the second namespace declaration and the tags under taxpayerAddress.

`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

RID485286208948 2019-10-21T05:35:07.704Z 2.0 1.0
OK H85INBWE8K2T509MOO String LOCAL_SOFTWARE 1.0 String String String String true NEMZETI ADÓ- ÉS VÁMHIVATAL HU 1054 BUDAPEST SZÉCHENYI UTCA 2
` This happens because tags like countryCode, postalCode are declared in the invoiceData schema. But also notice, that even their parent tag (taxpayerAddress) one level above does have the default ns. Ultimately, I always say that belive no one but your own eyes. You can try to edit this XML I attached here and change - for example - the softwareName tag to have ns2 namespace and validate the resulting XML against the invoiceApi scema. It is going to be invalid.
Antonikas58 commented 5 years ago

Hi Team, I tried to validate by myself and i agree that this xml fit the xsd, the issue is resolved, thanks.

NTCA-developer commented 5 years ago

Very welcome, anytime.