web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

NAV Web Services Connectivity Samples

Roberto Stefanetti Profile Picture Roberto Stefanetti 12,998

NAV Web Services Connectivity Samples
(Many Samples reposted from original Freddy Blog posts)

...best blog posts available "AS TODAY" about Web Services Connectivy & Integration (my opinion!)

Web Services Infrastructure and how to Create an Internal Proxy
http://blogs.msdn.com//b/freddyk/archive/2010/01/30/web-services-infrastructure-and-how-to-create-an-internal-proxy.aspx

Connecting to NAV Web Services from C# using Web Reference
http://blogs.msdn.com/b/freddyk/archive/2010/01/20/connecting-to-nav-web-services-from-c-using-web-reference.aspx

Connecting to NAV Web Services from Visual Basic .net using Web Reference
http://blogs.msdn.com/b/freddyk/archive/2010/01/20/connecting-to-nav-web-services-from-visual-basic-net-using-web-reference.aspx

Connecting to NAV Web Services from Java
http://blogs.msdn.com//b/freddyk/archive/2010/01/19/connecting-to-nav-web-services-from-java.aspx

Connecting to NAV Web Services from the Cloud–Part 1 out of 5
http://blogs.msdn.com/b/freddyk/archive/2010/12/01/connecting-to-nav-web-services-from-the-cloud-part-1-out-of-5.aspx

Connecting to NAV Web Services from Windows Mobile 6.5
http://blogs.msdn.com/b/freddyk/archive/2010/01/25/connecting-to-nav-web-services-from-windows-mobile-6-5.aspx

Extending page Web Services (and creating a Sales Order again)
http://blogs.msdn.com//b/freddyk/archive/2009/11/17/extending-page-web-services-and-creating-a-sales-order-again.aspx

 
...

About the last above... Great post !!!  

Extending page Web Services, "Creating a Sales Order through Web Services"

http://blogs.msdn.com//b/freddyk/archive/2009/11/17/extending-page-web-services-and-creating-a-sales-order-again.aspx

CREATE ORDER
Creating the Order header

Order_Service service = new Order_Service();
service.UseDefaultCredentials = true;

Order order = new Order();
service.Create(ref order);

After this we have a Order Number and an empty order – exactly like leaving the order No. field on the Sales Order Page.
Fill out the Order Header and create the Order lines
In this sample I will just fill out the Sell_to_Customer_No – a number of the other Order Header fields will be auto-updated when updating the order

CREATE ORDER LINES

order.Sell_to_Customer_No = "10000";

Then we need to create the Order lines

in this sample I will create 5. BTW – It is NOT trivial to add an order line after the fact, so I suggest you add the needed number of lines in one go:

order.SalesLines = new Sales_Order_Line[5];
for (int i = 0; i < 5; i++)
    order.SalesLines[i] = new Sales_Order_Line();
service.Update(ref order); 

Fill out the Order lines
In this sample, I will just create 5 lines with green ROME guest chairs.

for (int i = 0; i < 5; i++)
{
    order.SalesLines[i].Type = OrderPageRef.Type.Item;
    order.SalesLines[i].No = "1960-S";
    order.SalesLines[i].Quantity = 1;
}
service.Update(ref order);

That’s it – the order is created and you can find it in the Client.
And at last… – Post the order

Having created the order, now it is time to post the order

service.PostOrder(order.Key);

.....


Great Posts about NAV Web Services by "Freddy Blog"and Great Blog!

by Freddy Kristiansen
PM Architect, Microsoft Dynamics NAV
http://blogs.msdn.com/b/freddyk/


This was originally posted here.

Comments

*This post is locked for comments