1 16 package sample.amazon.amazonSimpleQueueService.util; 17 18 import org.apache.axis2.Constants; 19 import org.apache.axis2.addressing.AddressingConstants; 20 import org.apache.axis2.addressing.EndpointReference; 21 import org.apache.axis2.clientapi.Call; 22 import org.apache.axis2.clientapi.Callback; 23 import org.apache.axis2.engine.AxisFault; 24 import org.apache.axis2.om.OMElement; 25 import sample.amazon.amazonSimpleQueueService.OMElementCreator; 26 27 import javax.swing.*; 28 29 34 public class RunnableReadQueue extends QueueManager implements Runnable { 35 JTextField createQueue; 36 JTextArea result; 37 JTextField queueCode; 38 JTextField read; 39 40 public RunnableReadQueue(JTextField createQueue, JTextField queueCode, JTextField read, 41 JTextArea result) { 42 this.createQueue = createQueue; 43 this.queueCode = queueCode; 44 this.read = read; 45 this.result = result; 46 } 47 48 public void run() { 49 OMElement readQueueElement = OMElementCreator.read(this.createQueue.getText(),getKey()); 50 this.axis2EngineRuns("Read", readQueueElement, 51 new SimpleQueueReadCallbackHandler(this.queueCode, this.result)); 52 } 53 54 private void axis2EngineRuns(String operation, OMElement element, 55 Callback specificCallbackObject) { 56 String url = "http://webservices.amazon.com/onca/soap?Service=AWSSimpleQueueService"; 58 try { 59 Call call = new Call(); 60 call.setTo(new EndpointReference(AddressingConstants.WSA_TO, url)); 61 call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false); 62 call.invokeNonBlocking(operation, element, specificCallbackObject); 63 } catch (AxisFault axisFault) { 64 axisFault.printStackTrace(); 65 } catch (Exception e) { 66 e.printStackTrace(); 67 } 68 } 69 70 } 71 | Popular Tags |