NewSigned.xml is not getting created

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…

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

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

@abdulhaseeb

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

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…

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.

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

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

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