Day 1: XML Signature Missing or Not Wrapped in UBLExtensions #irberror #ublsignature

SEO Title: Day 1: XML Signature Missing or Not Wrapped in UBLExtensions #irberror #ublsignature
Focus Keyphrase: IRB e-invoice XML signature error
Meta Description: Fix the common IRB e-invoice XML signature error where the ds:Signature is not wrapped inside ext:UBLExtensions. Follow UBL 2.1 structure properly.

Common IRBM Error: Signature Not Wrapped Correctly

When submitting your UBL XML to IRBM, one of the most frequent errors is:


"UBL Signature is missing or not in correct UBLExtensions placement"

What This Error Means

The IRBM MyInvois API expects your XML signature block to be:

  • Present (a valid ds:Signature)
  • Wrapped inside ext:UBLExtensions
  • Placed before all other elements (top of the Invoice)

Incorrect Example

If you just append the signature to the root element like this:


<Invoice>
  ...
  <ds:Signature>...</ds:Signature>
  ...
</Invoice>

It will fail.

Correct Structure


<Invoice>
  <ext:UBLExtensions>
    <ext:UBLExtension>
      <ext:ExtensionContent>
        <ds:Signature>...</ds:Signature>
      </ext:ExtensionContent>
    </ext:UBLExtension>
  </ext:UBLExtensions>
  ...
</Invoice>

Laravel Fix

In your XML generator, insert a SignaturePlaceholder node inside ext:ExtensionContent:


$extensions = $doc->createElementNS($ext, 'ext:UBLExtensions');
$extension = $doc->createElementNS($ext, 'ext:UBLExtension');
$content = $doc->createElementNS($ext, 'ext:ExtensionContent');
$placeholder = $doc->createElement('SignaturePlaceholder');

$content->appendChild($placeholder);
$extension->appendChild($content);
$extensions->appendChild($extension);
$invoice->appendChild($extensions);

Then in your signing service, replace that placeholder:


$placeholder = $doc->getElementsByTagName('SignaturePlaceholder')->item(0);
$signatureNode = $objDSig->insertSignature();
$importedSig = $doc->importNode($signatureNode, true);
$placeholder->parentNode->replaceChild($importedSig, $placeholder);

Why This Happens

IRBM uses strict XSD validation based on UBL 2.1. Even if your signature is valid cryptographically, if it’s placed outside UBLExtensions, your invoice will be rejected.

Coming Up in Day 2

We’ll fix the next common issue: invalid base64-encoded payload or missing UTF-8 encoding headers during API submission.


Tags: #IRBIntegration #UBLSignature #XMLSigning #LaravelEInvoice #MyInvoisError

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.