How can a Web Service Integration return printer / print job related information?
Question
The %Response% variable includes no information when a print fails. How can I configure my web-service integration so that it returns information about printer / print job status.
Answer
There are several variables available for this to work:
The response action within your Integration offers you two variables that gather information about the printer's job and status. These two variables will offer us valid and usable information when the job succeeds and the variable name when the job fails
The third variable is an integration-based variable which will only show information when an integration failed:
Crafting the response
In the response action in your integration, you'll need to create your own response. For this, I've used plain text for simplicity's sake:
Embedded response template:
Print Job Status = %PrintJobStatus%
Print Job Messages = %PrintJobMessages%
Last error message = %LastErrorMessage%
Sample responses
Successful print will show the status as successful and the message will confirm this. The error message is blank so it simply prints the variable name.
Job Status = Success
Print Job Messages = BarTender successfully sent the print job to the spooler.
Job Name: resttest2.btw
Document: resttest2.btw
Printer: Zebra ZT420 (300 dpi)
Last error message = %LastErrorMessage%
Failed response example will show the error message but not the print status:
Print Job Status = %PrintJobStatus%
Print Job Messages = %PrintJobMessages%
Last error message = Print job 'resttest2.btw' did not complete due to the following error: BarTender cannot use printer 'fakeprinter' to design, print, or export a template due to a printer setup problem.
A Windows error code was returned: 1801
Error message: The printer name is invalid.
There are several possible reasons:
1) The printer is not turned on or is off line. Try printing a test page from Windows.
2) The printer does not exist on your system or network.
3) Security settings prevent access to the printer.
4) If you use a network for printing, there may be a problem with the network connection or the printer driver.
5) There may not be enough memory available. Try closing files and programs you aren't using.
6) The printer driver is installed incorrectly. Try reinstalling the printer driver.