Dear Frends,
I have one issue and hope that you maybe can help me.
Namely, I want to make one web service which will create Sales Order in Dynamics. In this process I am very close to the end but have one problem for which need assistence from somebody who has a reach experience with NAV web services developing.
This is web services which I made in C#
[WebMethod]
public string CreateSalesOrderNAvision()
{
// Create Service Reference
SalesOrder1_Service service = new SalesOrder1_Service();
service.UseDefaultCredentials = true;
service.Url = "
http://mascnl:7047/DynamicsNAV/ws/CRONUS_International_Ltd/Page/SalesOrder1";
// Create the Order header
SalesOrder1.SalesOrder1 newOrder = new SalesOrder1.SalesOrder1();
service.Create(ref newOrder);
newOrder.Sell_to_Customer_No = "38128456";
newOrder.Order_Date = DateTime.Today;
newOrder.SalesLines = new Sales_Order_Line[2];
for (int idx = 0; idx < 2; idx++)
newOrder.SalesLines[idx] = new SalesOrder1.Sales_Order_Line();
service.Update(ref newOrder);
Sales_Order_Line line1 = newOrder.SalesLines[0];
line1.
line1.Type = SalesOrder1.Type.Item;
line1.TypeSpecified = true;
line1.No = "L1976-W";
line1.Quantity = 3;
line1.QuantitySpecified = true;
Sales_Order_Line line2 = newOrder.SalesLines[1];
line2.Type = SalesOrder1.Type.Item;
line2.TypeSpecified = true;
line2.No = "L1976-W";
line2.Quantity = 33;
line2.QuantitySpecified = true;
service.Update(ref newOrder);
return "Order Created";
}
}
But when want to execute this web services get this error message :
System.Web.Services.Protocols.SoapException: The date is not valid.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at SalesOrder1.SalesOrder1_Service.Update(SalesOrder1& SalesOrder1) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\websiteskeltanav\a7712f9a\62ad9408\App_WebReferences.xktyv-k8.1.cs:line 301
at Service.HelloWorld() in c:\Inetpub\wwwroot\WebSiteSkeltaNAV\App_Code\Service.cs:line 43
Can somebody help me and offer a good solution for Sales Order creation with web services.
thanks in advance
Comments
You can find some info here about page based sales order creation
http://blogs.msdn.com/freddyk/archive/2009/05/28/handling-sales-orders-from-page-based-web-services-in-nav-2009sp1-and-rtm.aspx
Hope that helps
Group Program Manager, Client
Microsoft Dynamics NAV
http://blogs.msdn.com/freddyk
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
Thank you on your help. Acctually I used your blog as a reference to create this Web Services.
Did you already tested some simmilar services, if you did it, can you send me a code of that, that I can test in my environement.
Once again thanks on your efforts.