Package async

Examples of async.AsyncResponseHandler


        return;
      }

      WSIFOperation op = port.createOperation("getAddressFromName");

      AsyncResponseHandler abHandler = new AsyncResponseHandler(1);
      // 1 async call

      WSIFMessage inMsg = op.createInputMessage();
      inMsg.setObjectPart("name", "fred");

      WSIFMessage outmsg = op.createOutputMessage();
      WSIFMessage faultMsg = op.createFaultMessage();

      WSIFMessage context = op.getContext();
      context.setObjectPart(
        WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo",
        TestUtilities.getWsifProperty("wsif.async.replytoq"));

      if ("SOAPJMSPort2".equals(portName)
        || "NativeJmsPort2".equals(portName)) {
        inMsg.setObjectPart("asyncTimeout", "" + spa2);
      }
      if ("SOAPJMSPort3".equals(portName)
        || "NativeJmsPort3".equals(portName)
        || "SOAPJMSPort6".equals(portName)
        || "NativeJmsPort6".equals(portName)) {
        context.setObjectPart(
          WSIFConstants.WSIF_PROP_ASYNC_TIMEOUT,
          "" + spa3);
      }

      op.setContext(context);

      WSIFCorrelationId id =
        op.executeRequestResponseAsync(inMsg, abHandler);
      assertTrue(
        "null correlation id returned from async request!",
        id != null);

      int i = 30;
      while (i-- > 0 && !abHandler.isDone()) {
        System.out.println("waiting for async responses - " + i);
        try {
          Thread.sleep(1000);
        } catch (InterruptedException ex) {
        }
View Full Code Here


      //   assertTrue( "exception executing request: " + ex.getMessage(), false );
      //}
  }

  private WSIFMessage doAsyncOp(WSIFOperation op, WSIFMessage input, WSIFMessage context) throws WSIFException{
      AsyncResponseHandler handler = new AsyncResponseHandler(1); // 2 async calls
      context.setObjectPart( WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo",
                             TestUtilities.getWsifProperty("wsif.async.replytoq") );
      op.setContext( context );
      WSIFCorrelationId id = op.executeRequestResponseAsync(input, handler);

      int i = 5// 15 seconds timout
      while ( i-- > 0 && !handler.isDone() ) {
         System.out.println( "async requests sent, waiting for responses - " + i );
       try {
        Thread.sleep(3000);
       } catch (InterruptedException ex) {}
      }
      assertTrue( "no response to async operation!", i > 0 ); // no responses in time
      return handler.getOutputs()[0];
  }
View Full Code Here

              return;
            }   

            WSIFOperation op = port.createOperation( "getAddressFromName" );
           
            AsyncResponseHandler abHandler = new AsyncResponseHandler( 1 ); // 1 async call

            WSIFMessage inMsg = op.createInputMessage();
            inMsg.setObjectPart( "name", name );

            WSIFMessage outmsg = op.createOutputMessage();
            WSIFMessage faultMsg = op.createFaultMessage();

            WSIFMessage context = op.getContext();
            context.setObjectPart( WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo",
                                   TestUtilities.getWsifProperty("wsif.async.replytoq") );
            op.setContext( context );

            WSIFCorrelationId id = op.executeRequestResponseAsync(inMsg, abHandler);
            assertTrue("null correlation id returned from async request!", id != null );

            int i = 10;
            while (i-- > 0 && !abHandler.isDone()) {
                System.out.println( "waiting for async responses - " + i );
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException ex) {
                }
            }
            assertTrue("no response from async operation!",i > 0); // no responses in time

            WSIFMessage[] faults = abHandler.getFaults();
            WSIFMessage[] outputs = abHandler.getOutputs();
            Address respAddr = (Address) outputs[0].getObjectPart("address");
            assertTrue("incorrect address response!", addr.equals(respAddr));

       } catch (Exception ex) {
           ex.printStackTrace();
View Full Code Here

TOP

Related Classes of async.AsyncResponseHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.