Options

Problem with creation of Sales Order with NAV web services

stomar_3stomar_3 Member Posts: 26
edited 2009-10-02 in NAV Three Tier
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

Sign In or Register to comment.