Inexplicable routing failures for a direct-bound orchestration receiving XmlDocument - biztalk

I've created an orchestration project with a property schema that contains a boolean property IsForFramework. My aim is to have an orchestration receive all messages of type System.Xml.XmlDocument that have the aformentioned property promoted with a value of true.
This is part of the property schema:
<xs:schema xmlns="http://Bakker.Framework.Orchestrations.Framework" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Bakker.Framework.Orchestrations.Framework" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo schema_type="property" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="IsForFramework" type="xs:boolean">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="9358dd05-92f7-4c84-8dc1-8427bea580a6" propSchFieldBase="MessageContextPropertyBase" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:schema>
The filter expression on the receive shape:
(Bakker.Framework.Orchestrations.IsForFramework == true)
The actual subscription queried from the BizTalk console:
http://Bakker.Framework.Orchestrations.Framework.IsForFramework == True
In the routing failure report context:
IsForFramework True Promoted http://Bakker.Framework.Orchestrations.Framework
I can't, for the life of me, figure out what could possible be going wrong here.

Try for the Filter Expression:
Bakker.Framework.Orchestrations.IsForFramework == "True"
Single quotes might also work, the expression editor in the Orchestration Designer is different from the one in BT Admin.

After some discussion with MDeSchaepmeester it was determined that the underlying issue is that the Pipeline component that was promoting that context property and all the others it was promoting as strings, however this context property was defined as a Boolean in the Property Schema.
From IBaseMessageContext.Promote Method
"If the types of the promoted properties do not match the values specified in subscription, the comparison fails and the message subscription does not occur. "
In this case you have two options
1) Either make sure that the object is cast to Boolean when you are promoting it.
2) Change the field type to String and change the filter expression to Bakker.Framework.Orchestrations.IsForFramework == "True" as suggested by Johns-305 (if they match type you won't get the error)

Related

Getting org.testng.TestNGException: No free nodes found in:[DynamicGraph Exception

I want to write same class more than once in my testng.xml.
for e.g i have two methods login() and logout() in Login class.
First i want to execute Login class's login() method then OtherClass's method() and finally Login class's logout() method
<test name="scenario1">
<classes>
<class name="com.webaut.Login">
<methods>
<include name="login" />
</methods>
</class>
<class name="com.webaut.OtherClass">
<methods>
<include name="method" />
</methods>
</class>
<class name="com.webaut.Login">
<methods>
<include name="logout" />
</methods>
</class>
</classes>
</test>
After executing my suit i get an "org.testng.TestNGException: No free nodes found in:[DynamicGraph Exception"
I could have used #DataProvider, but my methods are different so please suggest any alternative.
It appears that each class can only be declared once in the list, even if different methods are included on each declaration, otherwise you will see this error message :( Using latest TestNG 6.8.8. I was able to get this to work with #Test(priority=#) with the specific priority on each test method. See http://testng.org/doc/documentation-main.html#annotations.
My use case: crud tests for entities. Each Entity has its own test class with 4 methods (so I can test only a single entity CRUD in isolation), but I also want to run the overall suite (will fail due to integrity constraints and different generated ID keys unless they are run in exactly the right order).
Same question asked at org.testng.TestNGException: No free nodes found in:[DynamicGraph.

XML Property 'InnerText' is WriteOnly when trying to read attribute value

I'm getting a "Property 'InnerText' is WriteOnly" error when trying to read an attribute value
Here's my XML:
<?xml version="1.0" encoding="utf-8"?>
<products>
<product ID="11837">
<price currency="EUR">75.29</price>
<properties>
<property name="brand">
<value></value>
</property>
</properties>
<variations/>
</product>
</products>
To extract the price I do:
node.SelectSingleNode("price").InnerText
which returns "75.29"
But when I do:
node.Attributes("ID").InnerText
I get the error:
Property 'InnerText' is WriteOnly
I don't see any reason why it's write-only and don't know how I can change it so I can read the value.
It's a fact of the implementation of XmlAttribute that it only supports writing to its InnerText property. You don't "change it" so that you can read the value - you use the Value property:
Gets or sets the value of the node.
Alternatively, you can access the value via InnerText if you cast the XmlAttribute as an XmlNode (its base class).
According to the MSDN:
The concatenated values of the node and all its children. For attribute nodes, this property has the same functionality as the Value property.
You should just use the Value property, instead, like this:
node.Attributes("ID").Value
Or you can cast it to an XmlNode and then access the InnerText. XmlNode is the base class for XmlAttribute, and its InnerText property is read-write rather than write-only. For instance:
CType(node.Attributes("ID"), XmlNode).InnerText
I'm not sure why it's write-only in the XmlAttribute class. Presumably there must have been some good reason for it, given the internal workings of the class, though it's hard to imagine what that would be. The odd thing is that in the MSDN documentation in version 1.1 actually says that it is a read/write property in that version of the framework. Then, in versions 2.0 - 4.0 it defines the property as write-only, but the description of it says "Gets or sets..." So, the MSDN hasn't exactly been consistent about it.

Flex SOAP Collection decoding

Does anybody know why the Flex 4(.6) SOAP decoder adds the decoded arraycollection in the first element of the array(collection)based-property in the object?
BarCollection extends from ArrayCollection
Expected:
Object
-- someProperty:BarCollection
--[0] item:Foo
--[1] item:Foo
Got:
Object
-- someProperty:BarCollection
-- [0] ArrayCollection
--[0] item:Foo
--[1] item:Foo
The collection is registered via the
SchemaTypeRegistry.getInstance().registerCollectionClass -method
SchemaTypeRegistry.getInstance().registerCollectionClass(new QName("http://www.world.com/Foo", "BarCollection"), BarCollection);
Thanks for your answer!
Making the property a public variable of type ArrayCollection seems to work.
I did not managed to make it work with instantiating the field in the getter.
You did mean something like this?
private var _collection:CustomCollection;
public function get collection():CustomCollection {
if(!_collection)
_collection = new CustomCollection()
return _collection;
}
public function set collection(value:CustomCollection):void {
_collection = value;
}
But it seems that this only works on pure ArrayCollections.
My CustomCollection extends CollectionBase, which extends ArrayCollection.
If I switch to the custom collection, instead of the ArrayCollection, the tricks listed above doesn't seem to work.
If I have some time, I'll run trough the XML decoder again.
JoriDor,
I retraced my steps and found that a second difference between what I created and what I got from the sample cited below appears to be the true cause.
My ArrayCollection instance variable was created by getter/setter functions. When I changed it to a public variable, like the sample code, it worked! This is very disappointing as I must now consider altering my VO classes.
Not to give up too easily, I imagine that the mx.rpc.xml classes are using reflection (describeType()), so maybe I can see what can be done about changing the handling of <accessor> versus <variable> tags.
...30 minutes later, and thanking Adobe for open-sourcing Flex... I found XMLDecoder.getExistingValue() uses describeType and does account for getter/setter (aka "accessor"). My constructor created an empty ArrayCollection. Well, XMLDecoder.setValue does not know whether to replace this AC or to add items to it. It does the latter. Moved the AC instantiation until the first call to the getter (checking for null of course), and now it works!
I hope that fixes it for you. Key parts of XML Decoder to visit if you're inclined: setValue(), getExistingValue(), and then the problem issue performed by promoteValueToArray().
Retracted portion starts...
I too am finding this same behavior. I don't know if this would count as an answer, but I have code that does work, taken from this site. The key difference that I can discern between my code/data and what is posted at that site is the manner in which I declare my collection/array in the schema.
In my schema, I had declared a collection in this way:
<complexType name="Things">
<sequence>
<element name="thing" type="ids:Thing" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="ParentThing">
<complexContent>
<sequence>
<element name="things" type="Things"/>
</sequence>
<complexContent>
</complexType>
In the code from the site linked above, the collection is declared more directly:
<xs:complexType name="example">
<xs:sequence>
...
<xs:element name="items">
<xs:complexType>
<xs:sequence>
<xs:element name="item" type="item" maxOccurs="5"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
(In case you're thrown off, "example" is a type and an element in the sample code. This threw me off while investigating how the sample code worked. (I prefer the convention of capitalizing types/classes only.))
Anyhow, the sample code works, and the schema difference seemed to be the only difference that mattered. Looking at the XML instances (his and mine), there wasn't a difference to see. Each collection is parented by an element with a pluralized name. That is <Things> has <thing> instances, while <items> has <item> instances.
I'd be interested to know what your schema and/or XML instance looks like and whether changing it to match the example above (if schema changes are possible in your case) fixes the issue.

Binding a ConverterParameter to a Resource file in Silverlight 4

I'm trying to create a common converter that will take in a string from a resource resx file (the app has to be localizable) as a parameter.
<TextBlock
ToolTipService.ToolTip="{Binding IsInUse, ConverterParameter={Binding Path=WhereUsedIndicatorTooltips, Source={StaticResource resource}}, Converter={StaticResource whereUsedIndicatorTooltipConverter}}" />
Where resource is declared at the top of this page in XAML as:
<UserControl.Resources>
<resources:myResource x:Key="resource" />
</UserControl.Resources>
At runtime I get this exception:
System.Windows.Markup.XamlParseException:
Provide value on
'System.Windows.Data.Binding' threw an
exception. [Line: 47 Position: 42]
---> System.InvalidOperationException: Operation is not valid due to the
current state of the object.....
I'm aware from this StackOverflow question that the ConverterParameter is not bindable and is not a DependencyObject. Is there a workaround to this problem, besides putting the text in the XAML?
I found a solution from Brandon Truong. This works very well.
I put my FrameworkElement with DependencyProperty converter in:
<UserControl.Resources>
<utilConverters:myTooltipConverter x:Key="myTooltipConverter" Tooltips="{Binding Path=tooltips, Source={StaticResource resource}}" />
</UserControl.Resources>
I got same error here ,
**
ElementName=RadCalendarMonths,Path=SelectedDate,StringFormat='MMMM
yyyy',ConverterCulture={Binding Path=CurrentCultureInfo,
Source={StaticResource ResourceWrapper}}}"/>
I used Converter Culture property Binded! Opps! I can't do that because the property ConverterCulture is not a DependencyProperty. If a property is not instance of DependencyProperty you cant use binding on it.
If you look at Property(F4) Pane on VS2010 you can see that some properties support Binding some properties does not! Some properties not seen there because some properties are read only as u know.
So using resource is a logical way to solve it.

Track user with log4net for a website

I am searching for the best way for track user on a web site based on asp.net.
We are using log4net to log some business actions (enter on this page, click on button, etc.). But for multiple users, log file cannot be read easily.
So I need add a property 'UserName' on the config file like this :
<conversionPattern value="%date [%thread] - %property{UserName} - %-5level - %logger - %message%newline"/>
Do you hae any idea about the way to set 'UserName' ?
thanks for your help
Following property is there
%username the Windows identity of user making the log entry; slow
check for more detail : http://www.beefycode.com/post/Log4Net-Tutorial-pt-4-Layouts-and-Patterns.aspx
check this article : Capture Web Events in log4net
You can define a username (or any other) property like this:
this.SetThreadContext("UserName", userName);
assuming userName holds the name of the user.
Edit (What you really want to do):
Write a wrapper for log4net (with interface) and make some method e.g. SetUserName like this:
public void SetUserName(Func<string> getUserName)
This method you call at application start and you pass some method that returns the currently logged in user (from the HttpContext). You will need to store the delegate somewhere, maybe a static variable. Then you have methods for logging at various levels and every single method calls the delegate (Func<string> getUserName) and sets the thread context property as shown above. This way you do not have to set the thread context property manually before every call to the logger...

Resources