Welcome, Guest
  • Author Topic: Bad Network Data Error - using XML  (Read 2828 times)

    suraj

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Bad Network Data Error - using XML
    « on: 12/02/03, 06:29 »
    I am getting the following error:


    Bad Network Data; terminating connection

    in the Communication App Inspector panel. I am calling a function in a dll where the code is shown below. Basically i get the error when i return the XmlDocument but if i return it as a string then it works fine. Any ideas as to why this is occuring?



    code
    ===============

    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Xml;
    using FlashGateway.IO;

    namespace FRDG
    {
       
       public class SelectFromDatabase
       {
          
       public XmlDocument SelectEvents()
       {
             

       SqlConnection mySqlConnection = new SqlConnection(myConnection);
       SqlCommand mySqlCommand = new SqlCommand("select * from test FOR XML AUTO, XMLDATA", mySqlConnection);
       mySqlCommand.CommandTimeout = 30;

       mySqlConnection.Open();

       DataSet myDataSet1 = new DataSet();

       myDataSet1.ReadXml(mySqlCommand.ExecuteXmlReader(),XmlReadMode.Fragment);


       //String myString = myDataSet1.GetXml();
       

       XmlDocument datadoc = new XmlDocument();
             
       datadoc.LoadXml(myDataSet1.GetXml());
             
       mySqlConnection.Close();
               

       return datadoc;
       }
       }
    }

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Bad Network Data Error - using XML
    « Reply #1 on: 12/02/03, 13:05 »
    Seems that the header have not the correct format (I'm not familiar with .Net implementation of Remoting) Who's loading this data, FlashCom or the Flash Movie?

    Jorge

    suraj

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re:Bad Network Data Error - using XML
    « Reply #2 on: 12/02/03, 13:18 »
    Hi There,

    The Data is being loaded by Flash Comm. I am very new to .NET as well, when you say the header does not have the correct format are you talking about the following line?


    public XmlDocument SelectEvents()

    (i.e. XmlDocument is of the wrong type?)




    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Bad Network Data Error - using XML
    « Reply #3 on: 12/02/03, 13:54 »
    I don't think so. If with the same structure you're returning a string instead of a XmlDocument, and it works fine, then seems that the serialization between XmlDocument and AMF is not building the proper header (orden of bytes as FlashCom expected) Try to call directly the method from the Flash Movie and look what happens.

    Jorge

    suraj

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re:Bad Network Data Error - using XML
    « Reply #4 on: 12/03/03, 05:08 »
    Hi Jorge,

    I called the method directly through Flash (just remoting) and it worked fine. So i think you are right when you say


    "then seems that the serialization between XmlDocument and AMF is not building the proper header "

    so i guess the question now is how do i fix it!!


    Thanks very much,

    Suraj

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Bad Network Data Error - using XML
    « Reply #5 on: 12/03/03, 05:30 »
    Remoting .Net is not an Open Source implementation, so you can't do nothing. Pass a string and build the XML object in the Server or client side.

    Jorge

    suraj

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re:Bad Network Data Error - using XML
    « Reply #6 on: 12/03/03, 06:12 »
    Thanks very much for you help Jorge. Much appriciated.