In an application am working upon now, I had to create a message from a response received and one of the field to be created had to be populated from a variable.
It's simple,
1.Mark the filed as Distinguished field
2.Drop a construct shape with a Transform Shape and followed by Message Assignment shape
3. Create a map which populates all the fields of the message to be created from the response received except the one which needs to be assigned value from variable
4. In message assignment shape, msgToBeCreated.DistinguishedField = variable;
But, I got following error
Why It Happened
As can be seen in below image, the distinguished field has minOccurs = "0" i.e it is optional field. In the map it is not mapped so it does not become available in the resultant message, and when I try to assign value to this field (which is not present) I get error, makes sense :) .
What to Do
The error is quite straight forward, the distinguished field node is not present in the Message created after the transform shape.
Inner exception: A failure occurred while evaluating the distinguished field xxxx against the message part data. The message part data does not contain at least one of the nodes specified by the XPath expression (listed below) that corresponds to the distinguished field. The cause for this error may be that the message part data has not been initialized or that the message part data does not conform to the message
So to make the node available, in the map I added a String Concatenate functoid with empty value so that it gets initialized and later assigned the actual value in Message assignment shape.
If you have questions or suggestions, feel free to do in comments section below !!!
Do share if you find this helpful .......
Knowledge Sharing is Caring !!!!!!