Package org.apache.wsif

Examples of org.apache.wsif.WSIFMessage


            else
                port = fieldService.getPort();

            WSIFOperation operation = port.createOperation("ShortZipCode", null, null);

            WSIFMessage inputMessage = operation.createInputMessage();
            inputMessage.setName("ShortZipCodeSoapIn");

            WSIFMessage outputMessage = operation.createOutputMessage();
            outputMessage.setName("ShortZipCodeSoapOut");

            inputMessage.setObjectPart("parameters", input);

            operation.executeRequestResponseOperation(inputMessage, outputMessage, null);

            return (ShortZipCodeResponse) outputMessage.getObjectPart("parameters");

        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());
        }
View Full Code Here


      WSIFPort port = service.getPort(portName);

      // Executing synchronous executeRequestResponseOperation(input, output, fault )
      WSIFOperation operation = port.createOperation(operationName);

      WSIFMessage context = operation.getContext();
      context.setObjectPart( WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo",
                             TestUtilities.getWsifProperty("wsif.nativejms.responseq") );
      operation.setContext( context );

      WSIFMessage input = operation.createInputMessage();
      input.setName("GetQuoteInput");
      input.setObjectPart("symbol", "" );

      WSIFMessage output = operation.createOutputMessage();
      WSIFMessage fault = operation.createFaultMessage();

      doSyncOp( operation, input, output, context );
      float value = ((Float)output.getObjectPart( "quote" )).floatValue();
      System.out.println("sync stockquote found value = " + value);
      assertTrue( "doSyncOp stockquote value incorrect!",
View Full Code Here

      WSIFPort port = service.getPort(portName);

      WSIFOperation operation = port.createOperation(operationName,
                                  "AddEntryWholeNameRequest", null);

      WSIFMessage input = operation.createInputMessage();
      input.setObjectPart("name", name1);
      input.setObjectPart("address", addr1);

      operation.executeInputOnlyOperation(input);

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

      String inputMsgName = "GetAddressFromNameRequest";
      String outputMsgName = "GetAddressFromNameResponse";
      WSIFOperation operation =
        port.createOperation(operationName, inputMsgName, outputMsgName);

      WSIFMessage context = operation.getContext();
      context.setObjectPart( WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo",
                             TestUtilities.getWsifProperty("wsif.nativejms.responseq") );
      operation.setContext( context );
   
      WSIFMessage input = operation.createInputMessage();
      input.setObjectPart("name", name1);

      WSIFMessage output = operation.createOutputMessage();
      WSIFMessage fault = operation.createFaultMessage();

      doSyncOp( operation, input, output, context );
     
      Address addressResponse = (Address) output.getObjectPart("address");
      System.out.println("Found address = " + addressResponse);
View Full Code Here

  private void doSyncOp(WSIFOperation op,
                                WSIFMessage input, WSIFMessage output, WSIFMessage context) {
      try {
         op.setContext( context );
         WSIFMessage fault = op.createFaultMessage();
         boolean ok = op.executeRequestResponseOperation(input, output, fault );
         assertTrue( "executeRequestResponseOperation returned false!", ok );
      } catch (Exception ex) {
          ex.printStackTrace();
       assertTrue( "exception executing request: " + ex.getMessage(), false );
View Full Code Here

      assertTrue( "no response to async operation!", i > 0 ); // no responses in time
      return handler.getOutputs()[0];
  }

  private WSIFMessage doAsyncOpNoHandler(WSIFOperation op, WSIFMessage input, WSIFMessage context) {
      WSIFMessage output = null;
      try {
         context.setObjectPart( WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo",
                                TestUtilities.getWsifProperty("wsif.async.replytoq2") );
         context.setObjectPart( "testJMSnoHandler", "true" );
         op.setContext( context );
         WSIFCorrelationId id = op.executeRequestResponseAsync( input );
         System.out.println( "async operation done, correlation id=" + id.getCorrelationId() );
        
        Object jmsResponse =
            TestUtilities.getJMSAsyncResponse(
                id.getCorrelationId(),
                TestUtilities.getWsifProperty("wsif.async.replytoq2"));

         output = op.createOutputMessage();
         WSIFMessage fault = op.createFaultMessage();
         op.processAsyncResponse( jmsResponse, output, fault );
      } catch (Exception ex) {
       ex.printStackTrace();
       assertTrue( "exception executing async op: " + ex.getMessage(), false );
      }
View Full Code Here

        WSIFService service = factory.getService(wsdl, null, null, null, null);

        WSIFPort port = service.getPort();

        WSIFOperation operation;
        WSIFMessage inputMessage;
        WSIFMessage outputMessage;
        WSIFMessage faultMessage;

        String tempString;

        Object part;
        boolean operationSucceeded;
View Full Code Here

        WSIFPort port = (portName == null) ? dpf.getPort() : dpf.getPort(portName);

        System.out.println("HeadersTest executing getQuote for \"\"" + operationName);
        WSIFOperation operation =
            port.createOperation("getQuote", inputName, outputName);
        WSIFMessage input = operation.createInputMessage();
        WSIFMessage output = operation.createOutputMessage();
        WSIFMessage fault = operation.createFaultMessage();
        input.setObjectPart("symbol", "");

        // set a basic authentication header
        WSIFMessage headers = operation.getContext();
        headers.setObjectPart(WSIFConstants.CONTEXT_HTTP_USER, "petra");
        headers.setObjectPart(WSIFConstants.CONTEXT_HTTP_PSWD, "washere");
        operation.setContext(headers);

        boolean ok = operation.executeRequestResponseOperation(input, output, fault);
        System.out.println("operation returned " + ok);
View Full Code Here

                    "JmsFault");

            WSIFPort port = service.getPort("default");
            WSIFOperation operation = port.createOperation(method);

            WSIFMessage inputMessage = operation.createInputMessage();
            inputMessage.setIntPart("choice",choice);
            WSIFMessage outputMessage = operation.createOutputMessage();
            WSIFMessage faultMessage = operation.createFaultMessage();

            boolean operationSucceeded = false;
            if (blocks == SYNC) {
                operationSucceeded =
                    operation.executeRequestResponseOperation(
                        inputMessage,
                        outputMessage,
                        faultMessage);

            } else if (blocks == ASYNC) {
                WSIFMessage context = operation.getContext();
                context.setObjectPart(
                    WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo",
                    TestUtilities.getWsifProperty("wsif.async.replytoq2"));
                operation.setContext(context);

                WSIFCorrelationId id =
View Full Code Here

        }

        WSIFPort port = service.getPort();

        WSIFOperation operation;
        WSIFMessage inputMessage;
        WSIFMessage outputMessage;
        WSIFMessage faultMessage;

        String customerNumber;
        String tempString;
        Address address;
        ShoppingCart_Java shoppingCart;
        Item item;
        CreditCardInfo creditCardInfo;
        AirMilesContainer airMilesContainer;
        Integer currentTotal = null;
        Long orderConfirmationNumber;
        Integer itemQuantity;
        Object part;
        boolean operationSucceeded;

        // -----------------------------------------------------------------------------------------------------
        operation = port.createOperation("createOperation");
        inputMessage = operation.createInputMessage();
        outputMessage = operation.createOutputMessage();
        faultMessage = operation.createFaultMessage();

        debug("\n---> Invocation: public ShoppingCart_Java(String firstName, String lastName, Address address, String customerNumber)");

        tempString = "Albert";
        inputMessage.setObjectPart("firstName", tempString);

        tempString = "Einstein";
        inputMessage.setObjectPart("lastName", tempString);

        address = new Address("Berlin", "Unter den Linden");
        inputMessage.setObjectPart("address", address);

        customerNumber = "AE001";
        inputMessage.setObjectPart("customerNumber", customerNumber);

        operationSucceeded =
            operation.executeRequestResponseOperation(
                inputMessage,
                outputMessage,
                faultMessage);

        assertTrue("Failed to create a ShoppingCart", operationSucceeded);

        // -----------------------------------------------------------------------------------------------------
        operation = port.createOperation("addItemOperation");
        inputMessage = operation.createInputMessage();
        outputMessage = operation.createOutputMessage();
        faultMessage = operation.createFaultMessage();

        debug("\n---> Invocation: public int addItem(String itemNumber, Item item, String itemName, int itemQuantity)");

        tempString = "100123";
        inputMessage.setObjectPart("itemNumber", tempString);

        item = new Item();
        //inputMessage.setObjectPart("item", item);

        tempString = "Pocket calculator";
        inputMessage.setObjectPart("itemName", tempString);

        itemQuantity = new Integer(1);
        inputMessage.setObjectPart("itemQuantity", itemQuantity);

        operationSucceeded =
            operation.executeRequestResponseOperation(
                inputMessage,
                outputMessage,
                faultMessage);

        assertTrue("addItem test failed", operationSucceeded);

        if (operationSucceeded) {
      assertTrue("Part is not an Item!!!",
        outputMessage.getObjectPart("item") instanceof Item);
            debug(outputMessage.getObjectPart("item"));
        } else {
            // Cannot get here since test would have already failed!
        }

        // -----------------------------------------------------------------------------------------------------
        operation = port.createOperation("addItemOperation");
        inputMessage = operation.createInputMessage();
        outputMessage = operation.createOutputMessage();
        faultMessage = operation.createFaultMessage();

        debug("\n---> Invocation: public int addItem(String itemNumber, Item item, String itemName, int itemQuantity)");

        tempString = "234123";
        inputMessage.setObjectPart("itemNumber", tempString);

        item = new Item();
        inputMessage.setObjectPart("item", item);

        tempString = "Pencil";
        inputMessage.setObjectPart("itemName", tempString);

        itemQuantity = new Integer(12);
        inputMessage.setObjectPart("itemQuantity", itemQuantity);

        operationSucceeded =
            operation.executeRequestResponseOperation(
                inputMessage,
                outputMessage,
                faultMessage);

        assertTrue(
            "addItem succeeded when it should have thrown a outOfStockException",
            !operationSucceeded);

        if (operationSucceeded) {
            debug(outputMessage.getObjectPart("item"));
        } else {
            assertNotNull(
                "outputMessage should have contained outOfStockException",
                faultMessage.getObjectPart("outOfStockException"));

            // Extra steps useful for debugging
            /*            part = faultMessage.getObjectPart("invalidItemException");
                        if (part != null) {
                            debug(faultMessage.getName() + ":\n" + part);
View Full Code Here

TOP

Related Classes of org.apache.wsif.WSIFMessage

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.