ZoomVirus
ZoomVirus

Reputation: 615

There was an error in serializing body of message

I'm trying to give a datatable to my WCF for it to be accessed by other clients. I seem to get the following error.

An unhandled exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll

Additional information: There was an error in serializing body of message givePersonRequest: 'There was an error generating the XML document.'. Please see InnerException for more details.

The InnerException is.

{"There was an error generating the XML document."}

My service code is this.

 [OperationContract]
    bool givePerson(DataTable per, int id);

Which corresponds with.

   public bool givePerson(DataTable per, int id)
    {
        DataRow[] temp = ((DataTable)per).Select();
        for (int i = 0; i < data.Count; i++)
        {
            if (data[i].id == id)
            {
                data[i].addPerson(temp);
                return true;
            }
        }
        return false;
    }

Upvotes: 1

Views: 3494

Answers (1)

Renatas M.
Renatas M.

Reputation: 11820

There was an error in serializing body of message : 'There was an error generating the XML document.'. Please see InnerException for more details. This issue on application side by using the webservice below

    public int InsPatientLanguages(DataTable dt)
    {
        SqlCommand cmd = new SqlCommand();
        int val = 0;

        cmd.Parameters.AddWithValue("@tblPatLanguages", dt);

        val = DAC.SQLHelper.ExecuteNonQuery(cmd, CommandType.StoredProcedure, "dbo.Ins_PatLanguages");
       return val;
    }

Upvotes: 0

Related Questions