I have tried this, and have had no luck. I'm using this in WorkWithShipmentPlans.bsh:

//----------
Map screenInMap = UtilMisc.toMap("orderId", "WS10000");
String printerName = "LaserJet-2420";
Map inMap = UtilMisc.toMap("screenLocation",
"component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF",
"printerName", printerName,
"userLogin", userLogin,
"screenContext", screenInMap);

dispatcher.runAsync("sendPrintFromScreen", inMap);
//------------

and I've modified this line in PrintServices.java:

//------------
String errMsg = "The following printer was not found: [" + printerUriObj.toString() + "].";
//------------

and I've verified that I can print to this printer from Linux:

//------------
[EMAIL PROTECTED]:~$ lpstat -dP
system default destination: LaserJet-2420
[EMAIL PROTECTED]:~$ lpr -P LaserJet-2420 planes
//------------

and I get this error message in the OfBiz Log:

//------------

2007-03-21 16:25:25,617 (default-invoker-Thread-2) [ PrintServices.java:159:ERROR] The following printer was not found: [LaserJet-2420]. 2007-03-21 16:25:25,618 (default-invoker-Thread-2) [ ServiceDispatcher.java:415:ERROR] Service Error [sendPrintFromScreen]: The following printer was not found: [LaserJet-2420]. 2007-03-21 16:25:25,618 (default-invoker-Thread-2) [ TransactionUtil.java:252:ERROR] ---- exception report ----------------------------------------------------------
[TransactionUtil.rollback]
Exception: java.lang.Exception
Message: Stack Trace
---- stack trace ---------------------------------------------------------------
java.lang.Exception: Stack Trace
org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:251)
org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:233)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:419)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:211)
org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
org.ofbiz.service.job.GenericServiceJob.exec(GenericServiceJob.java:70)
org.ofbiz.service.job.JobInvoker.run(JobInvoker.java:221)
java.lang.Thread.run(Thread.java:595)
--------------------------------------------------------------------------------

2007-03-21 16:25:25,620 (default-invoker-Thread-2) [ TransactionUtil.java:262:INFO ] [TransactionUtil.rollback] transaction rolled back 2007-03-21 16:25:25,621 (default-invoker-Thread-2) [ ServiceDispatcher.java:459:DEBUG] [[Sync service finished- total:1.922,since last(Begin):1.923]] - 'JobDispatcher / sendPrintFromScreen' 2007-03-21 16:25:25,621 (default-invoker-Thread-2) [ GenericServiceJob.java:117:ERROR] ---- exception report ----------------------------------------------------------
Async-Service failed.
Exception: java.lang.Exception
Message: The following printer was not found: [LaserJet-2420].
---- stack trace ---------------------------------------------------------------
java.lang.Exception: The following printer was not found: [LaserJet-2420].
org.ofbiz.service.job.GenericServiceJob.exec(GenericServiceJob.java:76)
org.ofbiz.service.job.JobInvoker.run(JobInvoker.java:221)
java.lang.Thread.run(Thread.java:595)
--------------------------------------------------------------------------------
//-----------

Thoughts?


Jacopo Cappellato wrote:
Yes, literally millions of examples.

However, this morning I've committed a first draft of the service in svn so I'd suggest you to update your local copy with a clean trunk and then you can test it, for example, in this way:

//============================
Map screenInMap = UtilMisc.toMap("orderId", orderId);
Map inMap = UtilMisc.toMap("screenLocation",
"component://order/widget/ordermgr/OrderPrintForms.xml#OrderPDF",
"printerName", "//server/printer",
"userLogin", userLogin,
"screenContext", screenInMap);

dispatcher.runAsync("sendPrintFromScreen", inMap);
//============================

A quick way to run this code is to copy it at the bottom of a bsh script, for example: applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.bsh

then you'll submit the service call every time you'll visit the page:

https://localhost:8443/manufacturing/control/WorkWithShipmentPlans

You can edit the bsh script without the need to build and restart the server.

Jacopo


Scott Gray wrote:
I think it's a LocalDispatcher, but don't quote me on that. Anyway there's
a million examples in code, just search for runSync


On 20/03/07, David Shere <[EMAIL PROTECTED]> wrote:

Thanks!  That's the line I was missing.  I must ask, though, what class
is "dispatcher" and how do I construct it?

(I think I was dealing with ServiceXaWrapper)

Scott Gray wrote:
> Map results = dispatcher.runSync("myService", inputMap);






--
David Shere
Information Technology Services
Steele Rubber Products
www.SteeleRubber.com

Reply via email to