Web service problem - error when binding to datagrid [modified]
-
Hey, I am programing a program that uses a Web Service to connect between the Server and WinAPP forms. I made the web service and active my IIS 7 (Using vista ultimate), then i enterd into my localost(using IP) and all go ok (check my defined methods and they returned void XML data) But when i combine that web service to WinAPP and them bind data to datagrid i got error:
System.Net.WebException: הבקשה נכשלה עם הודעת השגיאה:
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="%2fUniversityWebServices%2fService.asmx%3fAspxAutoDetectCookieSupport%3d1">here</a>.</h2>
</body></html>--.
ב- System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
ב- System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
ב- WindowsUniversityClient.UniversityWebReference.Service.GetGradesByStudentId(Int32 id) ב- C:\Users\יהב\Desktop\UniversityTestOrgnizer\UniversityTestOrgnizer\WindowsUniversityClient\Web References\UniversityWebReference\Reference.cs:שורה 83
ב- WindowsUniversityClient.Form1.searchgrades_btn_Click(Object sender, EventArgs e) ב- C:\Users\יהב\Desktop\UniversityTestOrgnizer\UniversityTestOrgnizer\WindowsUniversityClient\Form1.cs:שורה 24the code i userd
UniversityWebReference.Service service = new WindowsUniversityClient.UniversityWebReference.Service(); try { this.grades\_dataview.DataSource = service.GetGradesByStudentId(int.Parse(this.studentid\_txtbox.Text)); } catch (FormatException format\_e) { MessageBox.Show(format\_e.Message, "נוצרה שגיאה במהלך הצגת הנתונים", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch(Exception ee) { MessageBox.Show(ee.Message, "נוצרה שגיאה במהלך הצגת הנתונים", MessageBoxButtons.OK, MessageBoxIcon.Error); }
Gindi Bar Yahav - Web & Software defeloper.
modified on Saturday, June 20, 2009 10:43 AM
-
Hey, I am programing a program that uses a Web Service to connect between the Server and WinAPP forms. I made the web service and active my IIS 7 (Using vista ultimate), then i enterd into my localost(using IP) and all go ok (check my defined methods and they returned void XML data) But when i combine that web service to WinAPP and them bind data to datagrid i got error:
System.Net.WebException: הבקשה נכשלה עם הודעת השגיאה:
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="%2fUniversityWebServices%2fService.asmx%3fAspxAutoDetectCookieSupport%3d1">here</a>.</h2>
</body></html>--.
ב- System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
ב- System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
ב- WindowsUniversityClient.UniversityWebReference.Service.GetGradesByStudentId(Int32 id) ב- C:\Users\יהב\Desktop\UniversityTestOrgnizer\UniversityTestOrgnizer\WindowsUniversityClient\Web References\UniversityWebReference\Reference.cs:שורה 83
ב- WindowsUniversityClient.Form1.searchgrades_btn_Click(Object sender, EventArgs e) ב- C:\Users\יהב\Desktop\UniversityTestOrgnizer\UniversityTestOrgnizer\WindowsUniversityClient\Form1.cs:שורה 24the code i userd
UniversityWebReference.Service service = new WindowsUniversityClient.UniversityWebReference.Service(); try { this.grades\_dataview.DataSource = service.GetGradesByStudentId(int.Parse(this.studentid\_txtbox.Text)); } catch (FormatException format\_e) { MessageBox.Show(format\_e.Message, "נוצרה שגיאה במהלך הצגת הנתונים", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch(Exception ee) { MessageBox.Show(ee.Message, "נוצרה שגיאה במהלך הצגת הנתונים", MessageBoxButtons.OK, MessageBoxIcon.Error); }
Gindi Bar Yahav - Web & Software defeloper.
modified on Saturday, June 20, 2009 10:43 AM
Hmm, my Hebrew is no so good, but you might try using: int.TryParse() instead of int.Parse(). Also, it is good to use some debug methods for inspecting the SOAP message before and after it is processed. You can do this in debug mode in Visual Studio. Make sure your IO is working correctly. This is the half split, method for finding bugs in SOAP based web services. Then depending on where the problem is manifesting you will know what end point is responsible for the problem.
-
Hmm, my Hebrew is no so good, but you might try using: int.TryParse() instead of int.Parse(). Also, it is good to use some debug methods for inspecting the SOAP message before and after it is processed. You can do this in debug mode in Visual Studio. Make sure your IO is working correctly. This is the half split, method for finding bugs in SOAP based web services. Then depending on where the problem is manifesting you will know what end point is responsible for the problem.
Sorry about the hebrew... :$ Isolved the problem i enterd in the windows form into app.config and them edit
<setting name="WindowsUniversityClient_UniversityWebReference_Service"
serializeAs="String">
<value>http://192.168.111.1/UniversityWebServices/Service.asmx</value>
</setting>To:
<setting name="WindowsUniversityClient_UniversityWebReference_Service"
serializeAs="String">
<value>http://192.168.111.1/UniversityWebServices/Service.asmx?AspxAutoDetectCookieSupport=1</value>
</setting>Now, when he hav AspxAutoDectateCoolieSupport it gives me the results :D Thanks for your help!, Yahav.
Gindi Bar Yahav - Web & Software developer.