I’m trying to create a reservation entry through the Code Unit exposed from a SOAP web service. We’re trying to create an Item Journal entry and associate a Lot to it. I’m able to create the Item Journal entry through the Web Services. I’m running into issues when I try to create the reservation.
I’ve been looking through the database to compare the record that I’ve created though the UI to make sure that I’m properly setting IDs, etc. From what I can tell, everything seems to be setup properly (obviously not though)
Here is my code:
CreateReservationEntry createReservationEntry = new CreateReservationEntry
{
UseDefaultCredentials = true
};
createReservationEntry.SetDates(DateTime.MinValue, DateTime.MinValue);
createReservationEntry.CreateReservEntryFor(83, 2, "ITEM", "TEST", 0, 10000, 1, 10, 10, "", "ERIC3");
createReservationEntry.CreateEntry("WP0001", "", "LOCATION", "", DateTime.Now, DateTime.MinValue, 0, 2);
When the last line is executed I get the error:
System.Web.Services.Protocols.SoapException
HResult=0x80131501
Message=Source Type must have a value in Reservation Entry: Entry No.=0, Positive=No. It cannot be zero or empty.
Source=System.Web.Services
StackTrace:
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 ConsoleApp2.WebReference.CreateReservationEntry.CreateEntry(String itemNo, String variantCode, String locationCode, String description, DateTime expectedReceiptDate, DateTime shipmentDate, Int32 transferredFromEntryNo, Int32 status) in C:\Users\erico\source\repos\ConsoleApp2\ConsoleApp2\Web References\WebReference\Reference.cs:line 163
at ConsoleApp2.Program.Main(String[] args) in C:\Users\erico\source\repos\ConsoleApp2\ConsoleApp2\Program.cs:line 21
From what I understood, the first parameter of the CreateReservEntryFor function is the Source Type. 83 matches the Source Type that was in the database for the record that I created through the UI.
Finally, I’m using the codeunit for this rather than the ‘Item Tracking Lines’ SOAP page since there’s an error with the base code mapping two fields to the same name. If someone has a suggestion for how to fix that instead I’d be willing to try changing direction.
Anyone have any ideas what I’m missing?