Message has not been initialized in construct statement

Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Message has not been initialized in construct statement

Viewing 1 reply thread
  • Author
    Posts
    • #24620

      I am getting a “Message has not been initialized in construct statement” error.  After reading this forum I did check the “Message Constructed” property and set it.  No errors or warnings are evident until I build.  All message schemas are for flat file.

       

      I am trying to merge two messages into a third.  The first message has been made and mapped OK. 

      • The first message was made and mapped in a Construct/Transform shape.
      • I then go to a Construct/MessageAssignment shape to make the second message (Msg2) and assign the value from a variable. 
      • I then go to a Construct/Transform shape to map the two messages together into a third (Msg3). 

      I get three errors.  Both the Construct/MessageAssignment and Construct/Transform shape have a “Use of unconstructed message Msg2”.  The Construct/MessageAssignment shape also throws the “Message has not been initialized in construct statement”.

       

      I am grateful for all help.

    • #24624

       

      Hi, 

      From the error message you mentioned, it is clear that you are trying to use some message which is not been initialized yet. Please few rule of thumbs to check:

      – Make sure that the message you are constructing is selected on the “Message Construct” property of your Construct shape and you are trying to construct your selected message inside construct shape.

      – If the message you are constructing is of schema type then you are using Transform shape to map your message from source message. Also, in this case if you are using only Message Assignment shape inside construct block, then make sure that you are assigning some existing message of same type or XML document with some dummy xml to the message before accessing some property, because you need to initialize the message first. 

      – Also check your surce message instance is already initialized before constructing your destination message from this message.

      Yes, you can merge multiple message into one, while dragging message transform shape inside construct shape, it asks you to select your source message variables and destination message variable. You can choose two messages as source.

       

      • #24629

        Huh!

        Sometimes it takes just standing back a few days and giving it a fresh look!  I had too many messages checked in the Message Construct property.  So, checked both construct shapes and the little red dots on compile all went away.

        What also helped was that i was thinking I might have hosed something in the project and started a second.  While doing that I corrected an error and it gave me an idea how to fix the first.

        My thanks to mohanaryal for the reply.  It kept me on track.

        – Ziggy –

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.