SlideShare a Scribd company logo
1 of 14
Programming with NAV
WebServices –The Basics
Bill Burton
Solution Systems, Inc.
847-590-3000
info@solsyst.com
These are my notes and references
that I use when consulting and training
on how to use Microsoft Dynamics
NAV Web Services to accomplish
various tasks.
The Basics
There are a handful of steps that are
the same regardless of what task you
are attempting.
1. Identify the Page
2. Publish the Web Service
3. Test the URL in a Web Browser
4. Add a Service Reference to Your
Project
5. Write Some Code.
847-590-3000
info@solsyst.com
Identify the Page
Interactions with NAV start with your
requirements. For this sample, we will
assume that you have been asked to
display a list of Items for sale.
Any User Interface in NAV can be
published as a Web Service. This
allows you to manipulate data through
Web Services as if you were using
NAV itself.
This also means that all of Navision’s
validation routines are run when you
attempt to modify data.
So, the first step then, is to identify the
User Interface or “Page” that an end-
user would use to accomplish the task.
Looking around in NAV, you find the
Items for sale in a convenient, “Item
List” interface.
847-590-3000
info@solsyst.com
This leads to the biggest “gotcha” with
NAV Web Services. Since you want to
show a list of Items, the intuitive step
would be to use the “Item List”
interface.
This is wrong. What you want to do is
use the single item interface.
For our purposes, that means we want
to use the detail view for one Item (the
“Item Card”) that is accessed by
double-clicking an item in the above
list.
Once you are on the detail page, select
About This Page from the Help
menu.
847-590-3000
info@solsyst.com
This opens up a Help Screen that tells
you the Page Name and Number
needed for the next step.
It also tells you the Source Table that
the data comes from in case you want
to poke around in SQL and make sure
you are getting the data you think you
are.
Now we know we want Page 30 – Item
Card.
847-590-3000
info@solsyst.com
Publish the Web Service
This is the easy part.
Navigate to the Web Services interface
(Departments->Administration->IT
Administration->General->Web
Services) and select the New button.
Object Type is Page (We’ll talk about
the other types later).
Object ID is 30 – This is the Page
Number that we identified in the earlier
step.
Service Name – This becomes part of
the URL that you use to access the
Web Service, so pick something simple
and memorable. I picked “Item” for this.
Check the Published checkbox.
That’s it. Your Web Service is now
available.
847-590-3000
info@solsyst.com
Test the URL in a Web Browser
This is the pattern for your Web
Service URL:
http://<Server>:<WebServicePort>/<S
erverInstance>/WS/<CompanyName>
/Page/<ServiceName>
Microsoft fully explains each piece of
the URL here:
http://msdn.microsoft.com/en-
us/library/dd355398.aspx
Most of the pieces of the URL can be
discovered using the Select Server
dialog in the NAV Role-Tailored Client.
847-590-3000
info@solsyst.com
For this sample, Server =
192.168.10.12 – you can use a
Windows Name on your local network
(e.g. NAVSERVER) or).
you can use an internet address such
as (navservices.cronuscorp.net
Although, if you publish over the
internet, you will want to use SSL.
This is a bit beyond the scope of this
article, but you need to send a
Windows Login to NAV Web Services,
so be sure you or your network
administrator fully understand the
security implications of what you are
doing if you expose services over the
public internet.
847-590-3000
info@solsyst.com
For SOAP Services Port is 7047 by
default.
The Server Instance in this case is
commercer2
So, the first part of the URL would be:
http://192.168.10.12:7047/commercer2
Finishing up, the next part is the
constant string WS.
847-590-3000
info@solsyst.com
The Company Name is the company
you wish to connect to. We will use
CRONUS Supply, Inc. from the Select
Server dialog.
The rest of the information comes from
the Web Services page in NAV where
you published the service.
The next piece is the Object Type from
the Web Services page. Ours will be
Page because that is the only type we
know how to use right now.
Finally, the Service Name is the name
we gave when we published the
service. Item for our example.
This then is our final URL:
http://192.168.10.12:7047/commercer2
/WS/CRONUS%20Supply,%20Inc/Pag
e/Item
847-590-3000
info@solsyst.com
If you open that in a Web Browser and
everything has been set up properly,
you will get this XML to the right in reply
This is the simplest way to be sure you
have the URL correct and the
infrastructure is available before you sit
down to write code. If the Web Service
does not send XML to the browser,
then you will need to work with your
Network Administrator to be sure the
services are published and you are
using the correct URL.
847-590-3000
info@solsyst.com
Add a Service Reference to Your
Project
After all that, we are ready to open up
Visual Studio and get to work.
I set up a simpleASP.NET Empty Web
Site using the File -> New Web Site
dialog in Visual Studio.
Once you have your project started,
right-click on your project in Solution
Explorer and select Add Service
Reference…
847-590-3000
info@solsyst.com
In the Add Service Reference dialog,
paste the URL for the service from the
earlier step and select the Go button.
The Namespace field is how you will
refer to the generated code in your
project, so I like to change the default
to something a bit more descriptive. I
used ItemService for this sample.
847-590-3000
info@solsyst.com
Write Some Code
At this point, you are ready to write some code to perform the task at hand.
I will break down some of the more common tasks in separate posts, because the above
preliminary work is the same regardless of the task.
What’s Next?
We get to see some code. The code samples will break out like this:
Simple read of Items
Reading a Header/Line document such as a Sales Quote.
Using Filters to limit the data returned. Sample is Sales Quote for Customer 10000 (The Cannon
Group PLC)
Create a new Sales Order
Overview of Codeunits and other Object Types.
References
MSDN Reference “How to build a URL”: http://msdn.microsoft.com/en-us/library/dd355398.aspx
Want More Microsoft
DynamicsTips?
View My Blog
847-590-3000
info@solsyst.com

More Related Content

Viewers also liked

Ax 2012 x++ code best practices
Ax 2012 x++ code best practicesAx 2012 x++ code best practices
Ax 2012 x++ code best practicesSaboor Ahmed
 
Presentacion Dynamics NAV 2015
Presentacion Dynamics NAV 2015Presentacion Dynamics NAV 2015
Presentacion Dynamics NAV 2015Josep Pages
 
Upgrading Microsoft Dynamics NAV
Upgrading Microsoft Dynamics NAVUpgrading Microsoft Dynamics NAV
Upgrading Microsoft Dynamics NAVChandara Daly
 
X++ advanced course
X++ advanced courseX++ advanced course
X++ advanced courseAlvin You
 
Microsoft Dynamics NAV 2016: what's new
Microsoft Dynamics NAV 2016: what's newMicrosoft Dynamics NAV 2016: what's new
Microsoft Dynamics NAV 2016: what's newChristiaens
 

Viewers also liked (7)

Ax 2012 x++ code best practices
Ax 2012 x++ code best practicesAx 2012 x++ code best practices
Ax 2012 x++ code best practices
 
Presentacion Dynamics NAV 2015
Presentacion Dynamics NAV 2015Presentacion Dynamics NAV 2015
Presentacion Dynamics NAV 2015
 
Upgrading Microsoft Dynamics NAV
Upgrading Microsoft Dynamics NAVUpgrading Microsoft Dynamics NAV
Upgrading Microsoft Dynamics NAV
 
NAV 2016 Workflow
NAV 2016 WorkflowNAV 2016 Workflow
NAV 2016 Workflow
 
X++ advanced course
X++ advanced courseX++ advanced course
X++ advanced course
 
Microsoft Dynamics NAV 2016: what's new
Microsoft Dynamics NAV 2016: what's newMicrosoft Dynamics NAV 2016: what's new
Microsoft Dynamics NAV 2016: what's new
 
Vendor Landscape: Mid-Market ERP
Vendor Landscape: Mid-Market ERPVendor Landscape: Mid-Market ERP
Vendor Landscape: Mid-Market ERP
 

More from Solution Systems, Inc.

5 Things to Consider When Upgrading Microsoft Dynamics NAV
5 Things to Consider When Upgrading Microsoft Dynamics NAV5 Things to Consider When Upgrading Microsoft Dynamics NAV
5 Things to Consider When Upgrading Microsoft Dynamics NAVSolution Systems, Inc.
 
Three Most Common Realizations that it's Time to Upgrade Your Business Software
Three Most Common Realizations that it's Time to Upgrade Your Business SoftwareThree Most Common Realizations that it's Time to Upgrade Your Business Software
Three Most Common Realizations that it's Time to Upgrade Your Business SoftwareSolution Systems, Inc.
 
Dynamics 365 for Financials vs. NetSuite
Dynamics 365 for Financials vs. NetSuiteDynamics 365 for Financials vs. NetSuite
Dynamics 365 for Financials vs. NetSuiteSolution Systems, Inc.
 
Microsoft Dynamics 365 for Financials FAQ
Microsoft Dynamics 365 for Financials FAQMicrosoft Dynamics 365 for Financials FAQ
Microsoft Dynamics 365 for Financials FAQSolution Systems, Inc.
 
Microsoft Dynamics NAV 2017 - Complete list of client enhancements for end users
Microsoft Dynamics NAV 2017 - Complete list of client enhancements for end usersMicrosoft Dynamics NAV 2017 - Complete list of client enhancements for end users
Microsoft Dynamics NAV 2017 - Complete list of client enhancements for end usersSolution Systems, Inc.
 
Microsoft Dynamics NAV 2017 - Simplified setup
Microsoft Dynamics NAV 2017 - Simplified setupMicrosoft Dynamics NAV 2017 - Simplified setup
Microsoft Dynamics NAV 2017 - Simplified setupSolution Systems, Inc.
 
Microsoft Dynamics NAV 2017 - Item attributes
Microsoft Dynamics NAV 2017 - Item attributesMicrosoft Dynamics NAV 2017 - Item attributes
Microsoft Dynamics NAV 2017 - Item attributesSolution Systems, Inc.
 
Top 3 Time Saving Features of Microsoft Dynamics NAV
Top 3 Time Saving Features of Microsoft Dynamics NAVTop 3 Time Saving Features of Microsoft Dynamics NAV
Top 3 Time Saving Features of Microsoft Dynamics NAVSolution Systems, Inc.
 
17 New Application Changes in Microsoft Dynamics NAV
17 New Application Changes in Microsoft Dynamics NAV17 New Application Changes in Microsoft Dynamics NAV
17 New Application Changes in Microsoft Dynamics NAVSolution Systems, Inc.
 
What are the benefits of implementing NAV?
What are the benefits of implementing NAV? What are the benefits of implementing NAV?
What are the benefits of implementing NAV? Solution Systems, Inc.
 

More from Solution Systems, Inc. (20)

5 Things to Consider When Upgrading Microsoft Dynamics NAV
5 Things to Consider When Upgrading Microsoft Dynamics NAV5 Things to Consider When Upgrading Microsoft Dynamics NAV
5 Things to Consider When Upgrading Microsoft Dynamics NAV
 
Three Most Common Realizations that it's Time to Upgrade Your Business Software
Three Most Common Realizations that it's Time to Upgrade Your Business SoftwareThree Most Common Realizations that it's Time to Upgrade Your Business Software
Three Most Common Realizations that it's Time to Upgrade Your Business Software
 
Dynamics 365 for Financials vs. NetSuite
Dynamics 365 for Financials vs. NetSuiteDynamics 365 for Financials vs. NetSuite
Dynamics 365 for Financials vs. NetSuite
 
Microsoft Dynamics 365 for Financials FAQ
Microsoft Dynamics 365 for Financials FAQMicrosoft Dynamics 365 for Financials FAQ
Microsoft Dynamics 365 for Financials FAQ
 
Microsoft Dynamics NAV 2017 - Complete list of client enhancements for end users
Microsoft Dynamics NAV 2017 - Complete list of client enhancements for end usersMicrosoft Dynamics NAV 2017 - Complete list of client enhancements for end users
Microsoft Dynamics NAV 2017 - Complete list of client enhancements for end users
 
Microsoft Dynamics NAV 2017 - Simplified setup
Microsoft Dynamics NAV 2017 - Simplified setupMicrosoft Dynamics NAV 2017 - Simplified setup
Microsoft Dynamics NAV 2017 - Simplified setup
 
Microsoft Dynamics NAV 2017 - Item attributes
Microsoft Dynamics NAV 2017 - Item attributesMicrosoft Dynamics NAV 2017 - Item attributes
Microsoft Dynamics NAV 2017 - Item attributes
 
Microsoft Dynamics NAV FAQ II
Microsoft Dynamics NAV FAQ IIMicrosoft Dynamics NAV FAQ II
Microsoft Dynamics NAV FAQ II
 
Microsoft Dynamics NAV FAQ III
Microsoft Dynamics NAV FAQ IIIMicrosoft Dynamics NAV FAQ III
Microsoft Dynamics NAV FAQ III
 
Microsoft Dynamics NAV FAQ IV
Microsoft Dynamics NAV FAQ IVMicrosoft Dynamics NAV FAQ IV
Microsoft Dynamics NAV FAQ IV
 
Microsoft Dynamics NAV FAQ 5
Microsoft Dynamics NAV FAQ 5Microsoft Dynamics NAV FAQ 5
Microsoft Dynamics NAV FAQ 5
 
Does Your Controller Know?
Does Your Controller Know? Does Your Controller Know?
Does Your Controller Know?
 
Does Your Owner or CEO Know?
Does Your Owner or CEO Know?Does Your Owner or CEO Know?
Does Your Owner or CEO Know?
 
Does Your Sales Manager Know...
Does Your Sales Manager Know...Does Your Sales Manager Know...
Does Your Sales Manager Know...
 
Top 3 Time Saving Features of Microsoft Dynamics NAV
Top 3 Time Saving Features of Microsoft Dynamics NAVTop 3 Time Saving Features of Microsoft Dynamics NAV
Top 3 Time Saving Features of Microsoft Dynamics NAV
 
17 New Application Changes in Microsoft Dynamics NAV
17 New Application Changes in Microsoft Dynamics NAV17 New Application Changes in Microsoft Dynamics NAV
17 New Application Changes in Microsoft Dynamics NAV
 
Project Madiera Overview
Project Madiera OverviewProject Madiera Overview
Project Madiera Overview
 
Microsoft Dynamics Customer Stories
Microsoft Dynamics Customer StoriesMicrosoft Dynamics Customer Stories
Microsoft Dynamics Customer Stories
 
The History of Microsoft Dynamics NAV
The History of Microsoft Dynamics NAVThe History of Microsoft Dynamics NAV
The History of Microsoft Dynamics NAV
 
What are the benefits of implementing NAV?
What are the benefits of implementing NAV? What are the benefits of implementing NAV?
What are the benefits of implementing NAV?
 

Recently uploaded

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 

Recently uploaded (20)

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 

Programming With NAV Web Services – The Basics

  • 1. Programming with NAV WebServices –The Basics Bill Burton Solution Systems, Inc. 847-590-3000 info@solsyst.com
  • 2. These are my notes and references that I use when consulting and training on how to use Microsoft Dynamics NAV Web Services to accomplish various tasks. The Basics There are a handful of steps that are the same regardless of what task you are attempting. 1. Identify the Page 2. Publish the Web Service 3. Test the URL in a Web Browser 4. Add a Service Reference to Your Project 5. Write Some Code. 847-590-3000 info@solsyst.com
  • 3. Identify the Page Interactions with NAV start with your requirements. For this sample, we will assume that you have been asked to display a list of Items for sale. Any User Interface in NAV can be published as a Web Service. This allows you to manipulate data through Web Services as if you were using NAV itself. This also means that all of Navision’s validation routines are run when you attempt to modify data. So, the first step then, is to identify the User Interface or “Page” that an end- user would use to accomplish the task. Looking around in NAV, you find the Items for sale in a convenient, “Item List” interface. 847-590-3000 info@solsyst.com
  • 4. This leads to the biggest “gotcha” with NAV Web Services. Since you want to show a list of Items, the intuitive step would be to use the “Item List” interface. This is wrong. What you want to do is use the single item interface. For our purposes, that means we want to use the detail view for one Item (the “Item Card”) that is accessed by double-clicking an item in the above list. Once you are on the detail page, select About This Page from the Help menu. 847-590-3000 info@solsyst.com
  • 5. This opens up a Help Screen that tells you the Page Name and Number needed for the next step. It also tells you the Source Table that the data comes from in case you want to poke around in SQL and make sure you are getting the data you think you are. Now we know we want Page 30 – Item Card. 847-590-3000 info@solsyst.com
  • 6. Publish the Web Service This is the easy part. Navigate to the Web Services interface (Departments->Administration->IT Administration->General->Web Services) and select the New button. Object Type is Page (We’ll talk about the other types later). Object ID is 30 – This is the Page Number that we identified in the earlier step. Service Name – This becomes part of the URL that you use to access the Web Service, so pick something simple and memorable. I picked “Item” for this. Check the Published checkbox. That’s it. Your Web Service is now available. 847-590-3000 info@solsyst.com
  • 7. Test the URL in a Web Browser This is the pattern for your Web Service URL: http://<Server>:<WebServicePort>/<S erverInstance>/WS/<CompanyName> /Page/<ServiceName> Microsoft fully explains each piece of the URL here: http://msdn.microsoft.com/en- us/library/dd355398.aspx Most of the pieces of the URL can be discovered using the Select Server dialog in the NAV Role-Tailored Client. 847-590-3000 info@solsyst.com
  • 8. For this sample, Server = 192.168.10.12 – you can use a Windows Name on your local network (e.g. NAVSERVER) or). you can use an internet address such as (navservices.cronuscorp.net Although, if you publish over the internet, you will want to use SSL. This is a bit beyond the scope of this article, but you need to send a Windows Login to NAV Web Services, so be sure you or your network administrator fully understand the security implications of what you are doing if you expose services over the public internet. 847-590-3000 info@solsyst.com
  • 9. For SOAP Services Port is 7047 by default. The Server Instance in this case is commercer2 So, the first part of the URL would be: http://192.168.10.12:7047/commercer2 Finishing up, the next part is the constant string WS. 847-590-3000 info@solsyst.com
  • 10. The Company Name is the company you wish to connect to. We will use CRONUS Supply, Inc. from the Select Server dialog. The rest of the information comes from the Web Services page in NAV where you published the service. The next piece is the Object Type from the Web Services page. Ours will be Page because that is the only type we know how to use right now. Finally, the Service Name is the name we gave when we published the service. Item for our example. This then is our final URL: http://192.168.10.12:7047/commercer2 /WS/CRONUS%20Supply,%20Inc/Pag e/Item 847-590-3000 info@solsyst.com
  • 11. If you open that in a Web Browser and everything has been set up properly, you will get this XML to the right in reply This is the simplest way to be sure you have the URL correct and the infrastructure is available before you sit down to write code. If the Web Service does not send XML to the browser, then you will need to work with your Network Administrator to be sure the services are published and you are using the correct URL. 847-590-3000 info@solsyst.com
  • 12. Add a Service Reference to Your Project After all that, we are ready to open up Visual Studio and get to work. I set up a simpleASP.NET Empty Web Site using the File -> New Web Site dialog in Visual Studio. Once you have your project started, right-click on your project in Solution Explorer and select Add Service Reference… 847-590-3000 info@solsyst.com
  • 13. In the Add Service Reference dialog, paste the URL for the service from the earlier step and select the Go button. The Namespace field is how you will refer to the generated code in your project, so I like to change the default to something a bit more descriptive. I used ItemService for this sample. 847-590-3000 info@solsyst.com
  • 14. Write Some Code At this point, you are ready to write some code to perform the task at hand. I will break down some of the more common tasks in separate posts, because the above preliminary work is the same regardless of the task. What’s Next? We get to see some code. The code samples will break out like this: Simple read of Items Reading a Header/Line document such as a Sales Quote. Using Filters to limit the data returned. Sample is Sales Quote for Customer 10000 (The Cannon Group PLC) Create a new Sales Order Overview of Codeunits and other Object Types. References MSDN Reference “How to build a URL”: http://msdn.microsoft.com/en-us/library/dd355398.aspx Want More Microsoft DynamicsTips? View My Blog 847-590-3000 info@solsyst.com