Presentation is loading. Please wait.

Presentation is loading. Please wait.

WEB SERVICES. Service Tier Web Services Client Services ApplicationApplication Meta data provider Class Library Client Tier Microsoft SQL Server Form.

Similar presentations


Presentation on theme: "WEB SERVICES. Service Tier Web Services Client Services ApplicationApplication Meta data provider Class Library Client Tier Microsoft SQL Server Form."— Presentation transcript:

1 WEB SERVICES

2 Service Tier Web Services Client Services ApplicationApplication Meta data provider Class Library Client Tier Microsoft SQL Server Form Builder Data Binder Role Tailored Client Database Tier High Level Architecture

3 WebServices - the simple story Pages and Codeunits can be exposed as webservices and used by any webservice consumer – Consumer uses Windows Authentication – Supports SSL DEMO

4 Strongly typed WS access Examples – Adding orders from a Web portal – Invoking Business Logic – Search functionality Using – Typically using specially designed Pages & Codeunits – Visual studio and C# – Running client side (Integration) – Running server side (webapp / process) DEMO

5 Customer_Service service = new Customer_Service(); service.UseDefaultCredentials = true;

6 Customer_Service service = new Customer_Service(); service.UseDefaultCredentials = true; Customer_Filter filter = new Customer_Filter(); filter.Field = Customer_Fields.Location_Code; filter.Criteria = "=YELLOW";

7 Customer_Service service = new Customer_Service(); service.UseDefaultCredentials = true; Customer_Filter filter = new Customer_Filter(); filter.Field = Customer_Fields.Location_Code; filter.Criteria = "=YELLOW"; Customer[] customers = service.ReadMultiple(new Customer_Filter[] { filter }, null, 0);

8 Customer_Service service = new Customer_Service(); service.UseDefaultCredentials = true; Customer_Filter filter = new Customer_Filter(); filter.Field = Customer_Fields.Location_Code; filter.Criteria = "=YELLOW"; Customer[] customers = service.ReadMultiple(new Customer_Filter[] { filter }, null, 0); foreach (Customer customer in customers) { this.listBox1.Items.Add(customer.No + " " + customer.Name + " " + customer.Location_Code); }

9 string bookmark = service.GetBookmark(customer.Key); System.Diagnostics.Process.Start("DynamicsNAV:////RunPage?Page=21 &mode=View&Bookmark=" + bookmark); AL-Code for getting a RTC compatible bookmark: bookmark := FORMAT(ref.RECORDID, 0, 10);

10 Loosely coupled WS access Examples – Edit in Excel Using – Generic Page access – Typically Client integration stuff Pitfalls – Limited metadata available for pages DEMO

11 XMLHTTP xhDisco = new XMLHTTP(); xhDisco.open("GET", SendURL, false, DomainUser, Password); xhDisco.send(null); if (xhDisco.status != 200) { MessageBox.Show(xhDisco.status.ToString() + ": " + xhDisco.statusText); return; } XmlDocument xdDisco = new XmlDocument(); xdDisco.LoadXml(xhDisco.responseText);

12 XMLHTTP xh4 = new XMLHTTP(); xh4.open("POST", SendURL, false, null, null); xh4.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xh4.setRequestHeader("SOAPAction", "ReadMultiple"); xh4.send(soapRequest); XmlDocument rs4 = new XmlDocument(); rs4.LoadXml(xh4.responseText);

13 Balance_LCY >10,000

14 300;EgAAAACJCDAxNDU0NTQ1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=19;- 3546584706554265600; 01454545 New Concepts Furniture 705 West Peachtree Street …………

15 Do's and Don'ts Only expose WebServices to the internet through a “proxy” (either WebServices or a Portal App.) Use GUIALLOWED and ISSERVICETIER to control flow Create special pages/codeunits for your strongly typed WS access Microsoft Dynamics NAV 2009 WebServices should not be exposed directly to the internet Avoid long running transactions

16 GUIALLOWED vs. ISSERVICETIER Use GUIALLOWED in your code to determine whether your code allows user interaction – WS & NAS will have GUIALLOWED = false Use ISSERVICETIER in your code to determine whether your code is running managed code on the servicetier or interpreted AL Code on a client or NAS – WS & RTC will have ISSERVICETIER = true

17 Transactions Invoke WS method == One transaction – Commits are ignored – Locks are kept until WS method runs out of scope Structure your tables and your code – Don’t do multiple inserts in one go

18 SC create Nav binpath= “ ” displayname= “Nav Server ” type= own start= auto depend= NetTcpPortSharing SC create NavWS binpath= “ ” displayname= “Nav Server WS” type= share start= auto depend= NetTcpPortSharing/HTTP Service Tier Listener Web Service Listener Doesn’t work on XP

19 Performance WebService and Service Tier caches – Metadata – JIT Compiled C# code Caches are flushed when services are restarted Cold access to objects are very slow

20 C:\Documents and Settings\All Users\Application Data\Microsoft\Microsoft Dynamics NAV\60\Server DEMO

21 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "WEB SERVICES. Service Tier Web Services Client Services ApplicationApplication Meta data provider Class Library Client Tier Microsoft SQL Server Form."

Similar presentations


Ads by Google