08-25-2009 09:46 AM
I am trying to persist a test result by calling a .Net dll at the end of the report. I used the xsd util on PropertyObject.xsd with this signature to generate a proxy object.
Here is the header of the xsd.
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by John Jacobs (VaccineInfo) -->
<!-- Copyright 2003-2004 National Instruments, Corp. -->
<!-- TestStand 3.1 Property Object GetXML Method W3C Schema -->
Here is my dll code:
/// <summary>
/// Saves the UUT for sending to server
/// </summary>
/// <param name="ctx"></param>
public void Save(SequenceContext ctx){
PropertyObject ctxProperty = ctx.AsPropertyObject();string ctxXml = ctxProperty.GetXML(0, 0, "", "");
StringReader sr = new StringReader(ctxXml);XmlSerializer xs = new XmlSerializer(typeof(PropDef));
//PropDef is generated with VS2008 tool xsd.exe /c PropertyObject.xsd, the proxy is attached as PropertyObject.cs
PropDef ctxPropDef = (PropDef)xs.Deserialize(sr);
//This throws an exception:
//An error occurred within the .NET code.
//The .NET method 'Save' threw an exception. .NET exception message shown below:
//Exception has been thrown by the target of an invocation.
//Root Exception:<Prop xmlns=''> was not expected.
//Source: po85nkuh at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPropDef.Read11_Prop()
}
I think the problem might be missing namespace in the returned xml from GetXML. It would be very nice to use the generated proxy. Any hints / suggestions?
Solved! Go to Solution.
08-27-2009 01:46 PM
Ragnar,
Could you please explain your actual goal? I'm not sure I understand why you're using PropertyObject.xsd as opposed to the TestStand Interop Assemblies which provide you with all of the TestStand API.
08-31-2009 04:19 AM
Thank you, I will use the automation library instead..
Ragnar