I used the Download Java - Apache Axis sample application from
https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3421207.html#Downloading-Sample-Applications
I wanted to use it to understand SuiteTalk and also change the program so that I could information on assembly items e.g. product name, description, barcode and available quantity.
I set the project up in NetBeans. Stepped through different parts of the Java code to understand the working of it.
I changed option 6 to get assembly item information instead of customer.
I changed the code in Fields.java to the below:
public Fields(AssemblyItem assemblyitem) {
super();
put(INTERNAL_ID, assemblyitem.getInternalId());
put(DISPLAYNAME, assemblyitem.getDisplayName());
put(BARCODE, assemblyitem.getUpcCode());
}
The above code works fine and I get the requested information for any item that is queried when the program is run.
But once I add this line:
put(QTYAVAIL, assemblyitem.getQuantityAvailable());
I get warning: Incompatible types: Double cannot be converted to String
As the put function requires two strings had to change the call getQuantityAvailable() to put(QTYAVAIL, assemblyitem.getQuantityAvailable().toString());
When I run the program I get:
Internal ID of record to be retrieved: 6363
Record returned from get() operation:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.lang.Double.toString()" because the return value of "com.netsuite.suitetalk.proxy.v2023_1.lists.accounting.AssemblyItem.getQuantityAvailable()" is null
at com.netsuite.webservices.samples.Fields.<init>(Fields.java:62)
at com.netsuite.webservices.samples.ResponseHandler.processCustomerReadResponse(ResponseHandler.java:101)
at com.netsuite.webservices.samples.SampleOperations.lambda$getCustomer$11(SampleOperations.java:419)
at com.netsuite.webservices.samples.SampleOperations.run(SampleOperations.java:137)
at com.netsuite.webservices.samples.SampleApplication.main(SampleApplication.java:35)
There is an available quantity for item id 6363 in NetSuite but null is been returned
Any help to resolve this would be greatly appreciated.
Thanks
Michael