message part has not been initialized in construct statement

Home Page Forums BizTalk 2004 – BizTalk 2010 message part has not been initialized in construct statement

Viewing 1 reply thread
  • Author
    Posts
    • #20352

      Hi,

      I have been using BizTalk 2006 for over a year and have created a few projects. I’m trying to keep my overheads low and would like to ask if anyone would know of the best way to initialize a message in a Message Assignment shape.

      Currently my project receives a file and maps it to another file. I’m now adding another process where it executes a SQL store proc. So I have promoted two fields in output file(RTLGDoc) and two fields on my Store proc schema that I just create to call the SQL store proc called DClose.

      In my Construct shape I have the original map and I have a Message Assignment shape where i set the file name and I’m trying to set the promoted paramaters on my store proc messsage as below. Both messages have been added to the Messages constructed on the Construct Shape.

      Below is the code in the Message assignment. The first two lines are from the original code and is fine. The foollowing lines give me the error.

      RTLGDoc(FILE.ReceivedFileName) = “RTLOG_” + RTLGDoc.FileHeader.BusinessDate + “_” + RTLGDoc.FileHeader.LocationNumber + “.” + RTLGDoc.FileHeader.LocationNumber;

      RTLGDoc(FTP.ReceivedFileName) = “RTLOG_” + RTLGDoc.FileHeader.BusinessDate + “_” + RTLGDoc.FileHeader.LocationNumber + “.” + RTLGDoc.FileHeader.LocationNumber;

      DClose.parameters.BizTalk_HOStoRTLG_DClose.store = RTLGDoc.FileHeader.LocationNumber;
      DClose.parameters.BizTalk_HOStoRTLG_DClose.Code = RTLGDoc.TransactionClose.TransactionHeader.TransactionType;

      When I try to build I get ‘DClose.parameters’:message part has not been initialized in construct statement.

      In the past i would get around this problem by adding a map. But I’m sure that there must be a better way with less overhead. surely I can do this in the Message Shape. Can I initialize DClose message without created a map with it?

      Thank you and regards

      Rob

    • #20357

      I get around this by doing the following:

      1. Generate an instance of your schema by Right-Clicking on the schema in the Solution Explorer and selecting Generate Instance
      2. Create an XmlDocument variable in the Orchestration called xmlDoc
      3. Drop a Construct Message and Message Assignment shape
      4. Inside of the Message Assignment shape code the following:

           xmlDoc.LoadXml(<<copy XML from generated instance in step 1 and remove element values as they are populated be default>>);

           msg = xmlDoc;

       

      Why Microsoft didn’t include a way to create a new instance of a message from a supplied schema is beyond me!?

      • #20388

         Hi,

        I’m a newbie to Biztalk. I wanted to call a web service and so I had added reference to the web service but the XSD files for this web service are not generated. So, I decided to use Construct Message and Message Assignment shape to initialize my web request message from my incoming message data.(And then Send shape should send the Request Message to Request operation of web port.)

        I’m trying to assign to my Web Request message in the message assignment shape with this expression:

        WebRequest_doc.input_xml = InboundDoc.input_xml;

        Where

        WebRequest_doc is a message created in Orchestration View under messages with ‘Message Type’ pointing to request Type Name of web method. input_xml ‘s Object Type = Message part  with Type = System.String and ‘Message Body part = false’

        And InboundDoc is a message created in Orchestration View under messages with following Schema

        <?xml version=”1.0″ encoding=”utf-16″ ?>

        <xs:element name=”ForEDM>
        <xs:annotation>
        <xs:appinfo>
        <b:properties>
          <b:property distinguished=”true xpath=”/*[local-name()=’ForEDM’ and namespace-uri()=’http://EDMIntegrationSchema.DocID’%5D/*%5Blocal-name()=’input_xml&#8217; and namespace-uri()=”] />
          </b:properties>
          </xs:appinfo>
          </xs:annotation>
        <xs:complexType>
        <xs:sequence>
          <xs:element name=”input_xml type=”xs:string />
          </xs:sequence>
          </xs:complexType>
          </xs:element>
          </xs:schema>
         
        But this does not work and I get this exception: Inner exception: The part ‘input_xml’ of message ‘WebRequest_doc’ contained a null value at the end of the construct block. 
        How should I initialize the message part ‘input_xml’ ?
        Thanks for your help in advance.
        Regards,
        Sharad

         

         

         

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