none
Accessing message out of scope RRS feed

  • Question

  • Hi all,

    I have a message "Message_A" constructed inside the scope shape and being sent to the send port. Now when any exception occurs i need to log the details to the database. I have an exception handler with the expression in the construct message as below

    Excep_message(FILE.ReceivedFileName)=Message_A(FILE.ReceivedFileName);

    I received the error "use of unconstructed message 'Message_A'" when compiling the project. For this error i constructed the message "Message_A" before the scope shape as below.

    Message_A=null;
    Message_A(BTS.Operation)="Operation";

    Then i was able to compile the project without any error. When i deployed and the application exectued i got the below error.

    xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'Ibox.UNEDIFACT.COPARN.Orchestration.CoparnOrchestration_AEJEA(3f2f8342-08cd-6b69-c647-d13dc48b24ad)'.

    The service instance will remain suspended until administratively resumed or terminated.

    If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.

    InstanceId: 5bbb4a82-19ae-48bc-8bc0-b8c992088c68

    Shape name: ConstructMessage_1

    ShapeId: a849f763-3f7f-4bc3-bea2-9887fc3c7415

    Exception thrown from: segment 1, progress 10

    Inner exception: The part 'part' of message 'Message_A' contained a null value at the end of the construct block.

           

    Exception type: NullPartException

    Source: Microsoft.XLANGs.Engine

    Target Site: Void ConstructionCompleteEvent(Boolean)

    The following is a stack trace that identifies the location where the exception occured

       at Microsoft.XLANGs.Core.Part.ConstructionCompleteEvent(Boolean fKillUnderlyingPart)

       at Microsoft.XLANGs.Core.XMessage.ConstructionCompleteEvent(Boolean killUnderlyingPartWhenDirty)

       at Ibox.UNEDIFACT.COPARN.Orchestration.CoparnOrchestration_AEJEA.segment1(StopConditions stopOn)

       at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)

           

    Kindly assist why the null error is being raised even when i have assigned the Message_A with a value.


    Regards, Vivin.

    Friday, October 10, 2014 10:44 AM

Answers

All replies

  • Hi VivinMuthu,

    The null error you are getting is because you assigned an NULL value to XLANG Message_A. Assign some XML value to the Message_A then you won't get this issue. It's not a variable to assign null values.

    Thank You,

    Dani

    • Proposed as answer by DanielTamil Friday, October 10, 2014 11:00 AM
    • Marked as answer by Vivin Muthu Friday, October 10, 2014 11:05 AM
    Friday, October 10, 2014 10:53 AM
  • You assigned Message_A with a null value, that's where the null error is raised! 
    To assign Message_A with a value you will need to execute a mapping or assign it with a variable that contains a xmlDocument if your Message_A is a generic message.

    Another question: why do you want a null Message_A on your messagebox? Is that the required behavior?

    Be sure to also check following blog by Paole, it contains everything you need to know about processing and creating xlangmessages:

    http://blogs.msdn.com/b/appfabriccat/archive/2010/06/23/4-different-ways-to-process-an-xlangmessage-within-an-helper-component-invoked-by-an-orchestration.aspx


    Glenn Colpaert - Microsoft Integration MVP - Blog : http://blog.codit.eu


    Friday, October 10, 2014 10:57 AM
  • Hi Vivin,

    you cannot assign NULL to a message.

    If you wish to do dummy initialization of the message before the scope, follow the below steps:

    1) Generate Instance of the schema your Message_A is bound to.

    2) Assign that XML to the Message_A, instead of initializing it with NULL.

    Rachit

    Please mark the post answered your question as answer, and mark other helpful posts as helpful, it'll help other users who are visiting your thread for the similar problem

    Friday, October 10, 2014 11:01 AM
    Moderator
  • Hi glenn,

    There is no reason in assigning the null value to the message, i assigned null justs because i was getting the use of unconstructed message in the shape.

    Now i have assigned new System.Xml.XmlDocument() to the Message_A instead of null. Is this correct??


    Regards, Vivin.

    Friday, October 10, 2014 11:09 AM
  • Hi Vivin,

    Yes, thats 1 way to do it, i.e. by assigning the message with System.Xml.XmlDocument() type.

    Another way as I have mentioned above is by assigning the message with the instance of the schema it is bound to.

    For this:

    Declare an orchestration variable of type XmlDocument. Then in a message assignment shape, we need to do something like this:

    myxmlDoc = new XmlDocument(); 
    myxmlDoc.LoadXML("<somexmlhere></somexmlhere>") 
    Message_A = myxmlDoc;

    Both will work.

    Rachit





    Friday, October 10, 2014 11:20 AM
    Moderator
  • Hi,

    The Message _A is a COPARN EDI message of the message type as below.

    Schema.EFACT_D95B_COPARN_AEJEA

    How to do that in this case?


    Regards, Vivin.

    Friday, October 10, 2014 11:37 AM
  • What is the input message of your orchestration?
    Do you have a mapping from your input message to your COPARN file?

    If yes, you can construct your Message_A by executing a map from your input file to your COPARN file.

    But to be honest we need more details on your orchestration, why are you using it and what are the input files.


    Glenn Colpaert - Microsoft Integration MVP - Blog : http://blog.codit.eu

    Friday, October 10, 2014 11:40 AM
  • The process in my orchestration is as below

    I poll the data from the oracle database to get the id's(ID from parent table) for which the COPARN file has to be generated. Then they are debatched into single id's using receive pipeline.

    The id is then mapped to a envelope schema(collection of procedures in a package) as a input to get the records from each child table for that particular parent ID.    ---> Mapping 1

    The data from the child tables are then mapped to construct the COPARN schema.(Message_A). ---> Mapping 2

    My input to the orchestration will be a polling statement schema and the output will be COPARN schema (Message_A) and there will be a intermediate mapping to get the records from child table using the polling statement.


    Regards, Vivin.

    Friday, October 10, 2014 11:53 AM
  • Then why would you assign a null value to your Message_A? 
    You will need a Mapping in your Construction shape you map your Intermediate Result to your COPARN schema.

    Glenn Colpaert - Microsoft Integration MVP - Blog : http://blog.codit.eu

    Friday, October 10, 2014 12:06 PM
  • Hi,

    Like everyone here mentioned You cannot have an System.Xml.XmlDocument set to a value null.

    Another thing while reassigning the value to your XML please consider the messages are immutable in Biztalk, so you will have to reassigning and assign it.

    Regards


    Friday, October 10, 2014 1:53 PM
  • Hi glenn,

    I am constructing the message 'Message_A' before the scope shape just to access it in the catch exception block. I have the below in the message assignment shape.

    Message_A=abc;

    Message_A(BTS.Operation)="Operation";

     abc is a variable with base type as System.Xml.XmlDocument.

    I get the below error message logged in the database when the data is being polled.

    The part 'part' of message 'Message_A' contains zero bytes of data.

    Kindly assist how to avoid this error


    Regards, Vivin.

    Monday, October 13, 2014 6:42 AM