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 RunnableListMyQueues extends QueueManager implements Runnable { 35 JTextField createQueue; 36 JTextArea result; 37 JTextField queueCode; 38 JTextField read; 39 JButton button; 40 41 public RunnableListMyQueues(JTextField createQueue, JTextField queueCode, JTextField read, 42 JTextArea result, JButton button) { 43 this.createQueue = createQueue; 44 this.queueCode = queueCode; 45 this.read = read; 46 this.result = result; 47 this.button = button; 48 } 49 50 public void run() { 51 OMElement listMyQueuesElement = OMElementCreator.queueListElement(getKey()); 52 this.axis2EngineRuns("ListMyQueues", listMyQueuesElement, 53 new SimpleQueueListMyQueuesCallbackHandler(this.createQueue, this.queueCode, 54 this.read, this.result, this.button)); 55 } 56 57 private void axis2EngineRuns(String operation, OMElement element, 58 Callback specificCallbackObject) { 59 String url = "http://webservices.amazon.com/onca/soap?Service=AWSSimpleQueueService"; 61 try { 62 Call call = new Call(); 63 call.setTo(new EndpointReference(AddressingConstants.WSA_TO, url)); 64 call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false); 65 call.invokeNonBlocking(operation, element, specificCallbackObject); 66 } catch (AxisFault axisFault) { 67 axisFault.printStackTrace(); 68 } catch (Exception e) { 69 e.printStackTrace(); 70 } 71 } 72 73 } 74 | Popular Tags |