Login to Reply
I have created a simple Page web service on the Fixed Asset table as I want to read the Fixed Assets in NAV in another web application. I have created and published the web service in NAV and can access it from a browser. I have added a web reference to my web application (which uses forms-based authentication) and I have the following code (at the bottom of the post) to read and list the Fixed Assets.
I am using the SQL sa credentials to connect to the web service, which has been created in NAV as a database user.
The error is "The request failed with HTTP status 401: Unauthorized." and it seems to be thrown when the ReadMultiple method is called. I have tried with UseDefaultCredentials = True but then the machine name is passed (eg. DOMAIN\COMPUTER$) which is not a valid user in the NAV database.
Can anyone advise how this should work please?
AssetWS.UseDefaultCredentials =
dt.Columns.Add(
dr = dt.NewRow
dr(0) = FixedAsset.No
dr(1) = FixedAsset.Asset_Reg
dr(2) = FixedAsset.Description
dr(3) = FixedAsset.FA_Location_Code
dr(4) = FixedAsset.Serial_No
dt.Rows.Add(dr)
dlstAsset.DataSource = dv
dlstAsset.DataBind()
I think i got your problem.
sorry for late reply did you solved your problem or not.
Feel free to contact me as i worked on such project.
hi yesterday i got this same issue and solved it by providing
obj.PreAuthenticate = true; after obj.UseDefaultCredentials = true statement
sorry for late reply any way it wil help others i guess :)
hi aavio and others..
i cant solve my problem even if i use your code...
is it bcoz my nav server & db server are separated or what else..? please help...
i already browsed for 2 days but it cant be solved.. :(
Webservice/service tier works with windows authentication.
are you able to view published webservices within browser(IE)?
if you want to access with a differnt login other than your system login
objref.UseDefaultCredentials = False
objref.Credentials = New System.Net.NetworkCredential(username,pwd)
Yup, for my problem, it was already solved.. :)
Silly mistake, i forgot to specify the company name, but i still confused, it's no problem when db & nav still on 1 machine... fiuh...
Thx aavio for ur reply.. :) Have a good day..
Now, i have another problem.. :(
All of machine already connected, but for every unknown period, the client cant connect to the server (seems like any idle time), i have to refresh the browser on the server that link to the one of page i'm using (like "192.168.1.92/.../SalesOrderList"), then the client can connect again.. why is it happened..? or may be i'm missing another setup?
Please advice... Thanks