Wednesday, February 25, 2015

Adding .Net Reference

You can write complicated C# codes in SV Designer. By default only System and System.Code references can be used while wirting your C# methods. Since you are mostly working with XML objects you are going to have to use System.Xml.XmlDocument reference.

When you add using System.Xml; line at the top of your code you are going to get "Xml does not exist in the namespace 'System'" error.



To resolve this error SV has to include System.Xml reference. Making this is pretty easy:

For the SV Designer:
Go to directory [SVDesignerInstallationPath]\HP Service Virtualization Designer\Designer\bin\Config and change following lines of scripted-rule-context.xml file
    <property name="ReferenceAssemblies" value="System,System.Core" />
to
    <property name="ReferenceAssemblies" value="System,System.Core,System.Xml" />

For the SV Server: 
Go to directory [SVDesignerInstallationPath]\HP Service Virtualization Server\Server\bin\Config and change following lines of scripted-rule-context.xml file
    <property name="ReferenceAssemblies" value="System,System.Core" />
to
    <property name="ReferenceAssemblies" value="System,System.Core,System.Xml" />

And restart the SV Server.

No comments: