merlin_vista
دوشنبه 28 مرداد 1387, 17:33 عصر
سلام . آقا من دارم تازه با وب سرويس ها كار ميكنم ولي چند تا سوال داشتم گفتم خوبه اينجا بپرسم . :چشمک:
1 - من يك وب متد ساختم به اين صورت :
public DataTable DbData()
{
SqlDataAdapter dat = new SqlDataAdapter("select * from tbl_Melk", con);
dat.SelectCommand.CommandType = CommandType.Text;
DataTable dt = new DataTable();
dat.Fill(dt);
return dt;
}و در برنامه اينجوري صدا ميزنم :
merlin.Service serv_merl = new merlin.Service();
this.GridView1.DataSource = serv_merl.DbData();
this.GridView1.DataBind();ولي اين خطا را ميده :
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: Cannot serialize the DataTable. DataTable name is not set.<br> at System.Data.DataTable.WriteXmlSchema(XmlWriter writer, Boolean writeHierarchy)<br> at System.Data.DataTable.System.Xml.Serialization.IXm lSerializable.WriteXml(XmlWriter writer)<br> at System.Xml.Serialization.XmlSerializationWriter.Wr iteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)<br> at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriter1.Write3_DbDataResponse(Object[] p)<br> at Microsoft.Xml.Serialization.GeneratedAssembly.Arra yOfObjectSerializer5.Serialize(Object objectToSerialize, XmlSerializationWriter writer)<br> at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)<br> --- End of inner exception stack trace ---<br> at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)<br> at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle)<br> at System.Web.Services.Protocols.SoapServerProtocol.W riteReturns(Object[] returnValues, Stream outputStream)<br> at System.Web.Services.Protocols.WebServiceHandler.Wr iteReturns(Object[] returnValues)<br> at System.Web.Services.Protocols.WebServiceHandler.In voke()<br> --- End of inner exception stack trace --- body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: Cannot serialize the DataTable. DataTable name is not set.
at System.Data.DataTable.WriteXmlSchema(XmlWriter writer, Boolean writeHierarchy)
at System.Data.DataTable.System.Xml.Serialization.IXm lSerializable.WriteXml(XmlWriter writer)
at System.Xml.Serialization.XmlSerializationWriter.Wr iteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriter1.Write3_DbDataResponse(Object[] p)
at Microsoft.Xml.Serialization.GeneratedAssembly.Arra yOfObjectSerializer5.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle)
at System.Web.Services.Protocols.SoapServerProtocol.W riteReturns(Object[] returnValues, Stream outputStream)
at System.Web.Services.Protocols.WebServiceHandler.Wr iteReturns(Object[] returnValues)
at System.Web.Services.Protocols.WebServiceHandler.In voke()
--- End of inner exception stack trace ---
2 - براي اعتبار سنجي در وب سرويس ها بايد چگونه عمل كنيم . (اگه يه مقاله در ابم مورد بدين ممنون ميشم . ترجيحآً با سي شارپ و فارسي ) اگه يه مقاله در زمينه امنيت در وب سرويس باشه ممنون ميشم .
ممنون :لبخندساده:
1 - من يك وب متد ساختم به اين صورت :
public DataTable DbData()
{
SqlDataAdapter dat = new SqlDataAdapter("select * from tbl_Melk", con);
dat.SelectCommand.CommandType = CommandType.Text;
DataTable dt = new DataTable();
dat.Fill(dt);
return dt;
}و در برنامه اينجوري صدا ميزنم :
merlin.Service serv_merl = new merlin.Service();
this.GridView1.DataSource = serv_merl.DbData();
this.GridView1.DataBind();ولي اين خطا را ميده :
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: Cannot serialize the DataTable. DataTable name is not set.<br> at System.Data.DataTable.WriteXmlSchema(XmlWriter writer, Boolean writeHierarchy)<br> at System.Data.DataTable.System.Xml.Serialization.IXm lSerializable.WriteXml(XmlWriter writer)<br> at System.Xml.Serialization.XmlSerializationWriter.Wr iteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)<br> at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriter1.Write3_DbDataResponse(Object[] p)<br> at Microsoft.Xml.Serialization.GeneratedAssembly.Arra yOfObjectSerializer5.Serialize(Object objectToSerialize, XmlSerializationWriter writer)<br> at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)<br> --- End of inner exception stack trace ---<br> at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)<br> at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle)<br> at System.Web.Services.Protocols.SoapServerProtocol.W riteReturns(Object[] returnValues, Stream outputStream)<br> at System.Web.Services.Protocols.WebServiceHandler.Wr iteReturns(Object[] returnValues)<br> at System.Web.Services.Protocols.WebServiceHandler.In voke()<br> --- End of inner exception stack trace --- body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: Cannot serialize the DataTable. DataTable name is not set.
at System.Data.DataTable.WriteXmlSchema(XmlWriter writer, Boolean writeHierarchy)
at System.Data.DataTable.System.Xml.Serialization.IXm lSerializable.WriteXml(XmlWriter writer)
at System.Xml.Serialization.XmlSerializationWriter.Wr iteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriter1.Write3_DbDataResponse(Object[] p)
at Microsoft.Xml.Serialization.GeneratedAssembly.Arra yOfObjectSerializer5.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle)
at System.Web.Services.Protocols.SoapServerProtocol.W riteReturns(Object[] returnValues, Stream outputStream)
at System.Web.Services.Protocols.WebServiceHandler.Wr iteReturns(Object[] returnValues)
at System.Web.Services.Protocols.WebServiceHandler.In voke()
--- End of inner exception stack trace ---
2 - براي اعتبار سنجي در وب سرويس ها بايد چگونه عمل كنيم . (اگه يه مقاله در ابم مورد بدين ممنون ميشم . ترجيحآً با سي شارپ و فارسي ) اگه يه مقاله در زمينه امنيت در وب سرويس باشه ممنون ميشم .
ممنون :لبخندساده: