Hi
Iam getting error
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type System.DBNull was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
at System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String name, String ns, Object o, Boolean xsiType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write4_GetCustomerdetailsResponse(Object[] p)
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer5.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Web.Services.Protocols.SoapServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
at System.Web.Services.Protocols.WebServiceHandler.Invoke()
--- End of inner exception stack trace
This error when calling webservice . my webmethod is
[WebMethod]
[System.Web.Script.Services.ScriptMethod]
public List<arraylist> GetCustomerdetails(string lsadvrefno, string lsorgid)
{
try
{
dbo obj = new dbo();
string stromsdbinfo = "SELECT DBInfo FROM Organization WHERE (OrganizationId =" + lsorgid + ")";
DataTable dt = obj.GetDataTable(stromsdbinfo);
List<arraylist> newval = new List<arraylist>();
if (dt.Rows.Count > 0)
{
string dbinfo = dt.Rows[0]["DBInfo"].ToString();
string lsgbdetails = "Select val1, Customername, Address1, Address2, Address3, Phone, Mobile, Email From Advances A, Customer C Where A.Customerid = C.Customerid And A.Advanceid = '" + lsadvrefno + "'";
DataTable dtgb = obj.GetDataTable(lsgbdetails, dbinfo);
foreach (DataRow dRow in dtgb.Rows)
{
ArrayList values = new ArrayList();
foreach (object value in dRow.ItemArray)
values.Add(value);
newval.Add(values);
}
}
return newval;
}
catch (Exception)
{
return null;
}
}
Accessing it
ServiceReference.commonwsSoapClient objsc1 = new ServiceReference.commonwsSoapClient();
var list = objsc1.GetCustomerdetails("1516/xxxxx", "17");
But when i return string its working fine . Can anybody point out error in this case
Thanks in Advance