000033970 - Invalid Cast Exception using a custom transform for a Data Feed in RSA Archer 5.x

Document created by RSA Customer Support Employee on Sep 16, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000033970
Applies ToRSA Product Set: Archer
RSA Product/Service Type: Archer
RSA Version/Condition: 5.X
Platform: Windows
 
Issue
1.  Configure a data feed to use a custom XSLT (transform).
2.  Load Source Fields
3.  Add additional Source Fields manually
4.  Notice when you run the data feed that it fails validation.  Reference below error message for example:
 
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
        <EventID>3</EventID>
        <Type>3</Type>
        <SubType Name="Error">0</SubType>
        <Level>2</Level>
        <TimeCreated SystemTime="2016-08-10T07:04:43.5305065Z" />
        <Source Name="ArcherTech.DataFeed" />
        <Correlation ActivityID="{e5973eb5-1e31-4a62-abde-8166eea1152e}" />
        <Execution ProcessName="ArcherTech.JobFramework.Job" ProcessID="5464" ThreadID="1" />
        <AssemblyVersion>5.5.20103.1001</AssemblyVersion>
        <Channel />
        <Computer>XXXXXXXXX</Computer>
    </System>
    <ApplicationData>
        <TraceData>
            <DataItem>
                <TraceRecord Severity="Error" xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord">
                    <TraceIdentifier>ArcherTech.DataFeed</TraceIdentifier>
                    <Description>Error during execution of channel.</Description>
                    <AppDomain>ArcherTech.JobFramework.Job.exe</AppDomain>
                    <ContextData>
                        <LogReferenceId>081016-070443-4992</LogReferenceId>
                        <DataFeedId>X</DataFeedId>
                        <DataFeedNameXXXXXXXX</DataFeedName>
                        <DataFeedHistoryId>XXXXXXX</DataFeedHistoryId>
                    </ContextData>
                    <Exception>
                        <ExceptionType>System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
                        <Message>Exception has been thrown by the target of an invocation.</Message>
                        <Source>mscorlib</Source>
                        <ContextData>
                            <ChannelName>ArcherTech.DataFeed.Channel.Components.ContentWriterComponent</ChannelName>
                        </ContextData>
                        <StackTrace>   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at ArcherTech.ChannelFramework.Channel.Execute()
   at ArcherTech.DataFeed.ComponentModel.DataFeedChannelActivity.ExecuteInternal()</StackTrace>
                        <InnerException>
                            <ExceptionType>System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
                            <Message>Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.XmlMappingComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.DataFeedTokenExtractionComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.XmlFilterComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.XmlCalculationComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.ChannelFramework.Xml.XmlEntityListComponent' threw the following exception:'Unable to cast object of type 'System.Xml.Schema.XmlSchemaChoice' to type 'System.Xml.Schema.XmlSchemaElement'.'''''</Message>
                            <Source>System</Source>
                            <StackTrace>   at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
   at ArcherTech.ChannelFramework.ComponentOutputBind.GetRuntimeValue(DependencyObject source, DependencyProperty dependencyProperty)
   at ArcherTech.Xaml.DependencyObject.GetValue(DependencyProperty property)
   at ArcherTech.ChannelFramework.ExecuteComponent`1.get_Input()
   at ArcherTech.ChannelFramework.ExecuteComponent`1.ComponentExecute()</StackTrace>
                            <InnerException>
                                <ExceptionType>System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
                                <Message>Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.DataFeedTokenExtractionComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.XmlFilterComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.XmlCalculationComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.ChannelFramework.Xml.XmlEntityListComponent' threw the following exception:'Unable to cast object of type 'System.Xml.Schema.XmlSchemaChoice' to type 'System.Xml.Schema.XmlSchemaElement'.''''</Message>
                                <Source>System</Source>
                                <StackTrace>   at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
   at ArcherTech.ChannelFramework.ComponentOutputBind.GetRuntimeValue(DependencyObject source, DependencyProperty dependencyProperty)
   at ArcherTech.Xaml.DependencyObject.GetValue(DependencyProperty property)
   at ArcherTech.ChannelFramework.DataFlowComponent`2.get_Input()
   at ArcherTech.ChannelFramework.DataFlowComponent`2.get_Output()</StackTrace>
                                <InnerException>
                                    <ExceptionType>System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
                                    <Message>Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.XmlFilterComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.XmlCalculationComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.ChannelFramework.Xml.XmlEntityListComponent' threw the following exception:'Unable to cast object of type 'System.Xml.Schema.XmlSchemaChoice' to type 'System.Xml.Schema.XmlSchemaElement'.'''</Message>
                                    <Source>System</Source>
                                    <StackTrace>   at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
   at ArcherTech.ChannelFramework.ComponentOutputBind.GetRuntimeValue(DependencyObject source, DependencyProperty dependencyProperty)
   at ArcherTech.Xaml.DependencyObject.GetValue(DependencyProperty property)
   at ArcherTech.ChannelFramework.DataFlowComponent`2.get_Input()
   at ArcherTech.ChannelFramework.DataFlowComponent`2.get_Output()</StackTrace>
                                    <InnerException>
                                        <ExceptionType>System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
                                        <Message>Property accessor 'Output' on object 'ArcherTech.DataFeed.Channel.Components.XmlCalculationComponent' threw the following exception:'Property accessor 'Output' on object 'ArcherTech.ChannelFramework.Xml.XmlEntityListComponent' threw the following exception:'Unable to cast object of type 'System.Xml.Schema.XmlSchemaChoice' to type 'System.Xml.Schema.XmlSchemaElement'.''</Message>
                                        <Source>System</Source>
                                        <StackTrace>   at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
   at ArcherTech.ChannelFramework.ComponentOutputBind.GetRuntimeValue(DependencyObject source, DependencyProperty dependencyProperty)
   at ArcherTech.Xaml.DependencyObject.GetValue(DependencyProperty property)
   at ArcherTech.ChannelFramework.DataFlowComponent`2.get_Input()
   at ArcherTech.ChannelFramework.DataFlowComponent`2.get_Output()</StackTrace>
                                        <InnerException>
                                            <ExceptionType>System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
                                            <Message>Property accessor 'Output' on object 'ArcherTech.ChannelFramework.Xml.XmlEntityListComponent' threw the following exception:'Unable to cast object of type 'System.Xml.Schema.XmlSchemaChoice' to type 'System.Xml.Schema.XmlSchemaElement'.'</Message>
                                            <Source>System</Source>
                                            <StackTrace>   at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
   at ArcherTech.ChannelFramework.ComponentOutputBind.GetRuntimeValue(DependencyObject source, DependencyProperty dependencyProperty)
   at ArcherTech.Xaml.DependencyObject.GetValue(DependencyProperty property)
   at ArcherTech.ChannelFramework.DataFlowComponent`2.get_Input()
   at ArcherTech.ChannelFramework.DataFlowComponent`2.get_Output()</StackTrace>
                                            <InnerException>
                                                <ExceptionType>System.InvalidCastException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
                                                <Message>Unable to cast object of type 'System.Xml.Schema.XmlSchemaChoice' to type 'System.Xml.Schema.XmlSchemaElement'.</Message>
                                                <Source>System.Core</Source>
                                                <StackTrace>   at System.Linq.Enumerable.&lt;CastIterator&gt;d__94`1.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.&lt;ConcatIterator&gt;d__58`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at ArcherTech.ChannelFramework.Xml.XmlEntityMetadataBuilder.ProcessStandardComplexType(IEnumerable`1 elements2, XmlSchemaComplexType complexType, XmlSchemaKey key, IEnumerable`1 keyRefs)
   at ArcherTech.ChannelFramework.Xml.XmlEntityMetadataBuilder.ProcessElement(IEnumerable`1 elements2, IEnumerable`1 parentKeys, IEnumerable`1 parentKeyRefs)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.&lt;ConcatIterator&gt;d__58`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at ArcherTech.ChannelFramework.Xml.XmlEntityMetadataBuilder.ProcessStandardComplexType(IEnumerable`1 elements2, XmlSchemaComplexType complexType, XmlSchemaKey key, IEnumerable`1 keyRefs)
   at ArcherTech.ChannelFramework.Xml.XmlEntityMetadataBuilder.ProcessElement(IEnumerable`1 elements2, IEnumerable`1 parentKeys, IEnumerable`1 parentKeyRefs)
   at ArcherTech.ChannelFramework.Xml.XmlEntityMetadataBuilder.ProcessSchemaSet(XmlSchemaSet schemaSet, Boolean withRoot)
   at ArcherTech.DataFeed.Channel.Components.DataFeedMetadataConverter.ConvertValue(DependencyObject source, DependencyProperty dependencyProperty)
   at ArcherTech.Xaml.TypeConverterBase`2.GetRuntimeValue(DependencyObject source, DependencyProperty dependencyProperty)
   at ArcherTech.Xaml.DependencyObject.GetValue(DependencyProperty property)
   at ArcherTech.ChannelFramework.Xml.XmlEntityListComponent.get_MetaData()
   at ArcherTech.ChannelFramework.Xml.XmlEntityListComponent.Initialize()
   at ArcherTech.ChannelFramework.DataFlowComponent`2.get_Output()</StackTrace>
                                            </InnerException>
                                        </InnerException>
                                    </InnerException>
                                </InnerException>
                            </InnerException>
                        </InnerException>
                    </Exception>
                </TraceRecord>
            </DataItem>
        </TraceData>
    </ApplicationData>
</E2ETraceEvent>

CauseThis is a known bug with the Data Feed Manager component.  Reference is ARCHER-25015.  There are several key things that have to occur to run into this issue:
1.  A custom XSLT (transform must be used)
2.  After Loading Source fields,  additional Source fields are manually added
This causes the .dfx5 file that defines the data feed to be constructed incorrectly. 
ResolutionA workaround must currently be implemented until this is fixed by a future code release.
Workaround1.  Open the DFX file with Notepad++ (or similar editor) and you will see that there is a field outside the closing </xs:choice> tag.  (Simply search for "choice").
2.  If you move the closing tag after the last field, the data feed will run without error.
Here is an example of a BAD Schema in the .dfx5 file (the bad element is highlighted):
 
&lt;xs:element minOccurs="0" name="exploitability_ease" type="xs:string" nillable="true" c:Name="exploitability_ease" /&gt;
                &lt;xs:element minOccurs="0" name="exploit_available" type="xs:string" nillable="true" c:Name="exploit_available" /&gt;
              &lt;/xs:choice&gt;
     &lt;xs:element name="NewSourceName" nillable="true" c:Name="static" c:Calculation="=STATIC(&amp;quot;static&amp;quot;)" dfm:SimpleFieldType="StaticText" /&gt;
            &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
        &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
&lt;/xs:schema&gt;
&lt;/Schemas&gt;</Schema>                  


This element needs to be moved back into node. 
Here is an example of a GOOD Schema:
&lt;xs:sequence&gt;
                      &lt;xs:element minOccurs="0" name="Item" type="xs:string" nillable="true" c:Name="Item" /&gt;
                    &lt;/xs:sequence&gt;
                  &lt;/xs:complexType&gt;
                &lt;/xs:element&gt;
                &lt;xs:element minOccurs="0" name="exploitability_ease" type="xs:string" nillable="true" c:Name="exploitability_ease" /&gt;
                &lt;xs:element minOccurs="0" name="exploit_available" type="xs:string" nillable="true" c:Name="exploit_available" /&gt;
    &lt;xs:element name="NewSourceName" nillable="true" c:Name="static" c:Calculation="=STATIC(&amp;quot;static&amp;quot;)" dfm:SimpleFieldType="StaticText" /&gt;
              &lt;/xs:choice&gt;
            &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
        &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
&lt;/xs:schema&gt;
&lt;/Schemas&gt;</Schema>


Notice how the "NewSourceName" element has been moved into the confines of the node.
 

Attachments

    Outcomes