axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pader, Erwin" <Erwin.Pa...@hma.org>
Subject RE: need help with service design issue (more info)
Date Thu, 17 Aug 2006 11:55:16 GMT
Thilina, thanks for the suggestion.  i tried fireandforget (client code
below) but it looks like it did not go over the wire.  also, i changed the
message receiver class to RawXMLINOnlyMessageReceiver for good measure.  i
checked to see the server log and nothing was out there.  i am using the
8/16 nightly build btw.  thanks.

        	OMFactory fac = OMAbstractFactory.getOMFactory();
        	OMNamespace omNs =
fac.createOMNamespace("http://localhost/my", "my");

        	OMElement method = fac.createOMElement("mtomService", omNs);
        	OMElement coid = fac.createOMElement("coid", omNs);
        	OMElement medRec = fac.createOMElement("medrec", omNs);
        	OMElement patAcct = fac.createOMElement("patacct", omNs);

        	coid.setText("803");
        	medRec.setText("0009039819");
        	patAcct.setText("4020233");
        	
        	method.addChild(coid);
        	method.addChild(medRec);
        	method.addChild(patAcct);
        	
        	fileName = fac.createOMElement("fileName", omNs);
        	file = fac.createOMElement("file", omNs);
        	
        	inputFile = new File("c:\\icd9.txt");
        	fileName.setText(inputFile.getName());
        	expectedDH = new DataHandler(new FileDataSource(inputFile));
        	textData = fac.createOMText(expectedDH, true);
        	file.addChild(textData);
        	
        	method.addChild(fileName);
        	method.addChild(file);        	
        	
        	Options options = new Options();
 
options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        	options.setTo(targetEPR);
        	// 	enabling MTOM in the client side
        	options.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
        	options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
            options.setAction("urn:mtomService");

        	ServiceClient sender = new ServiceClient();
        	sender.setOptions(options);
        	sender.fireAndForget(method);        	

-----Original Message-----
From: Pader, Erwin 
Sent: Wednesday, August 16, 2006 12:49 PM
To: 'axis-user@ws.apache.org'
Subject: RE: need help with service design issue (more info)
Importance: High


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:Erwin.Pader@hma.org]
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: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message