NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using GetXML with PropertyObject.xsd

Solved!
Go to solution

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?

 

0 Kudos
Message 1 of 3
(3,304 Views)
Solution
Accepted by topic author RagnarE

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.

Manooch H.
National Instruments
0 Kudos
Message 2 of 3
(3,276 Views)

Thank you, I will use the automation library instead..

Ragnar

0 Kudos
Message 3 of 3
(3,257 Views)