PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD18] Problem with italian "Electronic Invoice" for Public Administrations
[WD18] Problem with italian "Electronic Invoice" for Public Administrations
Iniciado por guest, 26,may. 2015 00:07 - 9 respuestas
Publicado el 26,mayo 2015 - 00:07
Hello to All

First, i'm sorry if i write in italian, but i hope that some italian windevers will read this post and can help me to solve this trouble.

Italian
Sono alla ricerca disperata di qualche programmatore Windev che possa dirmi in che formato devono essere criptati gli eventuali allegati ad una fattura elettronica PA.
Ho provato con "crypt" indicando il buffer dove carico il file (pdf per esempio) e dandogli quasi tutte le possibili combinazioni, ma ogni volta che invio il file per il controllo formale al sito SDI, mi vengono elencati degli errori proprio sul formato criptato degli allegati.

Grazie in anticipo per chi potrà aiutarmi

English
I'm at desperate research of an italian windev programmer that can told me in which format must be crypted the enclosed file in a italian electronic invoice for the P.A.
I have used the function "crypt" indicating the buffer field where i load the file (ie. pdf) and giving all the possible combinations, but every time i try send the file to the public administration site for its checking, i obtain a list of errors about the format used for the crypted file.

Thanks in advance.

Gianni
Publicado el 26,mayo 2015 - 00:46
Hi Gianni,

I'm not italian, but in a case like that, in any and all cases, the administration is going to tell you how to encrypt (the name of the algorithm to use and its option)

If you tell us THAT, we should be able to tell you how to do it in windev

Best regards
Publicado el 26,mayo 2015 - 07:43
Caro signore Spano,

we have a fully working solution for the transfer of invoices to the Austrian government, which conforms - as they say - to the European standards. Which is not EDIFACT but a home-brewn solution by a European consulting company and works through a web service. It would help a lot if you could detail the norms for doing that in Italy to us. Is there any official Italian web site for that? Maybe, we can help you ...
Publicado el 26,mayo 2015 - 08:50
Hello Fabrice & Guenter

Thanks for your replies.

The problem is referred to my previous post as Fabrice already know.

The encription format is "xs:base64binary". In pratice, i'm trying to include few files in a xml file and they require the above format.

To include the files i'm using this portion of code:
sBuffer is buffer sFile is string = "c:\iletoload.pdf" sPass is string = "" sEncrypt is string sBuffer=floadbuffer (sfile) sEncrypt=crypt (sBuffer, sPass, cryptNone,encodeBASE64)
The "sEncrypt" field should contains the data encrypted from the buffer, but comparing the content with a copy of a another file with the right encrypted data, it seems to be truncated and the last part of the data are missing.
Is it depending from some string length limits?

Thanks for your attention

Gianni

P.S. @Guenter: Thank you for your "Caro Signor Spano".... :-)
Publicado el 26,mayo 2015 - 12:42
Hello

Using "floadtext" instead of "floadbuffer" solve the problem.

Thanks

Gianni
Publicado el 26,mayo 2015 - 17:50
Hello Fabrice & Guenter

I was hoping to have resolved the trouble adding the file content to a XML file with the "floadtext" (or "floadbuffer") function, but it doesn't work: the file seems to be truncated!!!

I don't know if the "XMLAddChild" has some limitations, but reading the online help, nothing is talking about the limit in size of the value passed.

I did a little test, passing the content of the "sEncrypt" field used by "crypt", showing it on a multiline textbox. The crypted data start and end correctly, but when i try to add it to the XML file, a consistent final part of it is missing, like it arrives at the end!!!

Is it possible that "XMLAddChild" has a limits in length of chars used???

Thanks in advance, from a desperate programmer... (not housewife!! :-) )

Gianni
Publicado el 26,mayo 2015 - 18:54
Hello to all

Other considerations.

It seems that the max size of the string handles by "XMLAddChild" is 63939!!!

I have loaded two different pdf files and both have a string size of 63939...
Is there a way to increase this limit or it must be considered the max limit??

Hope someone can tell me something about this behaviour...
Or if there is another way to store the crypted file in the xml file.

Thanks

Gianni
Publicado el 26,mayo 2015 - 18:58
Gianni

Unfortunately I am nowhere near being an xml guru however I do recall a fellow programmer having a similar issue to you re truncated strings.

As I recall, it was some time ago, his resolution invoved the use of an XSD file to specifiy the lengths required.
This was provided by the client who required the XML.

WD, B, M all support this - check the Help.

Really hope I am not wasting your time.
Publicado el 26,mayo 2015 - 22:56
Hi Gianni,

I do not know if there is a size limit, and where it's coming from...

However, a xml file is nothing more than a text file

Therefore, you can use your xmlAddCHild to setup a place holder (%PlaceHolder% by example), then at the end, use replace to replace this place holder by your base64 string

Best regards
Publicado el 27,mayo 2015 - 10:55
Hello Fabrice

Yes, it is the same solution i have applied.
The steps:
- Save/Close the XML file
- Open it in read/write mode
- Replace the %Attachment% string with the file content, previously loaded in a string

- Save the file with the new values.
That's all!!!

Thanks for your support...It works!!!

I would like to know the reason of this behaviour (truncated data), and i think it could be some limit using the "XMLAddChild" function.
I was thinking it could be depending from the XSD file, but this file has been released from our government (IT Department for Italy), and it can't be
I can't investigate further, i pass the ball to PCSoft support.
In the meantime i'm happy to have resolved this trouble, thanking you all for the support.

Regards

Gianni