WF4 WCF Correlation and MessageContract not working - wcf

I have a WF4 WCF service that i am trying to get correlation to work using Content based through the soap message.
I am getting the following error message:
<Message>A correlation query yielded an empty result set. Please ensure correlation queries for the endpoint are correctly configured.</Message>
<StackTrace><![CDATA[at System.ServiceModel.Activities.Dispatcher.CorrelationKeyCalculator.Calculator`1.CalculateKeys(T target, Message messageToReadHeaders, InstanceKey& instanceKey, ICollection`1& additionalKeys)
at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.GetInstanceKeys(OperationContext operationContext, InstanceKey& instanceKey, ICollection`1& additionalKeys)
at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.ControlOperationAsyncResult.EnsureInstanceId()
at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.ControlOperationAsyncResult.Process()
at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.ControlOperationAsyncResult..ctor(ControlOperationInvoker invoker, Object[] inputs, IInvokeReceivedNotification notification, TimeSpan timeout, AsyncCallback callback, Object state)
at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.InvokeBegin(Object instance, Object[] inputs, IInvokeReceivedNotification notification, AsyncCallback callback, Object state)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)]]></StackTrace>
here is my class
[MessageContract(IsWrapped = false)]
public class ClaimObj
{
[MessageHeader]
public string CorrelationId { get; set; }
[MessageBodyMember]
public string InstanceId { get; set; }
}
here is my xaml with the namespaces changed for proprietary reasons
<Activity mc:Ignorable="sap" x:Class="Project.WorkFlow.Activities.Activity4" sap:VirtualizedContainerService.HintSize="654,676" mva:VisualBasic.Settings="Assembly references and imported namespaces for internal implementation" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:p="http://ns.ns2.com/" xmlns:p1="http://schemas.microsoft.com/netfx/2009/xaml/servicemodel" xmlns:qm="clr-namespace:Project.MessageWrappers;assembly=Project.MessageWrappers" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:ssa="clr-namespace:System.ServiceModel.Activities;assembly=System.ServiceModel.Activities" xmlns:ssx="clr-namespace:System.ServiceModel.XamlIntegration;assembly=System.ServiceModel" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Flowchart sad:XamlDebuggerXmlReader.FileName="D:\Activity4.xaml" sap:VirtualizedContainerService.HintSize="614,636">
<Flowchart.Variables>
<Variable x:TypeArguments="qm:ClaimObj" Name="RequestObj" />
<Variable x:TypeArguments="p1:CorrelationHandle" Name="handle" />
</Flowchart.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">False</x:Boolean>
<av:Point x:Key="ShapeLocation">270,2.5</av:Point>
<av:Size x:Key="ShapeSize">60,75</av:Size>
<av:PointCollection x:Key="ConnectorLocation">300,77.5 300,107.5 290,107.5 290,115</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Flowchart.StartNode>
<FlowStep x:Name="__ReferenceID1">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">162.5,115</av:Point>
<av:Size x:Key="ShapeSize">255,90</av:Size>
<av:PointCollection x:Key="ConnectorLocation">290,205 290,235</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<p1:Receive x:Name="__ReferenceID0" CanCreateInstance="True" CorrelatesWith="[handle]" sap:VirtualizedContainerService.HintSize="255,90" OperationName="Process" ServiceContractName="p:IActivity4Service">
<p1:Receive.CorrelatesOn>
<p1:XPathMessageQuery x:Key="key1">
<p1:XPathMessageQuery.Namespaces>
<ssx:XPathMessageContextMarkup>
<x:String x:Key="xg0">http://schemas.datacontract.org/2004/07/Project.MessageWrappers</x:String>
</ssx:XPathMessageContextMarkup>
</p1:XPathMessageQuery.Namespaces>sm:header()/tempuri:CorrelationId</p1:XPathMessageQuery>
</p1:Receive.CorrelatesOn>
<p1:ReceiveMessageContent DeclaredMessageType="qm:ClaimObj">
<OutArgument x:TypeArguments="qm:ClaimObj">[RequestObj]</OutArgument>
</p1:ReceiveMessageContent>
</p1:Receive>
<FlowStep.Next>
<FlowStep x:Name="__ReferenceID2">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">162.5,235</av:Point>
<av:Size x:Key="ShapeSize">255,90</av:Size>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<p1:SendReply Request="{x:Reference __ReferenceID0}" DisplayName="SendReplyToReceive" sap:VirtualizedContainerService.HintSize="255,90">
<p1:SendMessageContent DeclaredMessageType="qm:ClaimObj">
<InArgument x:TypeArguments="qm:ClaimObj">[RequestObj]</InArgument>
</p1:SendMessageContent>
</p1:SendReply>
</FlowStep>
</FlowStep.Next>
</FlowStep>
</Flowchart.StartNode>
<x:Reference>__ReferenceID1</x:Reference>
<x:Reference>__ReferenceID2</x:Reference>
I know the issue is with my xpath for the correlation. I have tried many different ideas and the only one that works is 11445 (http://msdn.microsoft.com/en-us/library/ee358742.aspx), but that doesn't give me the tracking with correlation. These don't work
sm:body()/xg0:ClaimObj/xg0:CorrelationId
sm:header()/tempuri:CorrelationId
sm:header()/xg0:ClaimObj/xg0:CorrelationId
sm:header()/tempuri:ClaimObj/tempuri:CorrelationId
I can get it to work with DataContracts just fine, but i need to use MessageContracts
UPDATE:
Here is what i really need to do:
Receive request
send a one way wcf call to Server X
(2nd receive) Server X sends back to workflow in a new wcf call with correlation id, not a reply
do some other stuff
send reply to original receive
Here is the basic workflow I am trying to get working. The issue is that the 2nd receive is not being called due to the xpath not being found.
on a side note, i get the same issue when i try to use correlationinitializer in the first receive
<Activity mc:Ignorable="sap" x:Class="Project.WorkFlow.Activities.Activity4" sap:VirtualizedContainerService.HintSize="828,872" mva:VisualBasic.Settings="Assembly references and imported namespaces for internal implementation" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:p="http://ns.domain.com/" xmlns:p1="http://schemas.microsoft.com/netfx/2009/xaml/servicemodel" xmlns:qm="clr-namespace:Project.MessageWrappers;assembly=Project.MessageWrappers" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:ssa="clr-namespace:System.ServiceModel.Activities;assembly=System.ServiceModel.Activities" xmlns:ssx="clr-namespace:System.ServiceModel.XamlIntegration;assembly=System.ServiceModel" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Flowchart sad:XamlDebuggerXmlReader.FileName="D:\Activity4.xaml" sap:VirtualizedContainerService.HintSize="788,832">
<Flowchart.Variables>
<Variable x:TypeArguments="qm:ClaimObj" Name="RequestObj" />
<Variable x:TypeArguments="p1:CorrelationHandle" Name="handle" />
<Variable x:TypeArguments="qm:GetClaimObj" Name="GetClaimIn" />
</Flowchart.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">False</x:Boolean>
<av:Point x:Key="ShapeLocation">270,2.5</av:Point>
<av:Size x:Key="ShapeSize">60,75</av:Size>
<av:PointCollection x:Key="ConnectorLocation">300,77.5 300,107.5 290,107.5 290,115</av:PointCollection>
<x:Double x:Key="Width">773.5</x:Double>
<x:Double x:Key="Height">796.04</x:Double>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Flowchart.StartNode>
<FlowStep x:Name="__ReferenceID1">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">162.5,115</av:Point>
<av:Size x:Key="ShapeSize">255,90</av:Size>
<av:PointCollection x:Key="ConnectorLocation">290,205 290,209 241,209 241,239</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<p1:Receive x:Name="__ReferenceID0" CanCreateInstance="True" CorrelatesWith="[handle]" sap:VirtualizedContainerService.HintSize="255,90" OperationName="Process" ServiceContractName="p:IActivity4Service">
<p1:Receive.KnownTypes>
<x:Type Type="qm:ClaimObj" />
</p1:Receive.KnownTypes>
<p1:ReceiveMessageContent DeclaredMessageType="qm:ClaimObj">
<OutArgument x:TypeArguments="qm:ClaimObj">[RequestObj]</OutArgument>
</p1:ReceiveMessageContent>
</p1:Receive>
<FlowStep.Next>
<FlowStep x:Name="__ReferenceID2">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">120,239</av:Point>
<av:Size x:Key="ShapeSize">242,93</av:Size>
<av:PointCollection x:Key="ConnectorLocation">241,332 240,332 240,355</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<p1:InitializeCorrelation Correlation="[handle]" sap:VirtualizedContainerService.HintSize="242,93">
<InArgument x:TypeArguments="x:String" x:Key="key1">[RequestObj.CorrelationId]</InArgument>
</p1:InitializeCorrelation>
<FlowStep.Next>
<FlowStep x:Name="__ReferenceID3">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">112.5,355</av:Point>
<av:Size x:Key="ShapeSize">255,90</av:Size>
<av:PointCollection x:Key="ConnectorLocation">240,445 240,475 241,475 241,479</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<p1:Receive CorrelatesWith="[handle]" sap:VirtualizedContainerService.HintSize="255,90" OperationName="GetClaim" ServiceContractName="p:IActivity4Service">
<p1:Receive.CorrelatesOn>
<p1:XPathMessageQuery x:Key="key1">
<p1:XPathMessageQuery.Namespaces>
<ssx:XPathMessageContextMarkup>
<x:String x:Key="xg0">http://schemas.datacontract.org/2004/07/Project.MessageWrappers</x:String>
</ssx:XPathMessageContextMarkup>
</p1:XPathMessageQuery.Namespaces>sm:header()/xg0:CorrelationId</p1:XPathMessageQuery>
</p1:Receive.CorrelatesOn>
<p1:ReceiveMessageContent DeclaredMessageType="qm:GetClaimObj">
<OutArgument x:TypeArguments="qm:GetClaimObj">[GetClaimIn]</OutArgument>
</p1:ReceiveMessageContent>
</p1:Receive>
<FlowStep.Next>
<FlowStep x:Name="__ReferenceID4">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">120,479</av:Point>
<av:Size x:Key="ShapeSize">242,58</av:Size>
<av:PointCollection x:Key="ConnectorLocation">241,537 240,537 240,565</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign sap:VirtualizedContainerService.HintSize="242,58">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[GetClaimIn.InstanceId]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">Get is called</InArgument>
</Assign.Value>
</Assign>
<FlowStep.Next>
<FlowStep x:Name="__ReferenceID5">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">112.5,565</av:Point>
<av:Size x:Key="ShapeSize">255,90</av:Size>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<p1:SendReply Request="{x:Reference __ReferenceID0}" DisplayName="SendReplyToReceive" sap:VirtualizedContainerService.HintSize="255,90">
<p1:SendMessageContent DeclaredMessageType="qm:GetClaimObj">
<InArgument x:TypeArguments="qm:GetClaimObj">[GetClaimIn]</InArgument>
</p1:SendMessageContent>
</p1:SendReply>
</FlowStep>
</FlowStep.Next>
</FlowStep>
</FlowStep.Next>
</FlowStep>
</FlowStep.Next>
</FlowStep>
</FlowStep.Next>
</FlowStep>
</Flowchart.StartNode>
<x:Reference>__ReferenceID1</x:Reference>
<x:Reference>__ReferenceID2</x:Reference>
<x:Reference>__ReferenceID3</x:Reference>
<x:Reference>__ReferenceID4</x:Reference>
<x:Reference>__ReferenceID5</x:Reference>

I am missing the CorrelationInitializers in your XAML. The CorrelationInitializers is used to create a correlation on the Receive or SendReply activity with the original request. After that the CorrelatesOn is used in subsequent Receive activities.

I just ran into the same problem and the article you linked to actually helped me resolve it. About 3/4 of the way down the page, there is a paragraph that reads...
If an XPath query is configured incorrectly such that no correlation
data is retrieved, a fault is returned with the following message: "A
correlation query yielded an empty result set. Please ensure
correlation queries for the endpoint are correctly configured." One
quick way to troubleshoot this is to replace the XPath query with a
literal value as described in the previous section. This issue can
occur if you use the XPath query builder in the Add Correlation
Initializers or CorrelatesOn Definition dialog boxes and your workflow
service uses message contracts.
The dialog box always generates queries that target message body properties, even when the property you select is part of the message header. The correct query to access a header property is:
sm:header()/namespace:property
Note that the property name is not qualified by the containing object, so the following query should work for you:
sm:header()/tempuri:CorrelationId
If you'd like to change the namespace of the header property, use the Namespace property of the MessageHeaderAttribute class.

Related

Rendering XAML to image/pdf/word

Let's say I have this XAML file:
<Activity mc:Ignorable="sap sap2010" x:Class="Main" mva:VisualBasic.Settings="{x:Null}" sap:VirtualizedContainerService.HintSize="896,428" sap2010:WorkflowViewState.IdRef="ActivityBuilder_1" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextExpression.NamespacesForImplementation>
<scg:List x:TypeArguments="x:String" Capacity="23">
<x:String>System.Activities</x:String>
<x:String>System.Activities.Statements</x:String>
<x:String>System.Activities.Expressions</x:String>
<x:String>System.Activities.Validation</x:String>
<x:String>System.Activities.XamlIntegration</x:String>
<x:String>Microsoft.VisualBasic</x:String>
<x:String>Microsoft.VisualBasic.Activities</x:String>
<x:String>System</x:String>
<x:String>System.Collections</x:String>
<x:String>System.Collections.Generic</x:String>
<x:String>System.Data</x:String>
<x:String>System.Diagnostics</x:String>
<x:String>System.Drawing</x:String>
<x:String>System.IO</x:String>
<x:String>System.Linq</x:String>
<x:String>System.Net.Mail</x:String>
<x:String>System.Xml</x:String>
<x:String>System.Xml.Linq</x:String>
<x:String>UiPath.Core</x:String>
<x:String>UiPath.Core.Activities</x:String>
<x:String>System.Windows.Markup</x:String>
<x:String>System.Collections.ObjectModel</x:String>
<x:String>System.Activities.DynamicUpdate</x:String>
</scg:List>
</TextExpression.NamespacesForImplementation>
<TextExpression.ReferencesForImplementation>
<scg:List x:TypeArguments="AssemblyReference" Capacity="16">
<AssemblyReference>System.Activities</AssemblyReference>
<AssemblyReference>Microsoft.VisualBasic</AssemblyReference>
<AssemblyReference>mscorlib</AssemblyReference>
<AssemblyReference>System.Data</AssemblyReference>
<AssemblyReference>System</AssemblyReference>
<AssemblyReference>System.Drawing</AssemblyReference>
<AssemblyReference>System.Core</AssemblyReference>
<AssemblyReference>System.Xml</AssemblyReference>
<AssemblyReference>System.Xml.Linq</AssemblyReference>
<AssemblyReference>PresentationFramework</AssemblyReference>
<AssemblyReference>WindowsBase</AssemblyReference>
<AssemblyReference>PresentationCore</AssemblyReference>
<AssemblyReference>System.Xaml</AssemblyReference>
<AssemblyReference>UiPath.System.Activities</AssemblyReference>
<AssemblyReference>UiPath.UiAutomation.Activities</AssemblyReference>
<AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>
</scg:List>
</TextExpression.ReferencesForImplementation>
<Sequence sap:VirtualizedContainerService.HintSize="304,152.8" sap2010:WorkflowViewState.IdRef="Sequence_1">
<Sequence.Variables>
<Variable x:TypeArguments="x:String" Name="stringTest" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign sap:VirtualizedContainerService.HintSize="262.4,60" sap2010:WorkflowViewState.IdRef="Assign_1">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[stringTest]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">3</InArgument>
</Assign.Value>
</Assign>
</Sequence>
</Activity>
Can anyone tell me please what I should do in order to get an image/pdf/word from this?
I expect a result similar the one you can see in the picture.
I swear I checked the previous posts but they are talking about WPF xaml and not XAML of activities.
Thank you
Lior
You need to open the XAML file with UiPath Studio, which will render that in the format as per your image.
You haven't said where/which application you are opening the file with, but I suspect you might have the file association for XAML set to some other program (such as Visual Studio).

Configure ActiveMQ Artemis in WildFly 12 to use a PostgreSQL datastore

I have configured my WildFly 12 instance with a PostgreSQL datastore to use as the journal datastore for ActiveMQ Artemis. However, when WildFly starts up I get the following error:
AMQ222010: Critical IO Error, shutting down the server. file=org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFile#35d3d246, message=Error attempting to open JDBC file.: org.postgresql.util.PSQLException: ERROR: column "data" is of type oid but expression is of type bytea
Hint: You will need to rewrite or cast the expression.
Any idea what I might be doing wrong? My datasource definition is:
<datasource jta="true" jndi-name="java:jboss/datasources/ActiveMQ-DS" pool-name="ActiveMQ-DS" enabled="true" use-ccm="true" spy="false">
<connection-url>jdbc:postgresql://localhost/activemq</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgresql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>16</max-pool-size>
</pool>
<security>
<user-name>amq</user-name>
<password>amq</password>
</security>
<validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<background-validation-millis>300000</background-validation-millis>
</validation>
<statement>
<prepared-statement-cache-size>0</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
<timeout>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
</datasource>
Here is my messaging-activemq subsystem configuration:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:3.0">
<server name="default">
<journal datasource="ActiveMQ-DS" />
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<http-connector name="http-connector" socket-binding="jms-virtual" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="jms-virtual" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-topic name="VideoVaultSync" entries="jms/topic/VideoVaultSync"/>
<jms-topic name="VICADS-DeviceAlarm" entries="jms/topic/VICADS-DeviceAlarm"/>
<jms-topic name="VICADS-VideoAlarm" entries="jms/topic/VICADS-VideoAlarm java:jboss/exported/jms/topic/VICADS-VideoAlarm"/>
<jms-topic name="VICADS-RadarTarget" entries="jms/topic/VICADS-RadarTarget java:jboss/exported/jms/topic/VICADS-RadarTarget"/>
<jms-topic name="VICADS-AnnunciatorAlarm" entries="jms/topic/VICADS-AnnunciatorAlarm"/>
<jms-topic name="VICADS-Admin" entries="jms/topic/VICADS-Admin java:jboss/exported/jms/topic/VICADS-Admin"/>
<jms-topic name="VICADS-VideoSvc" entries="jms/topic/VICADS-VideoSvc java:jboss/exported/jms/topic/VICADS-VideoSvc"/>
<jms-topic name="VideoVault-SceneAuthentication" entries="jms/topic/VideoVault-SceneAuthentication java:jboss/exported/jms/topic/VideoVault-SceneAuthentication"/>
<jms-topic name="VICADS-Geometry" entries="jms/topic/VICADS-Geometry java:jboss/exported/jms/topic/VICADS-Geometry"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>

XACML Bags operations

Assume we have a bag of booleans. Is there a function that can tell whether the number of "true" values is larger than some constant (e.g., 5)?
I came across "n-of" function, but it requires multiple separate attributes as an input and not a bag... Maybe "map" function can help, but not sure how since I didn't find a function that can reduce the number of items in a bag.
Thanks!
Michael.
To achieve what you are looking for, you need to use two functions:
a function that measures the size of the bag e.g. booleanBagSize(someAttribute)
a functiont that checks that each value of the bag is equal to true. e.g. booleanEquals used in conjunction with a higher-order function e.g. AllOf
The resulting code in ALFA would be:
namespace axiomatics{
attribute allowed{
category = subjectCat
id = "axiomatics.allowed"
type = boolean
}
policy allowIf5True{
apply firstApplicable
rule allow{
permit
condition booleanBagSize(allowed)>5 && allOf(function[booleanEqual], true, allowed)
}
}
}
And the XACML 3.0 output would be
<?xml version="1.0" encoding="UTF-8"?>
<!--This file was generated by the ALFA Plugin for Eclipse from Axiomatics AB (http://www.axiomatics.com).
Any modification to this file will be lost upon recompilation of the source ALFA file-->
<xacml3:Policy xmlns:xacml3="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
PolicyId="http://axiomatics.com/alfa/identifier/axiomatics.allowIf5True"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable"
Version="1.0">
<xacml3:Description />
<xacml3:PolicyDefaults>
<xacml3:XPathVersion>http://www.w3.org/TR/1999/REC-xpath-19991116</xacml3:XPathVersion>
</xacml3:PolicyDefaults>
<xacml3:Target />
<xacml3:Rule
Effect="Permit"
RuleId="http://axiomatics.com/alfa/identifier/axiomatics.allowIf5True.allow">
<xacml3:Description />
<xacml3:Target />
<xacml3:Condition>
<xacml3:Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
<xacml3:Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">
<xacml3:Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-bag-size" >
<xacml3:AttributeDesignator
AttributeId="axiomatics.allowed"
DataType="http://www.w3.org/2001/XMLSchema#boolean"
Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
MustBePresent="false"
/>
</xacml3:Apply>
<xacml3:AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#integer">5</xacml3:AttributeValue>
</xacml3:Apply>
<xacml3:Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:all-of" >
<xacml3:Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal"/>
<xacml3:AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#boolean">true</xacml3:AttributeValue>
<xacml3:AttributeDesignator
AttributeId="axiomatics.allowed"
DataType="http://www.w3.org/2001/XMLSchema#boolean"
Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
MustBePresent="false"
/>
</xacml3:Apply>
</xacml3:Apply>
</xacml3:Condition>
</xacml3:Rule>
</xacml3:Policy>
This approach only works if the bag only contains true values.

Sitecore custom index configure languages

I created a custom Lucene index in a Sitecore 8.1 environment like this:
<?xml version="1.0"?>
<configuration xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="Products_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
<param desc="name">$(id)</param>
<param desc="folder">$(id)</param>
<param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
<configuration ref="contentSearch/indexConfigurations/ProductIndexConfiguration" />
<strategies hint="list:AddStrategy">
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" />
</strategies>
<commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch">
<policies hint="list:AddCommitPolicy">
<policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" />
</policies>
</commitPolicyExecutor>
<locations hint="list:AddCrawler">
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>master</Database>
<Root>/sitecore/content/General/Product Repository</Root>
</crawler>
</locations>
<enableItemLanguageFallback>false</enableItemLanguageFallback>
<enableFieldLanguageFallback>false</enableFieldLanguageFallback>
</index>
</indexes>
</configuration>
<indexConfigurations>
<ProductIndexConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<initializeOnAdd>true</initializeOnAdd>
<analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer" />
<documentBuilderType>Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilder, Sitecore.ContentSearch.LuceneProvider</documentBuilderType>
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="_uniqueid" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
<field fieldName="key" storageType="YES" indexType="UNTOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider"/>
</fieldNames>
</fieldMap>
<documentOptions type="Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilderOptions, Sitecore.ContentSearch.LuceneProvider">
<indexAllFields>true</indexAllFields>
<include hint="list:AddIncludedTemplate">
<Product>{843B9598-318D-4AFA-B8C8-07E3DF5C6738}</Product>
</include>
</documentOptions>
<fieldReaders ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/fieldReaders"/>
<indexFieldStorageValueFormatter ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexFieldStorageValueFormatter"/>
<indexDocumentPropertyMapper ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexDocumentPropertyMapper"/>
</ProductIndexConfiguration>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
Actually a quite straightforward index that points to a root, includes a template and stores a field. It all works. But I need something extra:
Limit the entries in the index to the latest version
Limit the entries in the index to one language (English)
I know this can be easily triggered in the query as well, but I want to get my indexes smaller so they will (re)build faster.
The first one could be solved by indexing web instead of master, but I actually also want the unpublished ones in this case. I'm quite sure I will need a custom crawler for this.
The second one (limit the languages) is actually more important as I will also need this in other indexes. The easy answer is probably also to use a custom crawler but I was hoping there would be a way to configure this without custom code. Is it possible to configure an custom index to only include a defined set of languages (one or more) instead of all?
After some research I came to the conclusion that to match all the requirements a custom crawler was the only solution. Blogged the code: http://ggullentops.blogspot.be/2016/10/custom-sitecore-index-crawler.html
The main reason was that we really had to be able to set this per index - which is not possible with the filter approach. Also, when we added a new version the previous version had to be deleted from the index - also not possible without the crawler...
There is quite some code so I won't copy it all here but we had to override the DoAdd and DoUpdate methods of the SitecoreItemCrawler, and for the languages we also had to make a small override of the Update method.
You can easily create a custom processor that will let you filter what you want:
namespace Sitecore.Custom
{
public class CustomInboundIndexFilter : InboundIndexFilterProcessor
{
public override void Process(InboundIndexFilterArgs args)
{
var item = args.IndexableToIndex as SitecoreIndexableItem;
var language = Sitecore.Data.Managers.LanguageManager.GetLanguage("en");
if (item != null && (!item.Item.Versions.IsLatestVersion() || item.Item.Language == language))
{
args.IsExcluded = true;
}
}
}
}
And add this processor into the config:
<pipelines>
<indexing.filterIndex.inbound>
<processor type="Sitecore.Custom.CustomInboundIndexFilter, Sitecore.Custom"></processor>
</indexing.filterIndex.inbound>
</pipelines>

WF4 RC - Cannot create unknown type when loading WF Service from loose Xaml with ActivityXamlServices

I am trying to host a WF4 (RC) Service dynamically. I have a test solution with two projects. The first is a declarative workflow service library with one root Flowchart activity in it, and a simple custom code activity. The workflow service library does not depend on any other custom assemblies or references. The second is my host app, which in my test solution is just a console application.
In my host app, I am attempting to the use ActivityXamlServices to load the Xaml for the workflow service into an activity, and then use the WorkflowServiceHost to fire up a workflow instance using that activity.
As soon as I try to new up the WorkflowServiceHost object, I get this exception...
Cannot create unknown type
'{clr-namespace:DeclarativeServiceLibrary1}CodeActivity1'.
If I remove CodeActivity1 from my Flowchart designer, everything runs fine. If I add a direct reference to the workflow service project from my host project and then create a WorkflowServiceHost using an instance of my Flowchart activity instead of the activity created from the Xaml, it also works fine.
It seems to not like using my CodeActivity for some reason when loaded dynamically.
Anyone have any ideas as to why I can't dynamically create my workflow service?
My code is as follows...
DeclarativeServiceLibrary1.Activity1.xaml...
<Activity mc:Ignorable="sap" x:Class="DeclarativeServiceLibrary1.Activity1" sap:VirtualizedContainerService.HintSize="654,676" mva:VisualBasic.Settings="Assembly references and imported namespaces for internal implementation" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-namespace:DeclarativeServiceLibrary1" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:p="http://schemas.microsoft.com/netfx/2009/xaml/servicemodel" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Flowchart sad:XamlDebuggerXmlReader.FileName="C:\dev\test\MyWorkflow\DeclarativeServiceLibrary1\Activity1.xaml" sap:VirtualizedContainerService.HintSize="614,636">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">False</x:Boolean>
<av:Point x:Key="ShapeLocation">270,2.5</av:Point>
<av:Size x:Key="ShapeSize">60,75</av:Size>
<av:PointCollection x:Key="ConnectorLocation">300,77.5 300,107.5 300,165</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Flowchart.StartNode>
<FlowStep x:Name="__ReferenceID0">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">172.5,165</av:Point>
<av:Size x:Key="ShapeSize">255,90</av:Size>
<av:PointCollection x:Key="ConnectorLocation">300,255 300,285 300,299.5</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<p:Receive CanCreateInstance="True" sap:VirtualizedContainerService.HintSize="255,90" OperationName="MyOperation" ServiceContractName="MyContractName" />
<FlowStep.Next>
<FlowStep x:Name="__ReferenceID1">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">194.5,299.5</av:Point>
<av:Size x:Key="ShapeSize">211,61</av:Size>
<av:PointCollection x:Key="ConnectorLocation">300,360.5 300,390.5 300,399</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<WriteLine sap:VirtualizedContainerService.HintSize="211,61" Text="Workflow started" />
<FlowStep.Next>
<FlowStep x:Name="__ReferenceID3">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">200,399</av:Point>
<av:Size x:Key="ShapeSize">200,22</av:Size>
<av:PointCollection x:Key="ConnectorLocation">300,421 300,451 300,479.5</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<local:CodeActivity1 sap:VirtualizedContainerService.HintSize="200,22" />
<FlowStep.Next>
<FlowStep x:Name="__ReferenceID2">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">194.5,479.5</av:Point>
<av:Size x:Key="ShapeSize">211,61</av:Size>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<WriteLine sap:VirtualizedContainerService.HintSize="211,61" Text="The code activity worked!" />
</FlowStep>
</FlowStep.Next>
</FlowStep>
</FlowStep.Next>
</FlowStep>
</FlowStep.Next>
</FlowStep>
</Flowchart.StartNode>
<x:Reference>__ReferenceID0</x:Reference>
<x:Reference>__ReferenceID1</x:Reference>
<x:Reference>__ReferenceID2</x:Reference>
<x:Reference>__ReferenceID3</x:Reference>
</Flowchart>
</Activity>
DeclarativeServiceLibrary1.CodeActivity1.cs ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
namespace DeclarativeServiceLibrary1
{
public sealed class CodeActivity1 : CodeActivity
{
// Define an activity input argument of type string
//public InArgument<string> Text { get; set; }
// If your activity returns a value, derive from CodeActivity<TResult>
// and return the value from the Execute method.
protected override void Execute(CodeActivityContext context)
{
// Obtain the runtime value of the Text input argument
//string text = context.GetValue(this.Text);
}
}
}
DeclarativeServiceLibrary1.Web.Config ...
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
ConsoleApplication1.Program.cs ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.Activities.XamlIntegration;
using System.ServiceModel;
using System.ServiceModel.Activities;
using System.ServiceModel.Description;
using System.Xaml;
using System.Reflection;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string baseAddress = #"http://localhost:8081/MyContractName";
string curDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string wfDefPath = Path.Combine(curDir, "Activity1.xaml");
Activity workflowActivity = (Activity)ActivityXamlServices.Load(wfDefPath);
WorkflowService service = new WorkflowService { Body = workflowActivity };
Uri serviceUri = new Uri(baseAddress, UriKind.Absolute);
WorkflowServiceHost host = new WorkflowServiceHost(service, new Uri[] { serviceUri });
host.Open();
//Display that we are listening on the console window
Console.WriteLine("Workflow '{0}' is listening at '{1}'", host.Activity.DisplayName, baseAddress);
Console.ReadLine();
}
}
}
I have a post-build event in the delarative workflow service library that copies the Assembly and Xaml file into the bin\debug\ folder of the host console app.
Short answer - Xaml load can't infer the local (default) assembly, so you need to specify it on XamlReaderSettings.LocalAssembly.
Open source code of the activity.
Change "xmlns:local="clr-namespace:DeclarativeServiceLibrary1" to
xmlns:local="clr-namespace:DeclarativeServiceLibrary1;assembly=DeclarativeServiceLibrary1".
You're deserializing the xaml file directly, but it is referencing a type (CodeActivity1) that is compiled as a CLR type into the DeclarativeServiceLibrary1 assembly. The most obvious answer is that the DeclarativeServiceLibrary1 assembly is not available to the console app at runtime. Make sure that this assembly is copied into the folder where you are running the console app (\bin\debug) and see if that makes a difference.
The bottom line is that even though you are reading the xaml file directly, it still needs access to any types that it references.
By looking at your code I can tell that you should have loaded a WorkflowService instead of a simple activity. There are basically two options to try here:
Option 1: Load the activity and host it inside a generated workflow service.
You can do this by loading the activity as normal and use the following snippet to make it into a workflow service instance:
WorkflowService service = new WorkflowService();
service.Body = loadedActivity;
After that you can host it inside the workflow service host.
Option 2: Load the workflow service directly
The second option is not much different from what you have now. But instead of using the ActivityXamlServices class you will need to use the XamlServices class to load the workflow service. After that it's a matter of firing up the workflow service host with the settings you used in your sample.