I have numerous codeunit web services that are running and working. I am trying to get the easiest of page web services working and I get the following error in Visual Studio: "ReplaceWithAPercentEncodedCompanyName/Page/Customer" was not found!
I have exposed the Customer Page in NAV
I started a C# project with the following code:
WS.Customer_Service service = new WS.Customer_Service();
service.UseDefaultCredentials = true;
WS.Customer cust = service.Read("100000");
WS is the reference to the web service. Trying to keep this as simple as possible. The error happens on the last line which is where the call to NAV is actually made. Same page runs through RTC no problem. The service tier customsetting.config is normal except we have key="WebServicesUseNTLMAuthentication" value="true">.
Any thoughts?
0
Answers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
http://servername:7047/DynamicsNAV/WS/Page/Customer. I have not chose a company anywhere so it must have something to do with this.
jwilder@stonewallkitchen.com
Know back to my original problem whihc was consuming a page. It seems the page was showing a similar problem. So I added this line of c# code:
service.Url = "http://mycomputer:7047/DynamicsNAV/WS/mycompany/Page/Customer";
and it now works. The weird thing is that I have not seen that this is required to call service.url when consuming a page. Freddy's blog, Waldo's blog, NAV help do not do this. You definately need to do this for Codeunit web services but why does no one else require this when consuming a page? Even though I have a solution I think there is still something not right. ANy thoughts would be appreciated.
jwilder@stonewallkitchen.com
http://myserver:7047/DynamicsNAV/WS/mycompany/Page/Customer
or you need to do it with the service.url method like this:
service.url = "http://myserver:7047/DynamicsNAV/WS/mycompany/Page/Customer"
In my case i used this url for the web reference:
http://myserver:7047/DynamicsNAV/WS/Services
and clicked through to the actual page service. By doing this it never knows what company you are talking about so it makes sense that I would be required to add this code:
service.url = "http://myserver:7047/DynamicsNAV/WS/mycompany/Page/Customer";
Otherwise it would not know what company to use. In a way this second method is nice because it lets you choose the company in your code not the actual web reference.
jwilder@stonewallkitchen.com