NAV2013R2 SOAP WebService Datatype issue

andrewtandrewt Member Posts: 73
edited 2014-05-21 in NAV Three Tier
Hi all,
I am facing a datatype issue when sending data through a published SOAP Page webservice into NAV. All fields of type Text or Code are properly set with the assigned values while other field types like integer or date remain blank (zero).

The NAV SOAP Webservie has a published Page object. The code piece which I used for testing is as follows:
RequisitionBuffer_Service service = new RequisitionBuffer_Service();
            service.UseDefaultCredentials = true;
            RequisitionBuffer ReqBuffer = new RequisitionBuffer();
            ReqBuffer.External_Request_ID = "EXT000001";
            ReqBuffer.External_Request_Line_No = 10000;
            ReqBuffer.IMO_No = "9531662";
            ReqBuffer.Port_of_Delivery = "DE HAM";
            ReqBuffer.Requested_Receipt_Date =  new DateTime(2014, 8, 24);
            ReqBuffer.Type = Type.Catalog_Service;
            ReqBuffer.No = "IMPA000101";
            ReqBuffer.Description = "ASPARAGUS GREEN FRESH";
            ReqBuffer.Quantity = 100;
            ReqBuffer.Unit_of_Measure_Code = "KGR";
            ReqBuffer.Status = Status.Pending;
            service.Create(ref ReqBuffer);

The string values are received correctly by the NAV record fields, all other field types are not and remain blank or 0.

I used VS 2012 for testing.

Any ideas or hints why this is happening and how to resolve it ?

Thanks in advance
Andrew

Answers

  • kinekine Member Posts: 12,562
    What I remember is, that when you are using page as webservice and you are using create function, it is filling only primary keys. I recommend to use create to create the record and than update/modify to modify the rest of the record.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • andrewtandrewt Member Posts: 73
    Hello Kamil,

    great hint, that works !
    I followed your recomendation and used Create only for the initial record creation and then Update to write the record data. All data is now received properly by the NAV record according to the different data types. The modified .NET code piece is attached below.

    Thanks for your fast response and the great support. Easy to fix if you know how - I like these resolutions...

    Cheers
    Andrew
                RequisitionBuffer_Service service = new RequisitionBuffer_Service();
                service.UseDefaultCredentials = true;
    
                RequisitionBuffer ReqBuffer = new RequisitionBuffer();
                service.Create(ref ReqBuffer);
    
                ReqBuffer.External_Request_ID = "EXT000001";
                ReqBuffer.External_Request_Line_No = 10000;
                ReqBuffer.IMO_No = "9531662";
                ReqBuffer.Port_of_Delivery = "DE HAM";
                ReqBuffer.Requested_Receipt_Date =  new DateTime(2014, 8, 24);
                ReqBuffer.Type = Type.Catalog_Service;
                ReqBuffer.No = "IMPA000101";
                ReqBuffer.Description = "ASPARAGUS GREEN FRESH";
                ReqBuffer.Quantity = 100;
                ReqBuffer.Unit_of_Measure_Code = "KGR";
                ReqBuffer.Status = Status.Pending;                       
                service.Update(ref ReqBuffer);                        
    
Sign In or Register to comment.