locked
Send Empty xml file RRS feed

  • Question

  • Hi all

    We have R_2 Biztalk 2006
    with sql 2005

    We use SQLRecieve Adapter to connect to our DB
    The file is sent to the customer via FTP

    We have a request from our customer to deliver empty xml file if there is no records available in the DB

    Is this possible? if yes please point me to a tutorial or solution

    Thanks

    Regards

    ps : the customer needs and xml file with just the content below if there is no records to deliver

    <ROOT>
     
    </ROOT>





    AKE
    Thursday, October 15, 2009 7:46 AM

Answers

  • If you are not using any Orchestration in that case...........

    Use FOR XML EXPLICIT in your stored procedure.

    In the SP.... write the logic as.....

    If (data available)
      define the output xml as required.

    else

    define the sturucture of your XML as "<ROOT></ROOT>".


    Regards,
    Abhijit


    Abhijit Mahato Please "Mark as Answer" if Post has Answered the Question
    • Marked as answer by Akaschmid Thursday, October 15, 2009 11:42 AM
    Thursday, October 15, 2009 8:18 AM

All replies

  • You could initialize an empty message in a construct message shape and send this message in case there are no records available in DB else send the message containing the records of the DB.

    Regards,

    René
    Thursday, October 15, 2009 7:57 AM
  • Hi Rene

    Thanks for your reply..

    I belive this is possible if I am using Orchestration right?

    In my case I have no Orchestration.. is there way around this problem?

    Regards
    AKE
    Thursday, October 15, 2009 8:01 AM
  • Create a variable xmlDoc of type System.Xml.XmlDocument in your orchestration.

    If no records available in DB. then load the xmldocument as..
      xmlDoc.LoadXml("<ROOT></ROOT>");

    Now, Assign this xmlDoc to your output message
      msgOut = xmlDoc;


    Regards,
    Abhijit


    Abhijit Mahato Please "Mark as Answer" if Post has Answered the Question
    • Proposed as answer by RahulBizTalk Thursday, October 15, 2009 6:47 PM
    Thursday, October 15, 2009 8:03 AM
  • If you are not using any Orchestration in that case...........

    Use FOR XML EXPLICIT in your stored procedure.

    In the SP.... write the logic as.....

    If (data available)
      define the output xml as required.

    else

    define the sturucture of your XML as "<ROOT></ROOT>".


    Regards,
    Abhijit


    Abhijit Mahato Please "Mark as Answer" if Post has Answered the Question
    • Marked as answer by Akaschmid Thursday, October 15, 2009 11:42 AM
    Thursday, October 15, 2009 8:18 AM
  • Hi Mahato



    Will try that and see what happen

    Regards
    AKE
    Thursday, October 15, 2009 9:01 AM