I ve created a simple wf where I, in the first activity pass my xml fields to a BizTalk orchestration (FILE). BizTalk is using the K2.net adapter to send a different xml message back (different schema). Since BizTalk can t retrieve the serial number fro the native format, I d like to add the serial number to the outgoing message. How ever adding the serial number causes an error Object not set to an instance of an object . By generating code and throwing messages to the event log, I found the location of the problem:
The first row after the try statement in the SendFILE method:
.Value.ToString());
The funny thing is that it works if I don t check the Include the K2.net Serial Number as part . Unfortunately will not help me :(
//Mikael
I am not sure what you mean by "Since BizTalk can t retrieve the serial number fro the native format". If assume that you have chosen not to include the Serial number as part of the message body, this option will add the serial number as a process instruction inside the message that is sent to BizTalk server. If you have a BizTalk map, make sure that you change the "Copy Process instructions" property to yes, so that the K2.net Event Adapter can retrieve the Serial Number.
With the second option , to "Include the K2.net serial number as part of the message body", please make sure that the XML Field "Order" has a valid value. If it is empty, you can use the metadata to initialize the value of the XML Field.
K2.ProcessInstance.XmlFields["ORDER"].Value = K2.ProcessInstance.XmlFields["ORDER"].MetaData;
Hope you find this helpful
With the second option , to "Include the K2.net serial number as part of the message body", please make sure that the XML Field "Order" has a valid value. If it is empty, you can use the metadata to initialize the value of the XML Field.
K2.ProcessInstance.XmlFields["ORDER"].Value = K2.ProcessInstance.XmlFields["ORDER"].MetaData;
Hope you find this helpful
+1
Thanks!
Ok, the object reference error occurs because the "K2.ProcessInstance.XmlFields["ORDER"].Value" is nothing. So when the .ToString() call is made, it generates an error.
Resolution:
The Order XMLfield should be initialized before the BizTalk event executes. The BizTalk event assumes that the Order XMLfield contains valid xml, and complies with the schema used to set the serial number. Drop a default server event before the BizTalk Event, and set the K2.ProcessInstance.XmlFields["ORDER"].Value = "Some XML", the best way to do this, is by setting the Meta data at design time, with some XML
So when the default server event executes, the value property of the order field will be initialized with the Metadata property of the order xml field.
//Code in the Default Server event
K2.ProcessInstance.XmlFields["ORDER"].Value = K2.ProcessInstance.XmlFields["ORDER"].MetaData;
Resolution:
The Order XMLfield should be initialized before the BizTalk event executes. The BizTalk event assumes that the Order XMLfield contains valid xml, and complies with the schema used to set the serial number. Drop a default server event before the BizTalk Event, and set the K2.ProcessInstance.XmlFields["ORDER"].Value = "Some XML", the best way to do this, is by setting the Meta data at design time, with some XML
So when the default server event executes, the value property of the order field will be initialized with the Metadata property of the order xml field.
//Code in the Default Server event
K2.ProcessInstance.XmlFields["ORDER"].Value = K2.ProcessInstance.XmlFields["ORDER"].MetaData;
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.