Simple Page getting error through web services

jwilder
Member Posts: 263
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?
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?
Jason Wilder
jwilder@stonewallkitchen.com
jwilder@stonewallkitchen.com
0
Answers
-
Does your company have any apostrophe ?0
-
It does not have an apostrophe. There is a space though. Come to think of it how does it know what company to use (we have 3 in this database)? When consuming a page web service you do not use the service.url method right (only for codeunits)? When I set up the web reference I used this:
http://servername:7047/DynamicsNAV/WS/Page/Customer. I have not chose a company anywhere so it must have something to do with this.Jason Wilder
jwilder@stonewallkitchen.com0 -
I tripped across something and have solved this but I am still a little confused. I retested a simple codeunit web service and got the same error. Turns out I left out the service.url line of code. I added this in and my codeunit worked.
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.Jason Wilder
jwilder@stonewallkitchen.com0 -
I have my answer. It has to do with the url of the web reference. One way or the other you need to reference the company (obviously). So you either have to do it in the initial web reference by doing this:
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.Jason Wilder
jwilder@stonewallkitchen.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions