# NewSigned.xml is not getting created

**URL:** <https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952>\
**Category:** Signing process\
**Created:** [November 7, 2023, 2:20pm UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952 "2023-11-07T14:20:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdulhaseeb](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@abdulhaseeb](https://zatca1.discourse.group/u/abdulhaseeb)\
**Post date:** [November 7, 2023, 2:20pm UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952/1 "2023-11-07T14:20:34Z")

</div>

HI, i am using DOTNET dlls to signin xml using EInvoiceSigningLogic method,  
my problem is when i am using same DOTNET dlls in web application and signing the xml it is not creating “NewSigned.xml” at any location. but where as when i am using the dll in windows application and Signing then it is creating the “NewSigned.xml” at base directory.  
My one more problme is when i am deploying the windows application then “NewSigned.xml” is getting created a different location.  
Please let me know on what basis the location of creation of file is decided and why it is not getting created in webapplication … please…

---

<div class="post-metadata">

**Author:** ![Ammar](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@Ammar](https://zatca1.discourse.group/u/Ammar)\
**Post date:** [November 9, 2023, 9:57am UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952/2 "2023-11-09T09:57:21Z")

</div>

EInvoiceSigningLogic it’s return object result contain string singing xml you can handle and saved.

---

<div class="post-metadata">

**Author:** ![abdulhaseeb](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@abdulhaseeb](https://zatca1.discourse.group/u/abdulhaseeb)\
**Post date:** [November 11, 2023, 10:55am UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952/3 "2023-11-11T10:55:47Z")

</div>

![image](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/93f838c609598ff6d0c578c456d5659a38cdc4d8.png)

But for me it is getting NULL, i have attached the screen shot of it.

---

<div class="post-metadata">

**Author:** ![Ammar](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@Ammar](https://zatca1.discourse.group/u/Ammar)\
**Post date:** [November 13, 2023, 4:43pm UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952/4 "2023-11-13T16:43:31Z")

</div>

@abdulhaseeb

The signing XML in the ResultedValud parameter you can saved in XML file

---

<div class="post-metadata">

**Author:** ![abdulhaseeb](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@abdulhaseeb](https://zatca1.discourse.group/u/abdulhaseeb)\
**Post date:** [November 15, 2023, 6:06am UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952/5 "2023-11-15T06:06:36Z")

</div>

![image](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/d0855dccfb34bd386dc10ac9690277cebcdf76b0.png)

Thanks for your reply, i have tried the same as per your instruction but once after saving xml when i am trying to get the xml hash using below code i am getting different hash when compared to the once exist in the created xml, please find the screen shot above.

var result = new Result();  
HashingValidator hv = new HashingValidator();  
result = hv.GenerateEInvoiceHashing(XMLfilename);  
if (result.IsValid)  
{  
XMLfilenamehash = result.ResultedValue;

Please let me know if am doing any step wrong…

---

<div class="post-metadata">

**Author:** ![Ammar](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@Ammar](https://zatca1.discourse.group/u/Ammar)\
**Post date:** [November 16, 2023, 1:32pm UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952/6 "2023-11-16T13:32:12Z")

</div>

No need to hashing xml after signing, because xml is already hashing inside SignDocument function. only extract the hashing from signed xml or you can hashing xml file before signing.

you can see all steps inside SignDocument by clicking on go to definition and you see 8 steps first steps is hashing xml.

---

<div class="post-metadata">

**Author:** ![abdulhaseeb](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@abdulhaseeb](https://zatca1.discourse.group/u/abdulhaseeb)\
**Post date:** [November 25, 2023, 9:47am UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952/7 "2023-11-25T09:47:54Z")

</div>

Thanks for your reply ammar, as you instructed i have just signed the xml and then asigned the ResultedValue in a variable and then did both encoding it to base64 string and getting hash value as shown in the code below

string signedInvoice = result.ResultedValue;  
string encodedsignedInvoicexmltobase64 = Base64Encode(signedInvoice );

System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();  
xdoc.LoadXml(signedInvoice);  
XMLfilenamehash = xdoc.GetElementsByTagName(“ds:DigestValue”)[0].InnerText;

and then when i am sending this values for reporting i am getting below error

{“type”:“ERROR”,“code”:“invalid-invoice-hash”,“category”:“INVOICE\_HASHING\_ERRORS”,“message”:“The invoice hash API body does not match the (calculated) Hash of the XML”,“status”:“ERROR”},

Please guide me to resolve this issues, thanks in advance

---

<div class="post-metadata">

**Author:** ![abdulhaseeb](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@abdulhaseeb](https://zatca1.discourse.group/u/abdulhaseeb)\
**Post date:** [January 4, 2024, 10:59am UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952/8 "2024-01-04T10:59:50Z")

</div>

can u please reply on my below point

Thanks for your reply ammar, as you instructed i have just signed the xml and then asigned the ResultedValue in a variable and then did both encoding it to base64 string and getting hash value as shown in the code below

string signedInvoice = result.ResultedValue;  
string encodedsignedInvoicexmltobase64 = Base64Encode(signedInvoice );

System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();  
xdoc.LoadXml(signedInvoice);  
XMLfilenamehash = xdoc.GetElementsByTagName(“ds:DigestValue”)[0].InnerText;

and then when i am sending this values for reporting i am getting below error

{“type”:“ERROR”,“code”:“invalid-invoice-hash”,“category”:“INVOICE\_HASHING\_ERRORS”,“message”:“The invoice hash API body does not match the (calculated) Hash of the XML”,“status”:“ERROR”},

Please guide me to resolve this issues, thanks in advance

---

<div class="post-metadata">

**Author:** ![Ammar](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@Ammar](https://zatca1.discourse.group/u/Ammar)\
**Post date:** [January 8, 2024, 9:34am UTC](https://zatca1.discourse.group/t/newsigned-xml-is-not-getting-created/952/9 "2024-01-08T09:34:09Z")

</div>

> [@abdulhaseeb](#):
>
> DigestValue

Hi,

You getting this issue because invoice hashing is wrong the xml it’s contain multi “ds:DigestValue” xdoc.GetElementsByTagName(“ds:DigestValue”) you can use node with namespace or you can use the the function in sdk var result = \_IHashingValidator.GenerateEInvoiceHashing(xmlFilePath); to get hashing

xmlFilePath =\> the xml path before you signing
