I have created a java program that reads barcode data from a handheld scanner. I then want to send the data to a website via a webservice. the webservice is expecting the barcode data as a string. When I pass the barcode data I have read to the webservice function it does nothing. If I declare a string in java and initialize it to a string of barcodes I enter, it works fine, so the service is working correctly, it just seems to be not excepting my barcode string read from the scanner. I contain display the barcodes from the scanner in a message box and they look fine. Here is some of the code.
This reads the barcodes from the scanner and puts them in a comma separated string.
public String readbuttonGetPacket() {
byte[] bd = new byte[100];
String BCreturn = "";
int MaxLen = 80;
int stat2 = 0;
csp2DLL csp2 = csp2DLL.INSTANCE;
if (initscanner()) {
stat = csp2.csp2ReadData();
for(int i=0; i<stat; i++) {
stat2 = csp2.csp2GetPacket(bd,i,MaxLen);
if (i + 1 == stat) {
BCreturn = BCreturn + Native.toString(bd);
} else {
BCreturn = BCreturn + Native.toString(bd) + ',';
}
}
}
return BCreturn;
}
This is the code when you press the read button.
public String BCstring = "";
if (READ_COMMAND.equals(command)) {
ButtonClick readev = new ButtonClick();
stat = readev.readbuttonClick();
BCstring = readev.readbuttonGetPacket();
String response = importBarcodes(ReadScannerApplication.acctnum,ReadScannerApplication.username,
ReadScannerApplication.po,ReadScannerApplication.gridid,BCstring);
JOptionPane.showMessageDialog(readPanel,response);
This is the definition of the webservice function:
private static String importBarcodes(java.lang.String acctnum, java.lang.String username, java.lang.String po, java.lang.String gridid, java.lang.String barcodes) {
localhost._58191.OrderLinkWebService service = new localhost._58191.OrderLinkWebService();
localhost._58191.OrderLinkWebServiceSoap port = service.getOrderLinkWebServiceSoap();
return port.importBarcodes(acctnum, username, po, gridid, barcodes);
}