ebics-java / ebics-java-client

Java open source EBICS client - Support for French, German and Swiss banks
GNU Lesser General Public License v2.1
36 stars 35 forks source link

C54 orderType not fully serilized #22

Closed markkko closed 3 years ago

markkko commented 3 years ago

Hi,

when I try to download C54 orederType, it is not serialised the right way.

This is how serialised file looks like:

PK
≥…R£QIë¿ë¿42021-06-10_C54_DE52701694100002965682_EUR_636794.xml<?xml version="1.0" encoding="UTF-8" ?><Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02 camt.054.001.02.xsd">
  <BkToCstmrDbtCdtNtfctn>
    <GrpHdr>
      <MsgId>054D2021-06-09T22:20:31.0N210000012</MsgId>
      <CreDtTm>2021-06-09T22:20:25.0+02:00</CreDtTm>
.
.
.
rest of the file is OK

But it should looks like

<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.053.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02 camt.054.001.02.xsd">
  <BkToCstmrDbtCdtNtfctn>

When I opet it with Sublime (UTF-8), after "PK" I got some adresses: <0x03><0x04>....and then 2021-06-10_C54_DE52701694100002965682_EUR_636794.xml Please check screenshot here https://ibb.co/gmmtmmH

uwemaurer commented 3 years ago

It sounds like you are looking at a ZIP file which contains the xml file. The header PK 0x03 0x04 is the start of a zip file. How are you generating this file you are looking at?

markkko commented 3 years ago

I am calling client.fetchFile(getOutputFile(outputFile), client.getDefaultUser(), product, orderType, false, null, null); with C54 orderType.

And on response: org.kopi.ebics.io.Joiner.writeTo(dest, response.getTransactionKey()) is called.

Should I first call: Utils.unzip(transactionKey), then this.user.decrypt(this.buffer.toByteArray(), unzippedTransactionKey); ?

uwemaurer commented 3 years ago

Can you try to rename the downloaded file to have a .zip suffix and then open it as ZIP file? There should be one file entry inside the ZIP file.

You can also do this programatically then with java.util.zip.ZipFile

markkko commented 3 years ago

Yes, it works.

Big thanks.