Hello.
I'm developing a web page with .net and visual studio. I'm trying to accesss Navision 2009 R2 data through web services. I've created a Web Form and inserted a GridView and an ObjectDataSource. I've configured the DataSource to access to Navision data trough my WebService and made this the Datasource for my GridView. Everything is ok so far. The GridView shows the columns I want it to show.
The error appears when I run the Web Page. The message is:
Error de la solicitud con el código de estado HTTP 401: Unauthorized.
Descripción: Excepción no controlada al ejecutar la solicitud Web actual. Revise el seguimiento de la pila para obtener más información acerca del error y dónde se originó en el código.
Detalles de la excepción: System.Net.WebException: Error de la solicitud con el código de estado HTTP 401: Unauthorized.
Error de código fuente:
Línea 178: [return: System.Xml.Serialization.XmlArrayItemAttribute(IsNullable=false)]
Línea 179: public Visibles[] ReadMultiple([System.Xml.Serialization.XmlElementAttribute("filter")] Visibles_Filter[] filter, string bookmarkKey, int setSize) {
Línea 180: object[] results = this.Invoke("ReadMultiple", new object[] {
Línea 181: filter,
Línea 182: bookmarkKey,
But if I bind the GridView to my WebService without the ObjectDataSource, with the
UseDefaultCredentials = True for my web service, and I run
ReadMultiple(wsFiltros.ToArray(), null, NUMLINEAS), it runs Ok. So I don't what am I doing wrong.
I'm guessing if I should configure my WebService in design time with the UseDefaultCredentials = True, but I can't find the place to configure anything in my WebService.
Any ideas?
Thanks.
Answers
It works as expected... More or Less...
Thanks.
You should find it on PartnerSource.
It works as expected... More or Less...
- using the default credentials of the currently logged on user (client.UseDefaultCredentials = true;)
- define credentials as NetworkCredentials (client.Credentials = new System.Net.NetworkCredential("username", "pwd", "domain");)
The following code has been copy-pasted from "NAV 2009 Developer and IT Pro Help"
- (setSize == 0) => returns the entire set of results (this is not the best way because of large data sets that you can retrieve)
- (setSize != 0) => returns the size of the set (if negative the result will be in reverse order) - this is useful parameter to implement paging
Look at the example from the manual:
Just with that code, the paging works. \:D/