phax / ph-ubl

Java library for reading and writing UBL 2.0, 2.1, 2.2, 2.3 and 2.4 (CS01) documents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extending library for customisations

o opened this issue · comments

commented

Hello Philip!

First of all thanks for your great effort. I'm using this library for reading / writing UBL documents, also customised for "UBL Turkish Customization - UBLTR" documents.

Turkish customisation also comes with following documents

    PROCESS_USER_ACCOUNT (org.hr_xml._3.ProcessUserAccountType.class, "../HRXML/UserAccount.xsd"),
    STANDARD_BUSINESS_DOCUMENT (org.unece.cefact.namespaces.standardbusinessdocumentheader.StandardBusinessDocument.class, "PackageProxy.xsd"),
    PACKAGE (tr.gov.efatura.package_namespace.Package.class, "../common/Package.xsd");

My main problem is, Reader, Writer, Validator, Marshaller, and DocumentType(s) classes marked as final.

So, i can't extend any functionality and i need to write this classes separately (most of the parts derived from your work) e.g. class UBL21TRMarshaller extends AbstractUBLMarshaller.

Do you have any plan for making this classes extendible for using with UBL customisations?

Thanks!
O.

commented

Hello again!

Looks like i'm on a wrong direction. I was borrowed my impl. from your old test classes UBL21FuncTest. And most of the things is deprecated.

Now i'm trying to use Builder classes for my custom UBL classes (for 2.1) but it tries to find impl. with UBL21DocumentTypes.getDocumentTypeOfImplementationClass method and it can't find from EUBL21DocumentType enum.

Currently i have no idea how to add my custom document types to EUBL21DocumentType.

Hi!
If I understand you correctly, you want to dynamically extend the EUBL21DocumentType enum to add your UBLTR documents - right? Currently this cannot be done, but I understand the need.

Currently I'm in the middle of transitioning all my libraries to JDK 8 including ph-ubl. After I'm done with the transition I can make this for you.

To have a testing scenario it would be great if you could give me a link to the UBLTR XSDs so that I can create a small side order project that uses the extension mechnism (that will come).

hth, Philip

Is http://efatura.gov.tr/dosyalar/kilavuzlar/e-FaturaPaketi.zip the correct link?

And Btw. I also have an SBDH library: https://github.com/phax/ph-sbdh - in case you are interested :)

commented

Hi!

Correct. I need to extend EUBL21DocumentType, but enums are not extensible.

Link is correct, but UserAccount.xsd file in zip file is incomplete, it needs a namespace declaration (UBL-xmldsig-core-schema-2.1.xsd), i'm adding correct files to here.

Also i'm adding files for implementations with deprecated api and xml files for testing.

test-xml-files
impl-with-old-api
xsds

Here is how i'm compiling xml files. (completely derived from your project)
screen shot 2016-01-28 at 17 05 43

ph-sbdh project looks interesting, I'll try it!

Thanks for your quick response.

So, I added a new sub-project called ph-ubltr - it gives you the possibility to read and write CancelUserAccount and ProcessUserAccount in a straight forward manner - see https://github.com/phax/ph-ubl/tree/master/ph-ubltr.
I will also add support for the Package type.
hth

commented

This.. is.. great!! I'm trying now and i'll ping you if i've experience with any problem.

Thanks again!

(Looks like this issue resolved, we can close it)

You may close the issue and I suggest we open a new issue to handle the details.
I would add the Package type and integrate it with ph-sbdh. Anything else?
P.S. a star on the project would be highly desired :)

commented

Just started to writing all tests from scratch using new libraries. I'll write a detailed email or pull request about new details (also for positive feedbacks).

Your projects deserves more stars man! ⭐

Thanks man - any feedback and extensions are welcome :)
I just added support for the Package type today - i case you didn't see it.

commented

I saw when dug your commits, and closed issue about Package :)
Is there any way to use edge / snapshot version of ph-ubltr package via maven? I can't find snapshot version (of ph-ubl / ubl21) in central repository.

There was an error with the Travis build - I try to fix this... https://travis-ci.org/phax/ph-ubl
Just wait a few minutes :)

I needed to change something in ph-commones - there was a little redundancy. I will let you know when ph-ubl is on the server

commented

Ok man - thanks for your great work again!

Okay, latest SNAPSHOT is on Maven server

commented

Hello again!
First of all, sorry if i'm disturbing you with my use cases. I know, this project not written for customisations. If you wan't i'll go with my custom fork using your libraries. (Don't get me wrong, i don't want to steal your time). Main problem is TR customisation. Not your library :)

Firstly, current tests prints some errors (github-master)

Running com.helger.ubltr.EUBLTRDocumentTypeTest
[main] ERROR com.helger.commons.xml.sax.LoggingSAXErrorHandler - [error] file:///Users/osman/Developer/ph-ubl/ph-ubltr/target/classes/schemas/ubltr/Envelope/Package_1_2.xsd(2:238): [SAX] src-import.3.1: The namespace attribute, 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2', of an <import> element information item must be identical to the targetNamespace attribute, 'http://www.efatura.gov.tr/package-namespace', of the imported document.
[main] ERROR com.helger.commons.xml.sax.LoggingSAXErrorHandler - [error] file:///Users/osman/Developer/ph-ubl/ph-ubltr/target/classes/schemas/ubltr/Envelope/Package_1_2.xsd(2:238): [SAX] src-import.3.1: The namespace attribute, 'urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2', of an <import> element information item must be identical to the targetNamespace attribute, 'http://www.efatura.gov.tr/package-namespace', of the imported document.
[main] ERROR com.helger.commons.xml.sax.LoggingSAXErrorHandler - [error] file:///Users/osman/Developer/ph-ubl/ph-ubltr/target/classes/schemas/ubltr/HRXML/UserAccount.xsd(4:68): [SAX] src-import.3.1: The namespace attribute, 'http://www.w3.org/2000/09/xmldsig#', of an <import> element information item must be identical to the targetNamespace attribute, 'http://www.hr-xml.org/3', of the imported document.

Changed the tests with following code. (Not for fixing, i want to test other files) Added files uses SBDH (Zarf means envelope - and tests failed too)

[SAX] cvc-elt.1: Cannot find the declaration of element 'sh:StandardBusinessDocument'.
package com.helger.ubltr;

import com.helger.commons.annotation.ReturnsMutableCopy;
import com.helger.commons.collection.CollectionHelper;

import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
import java.util.List;

@Immutable
public final class MockUBLTRTestDocuments {
    private static final String PREFIX = "";

    private MockUBLTRTestDocuments() {
    }

    @Nonnull
    @ReturnsMutableCopy
    public static List<String> getUBLTRTestDocuments(@Nonnull final EUBLTRDocumentType eType) {
        List<String> aFiles = null;
        switch (eType) {
            case CANCEL_USER_ACCOUNT:
                aFiles = CollectionHelper.makeUnmodifiable(
                        PREFIX + "tr_useraccount/5_KULLANICI_SILME.xml",
                        PREFIX + "tr_useraccount/9_FATURA_SAKLAMA_KULLANICI_SILME.xml",
                        PREFIX + "tr_useraccount_zarf/4_KULLANICI_ACMA_ZARF.xml",
                        PREFIX + "tr_useraccount_zarf/8_FATURA_SAKLAMA_KULLANICI_ACMA_ZARF.xml"
                );
                break;
            case PROCESS_USER_ACCOUNT:
                aFiles = CollectionHelper.makeUnmodifiable(
                        PREFIX + "tr_useraccount/4_KULLANICI_ACMA.xml",
                        PREFIX + "tr_useraccount/8_FATURA_SAKLAMA_KULLANICI_ACMA.xml",
                        PREFIX + "tr_useraccount_zarf/5_KULLANICI_SILME_ZARF.xml", /// <-----
                        PREFIX + "tr_useraccount_zarf/9_FATURA_SAKLAMA_KULLANICI_SILME_ZARF.xml" /// <-----
                );
                break;
            default:
                throw new IllegalArgumentException("No test files available for type " + eType);
        }

        return CollectionHelper.newList(aFiles);
    }
}

Test

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building ph-ubltr 5.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ ph-ubltr ---
[INFO] Deleting /Users/osman/Developer/ph-ubl/ph-ubltr/target
[INFO] 
[INFO] --- maven-jaxb2-plugin:0.13.1:generate (ubltr) @ ph-ubltr ---
[INFO] Up-to-date check for source resources [[file:/Users/osman/Developer/ph-ubl/ph-ubltr/src/main/jaxb/catalog-ubltr.cat, file:/Users/osman/Developer/ph-ubl/ph-ubltr/src/main/resources/schemas/ubltr/Envelope/Package_1_2.xsd, file:/Users/osman/Developer/ph-ubl/ph-ubltr/src/main/resources/schemas/ubltr/HRXML/UserAccount.xsd, file:/Users/osman/Developer/ph-ubl/ph-ubltr/src/main/jaxb/bindings-ubltr.xjb, file:/Users/osman/Developer/ph-ubl/ph-ubltr/pom.xml]] and target resources [[]].
[INFO] Sources are not up-to-date, XJC will be executed.
[INFO] Episode file [/Users/osman/Developer/ph-ubl/ph-ubltr/target/generated-sources/ubltr/META-INF/sun-jaxb.episode] was augmented with if-exists="true" attributes.
[INFO] 
[INFO] --- ph-buildinfo-maven-plugin:1.3.0:generate-buildinfo (default) @ ph-ubltr ---
[INFO] Successfully created temp directory /Users/osman/Developer/ph-ubl/ph-ubltr/target/buildinfo-maven-plugin
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ ph-ubltr ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 9 resources
[INFO] Copying 1 resource
[INFO] Copying 1 resource to META-INF
[INFO] 
[INFO] --- maven-compiler-plugin:3.5:compile (default-compile) @ ph-ubltr ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 98 source files to /Users/osman/Developer/ph-ubl/ph-ubltr/target/classes
[INFO] /Users/osman/Developer/ph-ubl/ph-ubltr/target/generated-sources/ubltr/tr/gov/efatura/useraccount/ObjectFactory.java: /Users/osman/Developer/ph-ubl/ph-ubltr/target/generated-sources/ubltr/tr/gov/efatura/useraccount/ObjectFactory.java uses unchecked or unsafe operations.
[INFO] /Users/osman/Developer/ph-ubl/ph-ubltr/target/generated-sources/ubltr/tr/gov/efatura/useraccount/ObjectFactory.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ ph-ubltr ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 8 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5:testCompile (default-testCompile) @ ph-ubltr ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /Users/osman/Developer/ph-ubl/ph-ubltr/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ ph-ubltr ---

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.helger.ubltr.EUBLTRDocumentTypeTest
[main] ERROR com.helger.commons.xml.sax.LoggingSAXErrorHandler - [error] file:///Users/osman/Developer/ph-ubl/ph-ubltr/target/classes/schemas/ubltr/Envelope/Package_1_2.xsd(2:238): [SAX] src-import.3.1: The namespace attribute, 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2', of an <import> element information item must be identical to the targetNamespace attribute, 'http://www.efatura.gov.tr/package-namespace', of the imported document.
[main] ERROR com.helger.commons.xml.sax.LoggingSAXErrorHandler - [error] file:///Users/osman/Developer/ph-ubl/ph-ubltr/target/classes/schemas/ubltr/Envelope/Package_1_2.xsd(2:238): [SAX] src-import.3.1: The namespace attribute, 'urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2', of an <import> element information item must be identical to the targetNamespace attribute, 'http://www.efatura.gov.tr/package-namespace', of the imported document.
[main] ERROR com.helger.commons.xml.sax.LoggingSAXErrorHandler - [error] file:///Users/osman/Developer/ph-ubl/ph-ubltr/target/classes/schemas/ubltr/HRXML/UserAccount.xsd(4:68): [SAX] src-import.3.1: The namespace attribute, 'http://www.w3.org/2000/09/xmldsig#', of an <import> element information item must be identical to the targetNamespace attribute, 'http://www.hr-xml.org/3', of the imported document.
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.472 sec - in com.helger.ubltr.EUBLTRDocumentTypeTest
Running com.helger.ubltr.SPITest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in com.helger.ubltr.SPITest
Running com.helger.ubltr.UBLTRBuilderFuncTest
[main] WARN com.helger.commons.system.SystemProperties - System property 'org.xml.sax.driver' is not set!
[main] INFO com.helger.jaxb.JAXBContextCache - Creating JAXB context for package tr.gov.efatura.useraccount using ClassLoader sun.misc.Launcher$AppClassLoader@4aa298b7
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<CancelUserAccount releaseID="releaseID0" xmlns="http://www.hr-xml.org/3" xmlns:oa="http://www.openapplications.org/oagis/9">
    <oa:ApplicationArea>
        <oa:Sender>
            <oa:LogicalID>9999999999</oa:LogicalID>
        </oa:Sender>
        <oa:Receiver/>
        <oa:CreationDateTime>2013-06-19T11:10:01</oa:CreationDateTime>
        <oa:Signature>
            <ds:Signature Id="Signature_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <ds:SignedInfo Id="Signed_Info_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/>
                    <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
                    <ds:Reference URI="">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                        <ds:DigestValue>LEUTScXYalgqfjNrfbG5JQaYvAn70CBpN1ppxKhvh9A=</ds:DigestValue>
                    </ds:Reference>
                    <ds:Reference Id="Prop_Ref_Id_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0" Type="http://uri.etsi.org/01903#SignedProperties" URI="#Prop_Id_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                        <ds:DigestValue>dIwYxj/vc4hSH6H8IRH5HMD+mqaTsT4b6e4L4XjCzMc=</ds:DigestValue>
                    </ds:Reference>
                </ds:SignedInfo>
                <ds:SignatureValue Id="Signature_Value_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">UUW7JZO4rjaW4o3sSVMFi1EtXHY0YfRPuCQJ1ySDT/lH/bRooibFCmlrZqWT64W5vlbIxLMAdTOe
iCsh4cpKoVk7vF9tkWD6i1/+A85ttV5FmG5xUEAa4hP75w4hW5yr6wKYpmihx25PMZ/WIYsAY1pj
Ypc1PzrhBiGcxuRG3G10GUnztK+hR3kuh1fig+S6l8rVg9V20Y1J9nDFgU3Z+7zCeFz9njyoSWJB
JfSwj+AXZM1MiEz1s7Kgu0xYlOZ+g/MWN8FJ6p4IhxOnykrGyrHfq0+hURfvaePd9Yh3x7/slnAx
Dwb0fc15AZ19doIj4/Z4dAT/i9WhRPoxo7aerw==</ds:SignatureValue>
                <ds:KeyInfo>
                    <ds:KeyValue>
                        <ds:RSAKeyValue>
                            <ds:Modulus>g4fWV5+GRbNQTnVpG5naG/4xC167blIngQJdOJVss7LSBjFkOOitvJtpV0Qvsld1HzW9A+P8aR17
KdgZzqsc5+akR0+volN2ZH9M+q0Xza7zSQjgBzovv2R6VQWLnEyFb4i3PzEqQMDbF8n30oNWj0Bj
BvNn+eTkxmk8ifhLDAwrrDasje5CudTNo9pIv73VcJqA3F+pKwW7MGIZeDJpLnbbqz+ELOIR3ev5
1Ewb889QQyqlMiu2LKaDVmpsFzAlFo25ayLTJ896/cL0Lff+/W+CKeOo3f/SrAcZWp0RWmiKZDET
9LqCodeH+2x3M8+KK2IwjABk378e8/TipjfENQ==</ds:Modulus>
                            <ds:Exponent>AQAB</ds:Exponent>
                        </ds:RSAKeyValue>
                    </ds:KeyValue>
                    <ds:X509Data>
                        <ds:X509SubjectName>CN=e-Fatura Deneme A.Ş.,2.5.4.5=#130a39393939393939393939,OU=e-Fatura Deneme A.Ş.</ds:X509SubjectName>
                        <ds:X509Certificate>MIIFrDCCBJSgAwIBAgIGAJpaGcRqMA0GCSqGSIb3DQEBCwUAMFwxCzAJBgNVBAYTAlRSMU0wSwYD
VQQDDERNYWxpIE3DvGjDvHIgRWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPE
sXPEsSAtIFPDvHLDvG0gMTAeFw0xMDAyMDQxMTI0MzlaFw0xNTAyMDMxMTI0MzlaMFUxHjAcBgNV
BAsMFWUtRmF0dXJhIERlbmVtZSBBLsWeLjETMBEGA1UEBRMKOTk5OTk5OTk5OTEeMBwGA1UEAwwV
ZS1GYXR1cmEgRGVuZW1lIEEuxZ4uMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg4fW
V5+GRbNQTnVpG5naG/4xC167blIngQJdOJVss7LSBjFkOOitvJtpV0Qvsld1HzW9A+P8aR17KdgZ
zqsc5+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c2R1cG1tczEua3VydW1zYWwua2FtdXNtLmdvdi50cjANBgkqhkiG9w0BAQsFAAOC
AQEACYMEtQf5/4+qEZrubSB9W5vjslgmCAiWg5b02DGxknjlrCpaXWq2WnBo2r5t2wCXkVXSpHYP
mx+AkJI7R0vOeUrNwMJokjDRG8iII2hUqrdqC+7eOKVPaoNcn1LKbvg8bMde3qcfMF1FFgCSQaon
u/3H1hl9r6kjLln1N3gSzdlCrumzx071FguBIrtWWfIdj8SZNicuru0Jr9xKQYHSRAvm1/noiTbz
iLj34Ayxz3/srXAJlp+9Z47D6XIUyhztwHKeS4Pf71yITWVszThmA4hm5hKPSJ3zt4tCbXwlSEkd
MNtPl6PFVBR/l/gtIYiBsR9lpib3+Lv9g0Gorz/5XQ==</ds:X509Certificate>
                    </ds:X509Data>
                </ds:KeyInfo>
                <ds:Object>
                    <xades:QualifyingProperties Target="#Signature_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                        <xades:SignedProperties Id="Prop_Id_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                            <xades:SignedSignatureProperties>
                                <xades:SigningTime>2013-06-19T11:10:04.399+03:00</xades:SigningTime>
                                <xades:SigningCertificate>
                                    <xades:Cert>
                                        <xades:CertDigest>
                                            <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                            <ds:DigestValue>4pCQHzUOwVViUIbtc2C5LQkMH/4nS2aTFSx93qp5x8Y=</ds:DigestValue>
                                        </xades:CertDigest>
                                        <xades:IssuerSerial>
                                            <ds:X509IssuerName>CN=Mali Mühür Elektronik Sertifika Hizmet Sağlayıcısı - Sürüm 1, C=TR</ds:X509IssuerName>
                                            <ds:X509SerialNumber>662936601706</ds:X509SerialNumber>
                                        </xades:IssuerSerial>
                                    </xades:Cert>
                                </xades:SigningCertificate>
                                <xades:SignerRole>
                                    <xades:ClaimedRoles>
                                        <xades:ClaimedRole>Tedarikçi</xades:ClaimedRole>
                                    </xades:ClaimedRoles>
                                </xades:SignerRole>
                            </xades:SignedSignatureProperties>
                        </xades:SignedProperties>
                        <xades:UnsignedProperties>
                            <xades:UnsignedSignatureProperties>
                                <xades:CounterSignature>
                                    <ds:Signature Id="Counter_Signature_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                                        <ds:SignedInfo Id="Counter_Signed_Info_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                                            <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/>
                                            <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
                                            <ds:Reference URI="#Signature_Value_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                                                <ds:Transforms>
                                                    <ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/>
                                                </ds:Transforms>
                                                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                                <ds:DigestValue>wyhPdDitBj/BpmWPmHmaD1/j8dPF4ia37CUjGfTsTm8=</ds:DigestValue>
                                            </ds:Reference>
                                            <ds:Reference Id="Counter_Prop_Ref_Id_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0" Type="http://uri.etsi.org/01903#SignedProperties" URI="#Counter_Prop_Id_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                                                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                                <ds:DigestValue>cHCaK4EvR8Q2dKPieDMJjDj4TTvSpcgGRmJTgkK6oBM=</ds:DigestValue>
                                            </ds:Reference>
                                        </ds:SignedInfo>
                                        <ds:SignatureValue Id="csid1">Xr0zH9ppMkO4Yg5mlJbj4YNiovjO0g1D0LMItzEG59DAsClH4K6DXH/o7c5Gfx0LZ1tFqfiof24R
qN7lmv7nI9sQmFeBqAhEIMkSsHMQXtcEFRJhcbw6uLm9144aXtPR4eM5tDS6UBnWhArIfaeXo4BQ
DoC6Sru6uFz1hDe8L/oTe0NAUsSsrRtthIXDAyriIh/+QlqQHh14nLFuCOJdUhfOWX3ND2IzDC5r
FN3mgWzg3/AZ2FMpfqp/DZLcjiSqWAMFgdLk51RDmR2aBvO7HHP+UmnYIUIRK/J1n7DdZ4bTqbpK
uHg0yGwxw3GS0Jz4Qu9aq6GQ0QRR/j4uq/B4lg==</ds:SignatureValue>
                                        <ds:KeyInfo>
                                            <ds:KeyValue>
                                                <ds:RSAKeyValue>
                                                    <ds:Modulus>g4fWV5+GRbNQTnVpG5naG/4xC167blIngQJdOJVss7LSBjFkOOitvJtpV0Qvsld1HzW9A+P8aR17
KdgZzqsc5+akR0+volN2ZH9M+q0Xza7zSQjgBzovv2R6VQWLnEyFb4i3PzEqQMDbF8n30oNWj0Bj
BvNn+eTkxmk8ifhLDAwrrDasje5CudTNo9pIv73VcJqA3F+pKwW7MGIZeDJpLnbbqz+ELOIR3ev5
1Ewb889QQyqlMiu2LKaDVmpsFzAlFo25ayLTJ896/cL0Lff+/W+CKeOo3f/SrAcZWp0RWmiKZDET
9LqCodeH+2x3M8+KK2IwjABk378e8/TipjfENQ==</ds:Modulus>
                                                    <ds:Exponent>AQAB</ds:Exponent>
                                                </ds:RSAKeyValue>
                                            </ds:KeyValue>
                                            <ds:X509Data>
                                                <ds:X509SubjectName>CN=e-Fatura Deneme A.Ş.,2.5.4.5=#130a39393939393939393939,OU=e-Fatura Deneme A.Ş.</ds:X509SubjectName>
                                                <ds:X509Certificate>MIIFrDCCBJSgAwIBAgIGAJpaGcRqMA0GCSqGSIb3DQEBCwUAMFwxCzAJBgNVBAYTAlRSMU0wSwYD
VQQDDERNYWxpIE3DvGjDvHIgRWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPE
sXPEsSAtIFPDvHLDvG0gMTAeFw0xMDAyMDQxMTI0MzlaFw0xNTAyMDMxMTI0MzlaMFUxHjAcBgNV
BAsMFWUtRmF0dXJhIERlbmVtZSBBLsWeLjETMBEGA1U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DovL2RlcG8ua2FtdXNtLmdvdi50ci9r
dXJ1bXNhbC9tbWVzaHMtczEuY3JsMIGCBggrBgEFBQcBAQR2MHQwPAYIKwYBBQUHMAKGMGh0dHA6
Ly9kZXBvLmthbXVzbS5nb3YudHIva3VydW1zYWwvbW1lc2hzLXMxLmNydDA0BggrBgEFBQcwAYYo
aHR0cDovL2Npc2R1cG1tczEua3VydW1zYWwua2FtdXNtLmdvdi50cjANBgkqhkiG9w0BAQsFAAOC
AQEACYMEtQf5/4+qEZrubSB9W5vjslgmCAiWg5b02DGxknjlrCpaXWq2WnBo2r5t2wCXkVXSpHYP
mx+AkJI7R0vOeUrNwMJokjDRG8iII2hUqrdqC+7eOKVPaoNcn1LKbvg8bMde3qcfMF1FFgCSQaon
u/3H1hl9r6kjLln1N3gSzdlCrumzx071FguBIrtWWfIdj8SZNicuru0Jr9xKQYHSRAvm1/noiTbz
iLj34Ayxz3/srXAJlp+9Z47D6XIUyhztwHKeS4Pf71yITWVszThmA4hm5hKPSJ3zt4tCbXwlSEkd
MNtPl6PFVBR/l/gtIYiBsR9lpib3+Lv9g0Gorz/5XQ==</ds:X509Certificate>
                                            </ds:X509Data>
                                        </ds:KeyInfo>
                                        <ds:Object>
                                            <xades:QualifyingProperties Target="#Counter_Signature_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                                                <xades:SignedProperties Id="Counter_Prop_Id_c0f7cb17-a89f-4ed4-8264-9d720d79d6d0">
                                                    <xades:SignedSignatureProperties>
                                                        <xades:SigningTime>2013-06-19T11:10:04.512+03:00</xades:SigningTime>
                                                        <xades:SigningCertificate>
                                                            <xades:Cert>
                                                                <xades:CertDigest>
                                                                    <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                                                    <ds:DigestValue>4pCQHzUOwVViUIbtc2C5LQkMH/4nS2aTFSx93qp5x8Y=</ds:DigestValue>
                                                                </xades:CertDigest>
                                                                <xades:IssuerSerial>
                                                                    <ds:X509IssuerName>CN=Mali Mühür Elektronik Sertifika Hizmet Sağlayıcısı - Sürüm 1, C=TR</ds:X509IssuerName>
                                                                    <ds:X509SerialNumber>662936601706</ds:X509SerialNumber>
                                                                </xades:IssuerSerial>
                                                            </xades:Cert>
                                                        </xades:SigningCertificate>
                                                        <xades:SignerRole>
                                                            <xades:ClaimedRoles>
                                                                <xades:ClaimedRole>Tedarikçi</xades:ClaimedRole>
                                                            </xades:ClaimedRoles>
                                                        </xades:SignerRole>
                                                    </xades:SignedSignatureProperties>
                                                </xades:SignedProperties>
                                            </xades:QualifyingProperties>
                                        </ds:Object>
                                    </ds:Signature>
                                </xades:CounterSignature>
                            </xades:UnsignedSignatureProperties>
                        </xades:UnsignedProperties>
                    </xades:QualifyingProperties>
                </ds:Object>
            </ds:Signature>
        </oa:Signature>
    </oa:ApplicationArea>
    <DataArea>
        <oa:Cancel/>
        <UserAccount>
            <UserID>9999999999</UserID>
            <PersonName>
                <FormattedName>e-Fatura Deneme A.Ş. 3</FormattedName>
                <oa:GivenName></oa:GivenName>
                <MiddleName></MiddleName>
                <FamilyName></FamilyName>
            </PersonName>
            <UserRole>
                <RoleCode xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">GB</RoleCode>
                <RoleName>Gönderici Birim</RoleName>
            </UserRole>
            <AuthorizedWorkScope>
                <WorkScopeCode>urn:mail:defaultgb@gib.gov.tr</WorkScopeCode>
                <WorkScopeName>Gönderici Birim Etiketi</WorkScopeName>
            </AuthorizedWorkScope>
            <AccountConfiguration>
                <UserOptionCode>2</UserOptionCode>
            </AccountConfiguration>
        </UserAccount>
        <UserAccount>
            <UserID>9999999999</UserID>
            <PersonName>
                <FormattedName>e-Fatura Deneme A.Ş. 3</FormattedName>
                <oa:GivenName></oa:GivenName>
                <MiddleName></MiddleName>
                <FamilyName></FamilyName>
            </PersonName>
            <UserRole>
                <RoleCode xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">PK</RoleCode>
                <RoleName>Posta Kutusu</RoleName>
            </UserRole>
            <AuthorizedWorkScope>
                <WorkScopeCode>urn:mail:defaultpk@gib.gov.tr</WorkScopeCode>
                <WorkScopeName>Posta Kutusu Birimi Etiketi</WorkScopeName>
            </AuthorizedWorkScope>
            <AccountConfiguration>
                <UserOptionCode>2</UserOptionCode>
            </AccountConfiguration>
        </UserAccount>
    </DataArea>
</CancelUserAccount>

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.352 sec - in com.helger.ubltr.UBLTRBuilderFuncTest
Running com.helger.ubltr.UBLTRDocumentTypesTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in com.helger.ubltr.UBLTRDocumentTypesTest
Running com.helger.ubltr.UBLTRFuncTest
[main] ERROR com.helger.commons.xml.sax.LoggingSAXErrorHandler - [error] file:/Users/osman/Developer/ph-ubl/ph-ubltr/target/test-classes/tr_useraccount_zarf/5_KULLANICI_SILME_ZARF.xml(2:328): [SAX] cvc-elt.1: Cannot find the declaration of element 'sh:StandardBusinessDocument'.
[main] ERROR com.helger.commons.xml.sax.LoggingSAXErrorHandler - [error] file:/Users/osman/Developer/ph-ubl/ph-ubltr/target/test-classes/tr_useraccount_zarf/4_KULLANICI_ACMA_ZARF.xml(2:328): [SAX] cvc-elt.1: Cannot find the declaration of element 'sh:StandardBusinessDocument'.
Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.219 sec <<< FAILURE! - in com.helger.ubltr.UBLTRFuncTest
testReadAndWriteProcessUserAccount(com.helger.ubltr.UBLTRFuncTest)  Time elapsed: 0.127 sec  <<< FAILURE!
java.lang.AssertionError: tr_useraccount_zarf/5_KULLANICI_SILME_ZARF.xml
    at com.helger.ubltr.UBLTRFuncTest.testReadAndWriteProcessUserAccount(UBLTRFuncTest.java:92)

testReadAndWriteCancelUserAccount(com.helger.ubltr.UBLTRFuncTest)  Time elapsed: 0.092 sec  <<< FAILURE!
java.lang.AssertionError: tr_useraccount_zarf/4_KULLANICI_ACMA_ZARF.xml
    at com.helger.ubltr.UBLTRFuncTest.testReadAndWriteCancelUserAccount(UBLTRFuncTest.java:52)


Results :

Failed tests: 
  UBLTRFuncTest.testReadAndWriteCancelUserAccount:52 tr_useraccount_zarf/4_KULLANICI_ACMA_ZARF.xml
  UBLTRFuncTest.testReadAndWriteProcessUserAccount:92 tr_useraccount_zarf/5_KULLANICI_SILME_ZARF.xml

Tests run: 7, Failures: 2, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.247 s
[INFO] Finished at: 2016-02-05T17:13:22+01:00
[INFO] Final Memory: 34M/551M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project ph-ubltr: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/osman/Developer/ph-ubl/ph-ubltr/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Okay, the import problems have been fixed. I missed the Invoice and ApplicationResponse XSDs for the Package type.

Concerning the other stuff, it is a bit more tricky. The existing tests only use the CancelUserAccount and ProcessUserAccount data types and therefore only the test files containing only these 2 types are contained.

For reading SBHD you currently need to manually use the class SBDMarshaller from ph-sbdh. I will think of a solution so that I can move the IUBLDocumentType to a more basic package and therefore make it available to other JAXB processing projects (like ph-sbdh) as well. hth

commented

Hello! Osman again :)

Looks like there is a wrong import in here https://github.com/phax/ph-ubl/blob/master/ph-ubltr/src/main/java/com/helger/ubltr/UBLTRReader.java#L24 Am i wrong (tr.gov.efatura.package_12.Package)

By the way, i'm using current snapshots (ph-ubl-parent-pom - ph-sbdh) and of course ph-ubltr and ph-sbdh solves my problems too. (finally beginning to see daylight)

Cheers - your nightmare 😢

Hi Osman!

You are aboslutely right - thanks for pointing this out!
Since Package is a class in java.lang I prefixed the class names for this package with TR so it will be TRPackage.

Btw. I extended ph-sbdh so that you can use the read/writer/validation builder like you do for UBL.

You are absolutely not a nightmare - just ask. If I can't help, I will let you know!
// Philip

So how are things going? Do you have any news for me?

commented

Hey! Currently writing tests and i can read and validate "SBD wrapped" and "individual" UBL documents perfectly.

Nature of Package and SBD allows any type of object in XML documents. The only (not a real) problem is dealing with this objects.

And yes. Problem solved! Current snapshots works like a charm!

Excellent. As soon as a release is out, I will let you know!
The problem with the any is that it dependens on the processContents XSD attribute.
I'm always checking with instanceof Element and ignore all non-elements.
Happy coding!

commented

Hello Philip!

Do you have any plan for releasing 5.0.0 stable?

Hi!
I'm close to finishing, I expect it to be this week or at the latest next week.
Sorry for the delay :)
// Philip

commented

Thanks for the quick reply.

Keep up your good work!

On 30 May 2016, at 10:41, Philip Helger notifications@github.com wrote:

Hi!
I'm close to finishing, I expect it to be this week or at the latest next week.
Sorry for the delay :)
// Philip


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub #7 (comment), or mute the thread https://github.com/notifications/unsubscribe/AAK-yEgT6-3KUBmYRwTP5K_MUcm7vduCks5qGpSpgaJpZM4HOJAl.

Version 5.0.0 is on Maven Central

commented

Thanks for your great effort!

👏🏻