Hi Erwin, AFAIK it should be the calling thread who is closing the socket upon sending the response or finishing the message flow.
IMHO you might not be able to avoid that 20 sec delay, cause the file anyway has to be transfered before closing the socket. You can use an async client or you can send one way fire and forget requests to make the client non-blocking. AFAICS even a server side async service will not be able to solve this problem. ~Thilina On 8/16/06, Pader, Erwin <[EMAIL PROTECTED]> wrote:
i just modified the code (see below) so that instead of passing the OMElement to the ftp thread, i will just be passing the datahandler. however, it is precisely in the data handler where the bottleneck occurs which renders this solution useless. public OMElement mtomService(OMElement element) throws Exception { //ThreadedFTPService goFTP = new ThreadedFTPService(element); //goFTP.start(); OMElement _fileNameEle = null; OMElement _fileElement = null; for (Iterator _iterator = element.getChildElements(); _iterator.hasNext();) { OMElement _ele = (OMElement) _iterator.next(); System.out.println("element: " + _ele.getLocalName()); if (_ele.getLocalName().equalsIgnoreCase("fileName")) { _fileNameEle = _ele; continue; } if (_ele.getLocalName().equalsIgnoreCase("file")) { _fileElement = _ele; if (_fileNameEle == null || _fileElement == null ) { try { throw new AxisFault("Either Image or FileName is null"); } catch (AxisFault e) { e.printStackTrace(); } } String fileName = _fileNameEle.getText(); _fileElement.build(); _fileElement.buildNext(); _fileElement.detach(); OMText binaryNode = (OMText) _fileElement.getFirstOMChild(); SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); System.out.println("start time: " + timeFormat.format(new Date())); DataHandler actualDH = (DataHandler) binaryNode.getDataHandler(); System.out.println("end time: " + timeFormat.format(new Date())); ThreadedFTPService goFTP = new ThreadedFTPService(fileName, actualDH); goFTP.start(); } } OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace ns = fac.createOMNamespace("urn://fakenamespace", "ns"); OMElement ele = fac.createOMElement("response", ns); ele.setText("File Saved"); return ele; } -----Original Message----- From: Pader, Erwin [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 16, 2006 12:01 PM To: axis-user@ws.apache.org Subject: need help with service design issue Hi All, we are planning to use axis2 to send hospital patient info using mtom (including scanned images, pdf docs, etc) to a service. this service will then start a new thread whose only function is to ftp the binary attachment to an external system. the service passes the whole OMElement to the ftp thread. the problem is it looks like the new thread closes or resets the socket connection to the binary attachment causing an exception. if i do not start a new thread my service will be tied up as it tries to readin in the attachment (DataHandler actualDH = (DataHandler) binaryNode.getDataHandler();). a 10 mb files takes 20 secs for my service to get the data handler. i need all your help please for a better solution to this. thanks! Erwin Pader HMA, Inc. Naples FL --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- "May the SourcE be with u" http://webservices.apache.org/~thilina/ http://thilinag.blogspot.com/ http://www.bloglines.com/blog/Thilina --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]