Invoke Code: No compiled code to run - error CS0234: The type or namespace name 'Xml' does not exist in the namespace 'System.Security.Cryptography' (are you missing an assembly reference?)

Hi all,

I am using invoke code to run a C# code to do the following.

This code takes an incoming SOAP message, ensures it has a proper SOAP body (and creates one if needed), adds or verifies a SOAP header and WS-Security elements, and assigns a unique ID to the body. It then loads an X.509 certificate from a given file and embeds the certificate into the message as a BinarySecurityToken under the WS-Security header. Next, it digitally signs the SOAP body by creating a signature reference to the body ID, applying exclusive canonicalization with specified namespace prefixes, and builds the appropriate KeyInfo, including a SecurityTokenReference that points to the certificate. Finally, it computes the digital signature, appends it to the WS-Security header, and outputs the fully signed SOAP envelope.

Though I have imported all the required namespaces, I get the following error saying - Xml does not exist in the namespace System.Security.Cryptography.

I am using stuido verions 24.10.10

Thanks in advance.

My C# code:
C#SignedSoapRequest.txt (5.1 KB)

Regards
Sundar

Hi @Sundararaman_S1

Check the below thread

Hope it helps!!

@Sundararaman_S1,

Install the package UiPath.Cryptography.Activities

Imports the namespace - System.Security.Cryptography.Xml - through Imports panel

Let me know if anywhere you stuck.

Hi

I imported the required namespace and also installed Cryptography package. It still gives the same error.

Hi

The assembly reference is already present in the xaml. I verified by opening in notepad++.