Package org.apache.wsif

Examples of org.apache.wsif.WSIFPort


     * echoHexBinary
     * @generated
     */
    public byte[] echoHexBinary(byte[] argInputHexBinary) throws WSIFException {

        WSIFPort port = this.svc.getPort();

        WSIFOperation operation =
            port.createOperation(
                "echoHexBinary",
                "echoHexBinaryRequest",
                "echoHexBinaryResponse");

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

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

        inputMessage.setObjectPart("inputHexBinary", argInputHexBinary);

        operation.executeRequestResponseOperation(inputMessage, outputMessage, null);

        port.close();

        return (byte[]) outputMessage.getObjectPart("return");

    }
View Full Code Here


     * @generated
     */
    public java.math.BigDecimal echoDecimal(java.math.BigDecimal argInputDecimal)
        throws WSIFException {

        WSIFPort port = this.svc.getPort();

        WSIFOperation operation =
            port.createOperation(
                "echoDecimal",
                "echoDecimalRequest",
                "echoDecimalResponse");

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

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

        inputMessage.setObjectPart("inputDecimal", argInputDecimal);

        operation.executeRequestResponseOperation(inputMessage, outputMessage, null);

        port.close();

        return (java.math.BigDecimal) outputMessage.getObjectPart("return");

    }
View Full Code Here

     * echoBoolean
     * @generated
     */
    public boolean echoBoolean(boolean argInputBoolean) throws WSIFException {

        WSIFPort port = this.svc.getPort();

        WSIFOperation operation =
            port.createOperation(
                "echoBoolean",
                "echoBooleanRequest",
                "echoBooleanResponse");

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

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

        inputMessage.setObjectPart(
            "inputBoolean",
            new java.lang.Boolean(argInputBoolean));

        operation.executeRequestResponseOperation(inputMessage, outputMessage, null);

        port.close();

        return ((java.lang.Boolean) outputMessage.getObjectPart("return"))
            .booleanValue();

    }
View Full Code Here

          null,
          null,
          "http://webservices.eraserver.net/",
          "ZipCodeResolverSoap");

      WSIFPort port = service.getPort(portName);

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

      WSIFMessage inMsg = operation.createInputMessage();
      WSIFMessage outMsg = operation.createOutputMessage();
      WSIFMessage faultMsg = operation.createFaultMessage();
      inMsg.setObjectPart("accessCode", "9999");
View Full Code Here

               new javax.xml.namespace.QName(
                   "http://webservices.eraserver.net/",
                   "ShortZipCodeResponse"),
               ShortZipCodeResponse.class );

      WSIFPort port = service.getPort(portName);

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

      WSIFMessage inMsg = operation.createInputMessage();
      WSIFMessage outMsg = operation.createOutputMessage();
      WSIFMessage faultMsg = operation.createFaultMessage();
View Full Code Here

          null,
          null,
          "http://webservices.eraserver.net/",
          "ZipCodeResolverSoap");

      WSIFPort port = service.getPort(portName);
      WSIFOperation operation = port.createOperation("ShortZipCode");
      WSIFMessage inMsg = operation.createInputMessage();
      WSIFMessage outMsg = operation.createOutputMessage();
      WSIFMessage faultMsg = operation.createFaultMessage();

      String inputDocument =
View Full Code Here

        }
        PortType portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName);

        WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
        WSIFService dpf = factory.getService(def, service, portType);
        WSIFPort port = null;
        if (portName == null)
            port = dpf.getPort();
        else
            port = dpf.getPort(portName);

        if (inputName == null && outputName == null) {
            // retrieve list of operations
            List operationList = portType.getOperations();

            // try to find input and output names for the operation specified
            boolean found = false;
            for (Iterator i = operationList.iterator(); i.hasNext();) {
                Operation op = (Operation) i.next();
                String name = op.getName();
                if (!name.equals(operationName)) {
                    continue;
                }
                if (found) {
                    throw new RuntimeException(
                        "Operation '"
                            + operationName
                            + "' is overloaded. "
                            + "Please specify the operation in the form "
                            + "'operationName:inputMessageName:outputMesssageName' to distinguish it");
                }
                found = true;
                Input opInput = op.getInput();
                inputName = (opInput.getName() == null) ? null : opInput.getName();
                Output opOutput = op.getOutput();
                outputName = (opOutput.getName() == null) ? null : opOutput.getName();
            }
        }

        WSIFOperation operation =
            port.createOperation(operationName, inputName, outputName);
        WSIFMessage input = operation.createInputMessage();
        WSIFMessage output = operation.createOutputMessage();
        WSIFMessage fault = operation.createFaultMessage();

        // retrieve list of names and types for input and names for output
View Full Code Here

            while (it.hasNext()) {
                System.out.println((String) it.next());
            }
        }

        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);
                        } else {
                            part = faultMessage.getObjectPart("outOfStockException");
                            if (part != null) {
                                debug(faultMessage.getName() + ":\n" + part);
                            } else {
                                debug("ERROR: Unknown fault message!");
                            }
                        }
            */
        }

        // -----------------------------------------------------------------------------------------------------
        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)");

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

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

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

        inputMessage.setIntPart("itemQuantity", 8);

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

        assertTrue("addItem failed when it should have succeeded", operationSucceeded);

        //Extra steps useful for debugging
        /*        part = faultMessage.getObjectPart("invalidItemException");
                if (operationSucceeded) {
                    debug(outputMessage.getObjectPart("item"));
                } else {
                    part = faultMessage.getObjectPart("invalidItemException");
                    if (part != null) {
                        debug(faultMessage.getName() + ":\n" + part);
                    } else {
                        part = faultMessage.getObjectPart("outOfStockException");
                        if (part != null) {
                            debug(faultMessage.getName() + ":\n" + part);
                        } else {
                            debug("ERROR: Unknown fault message!");
                        }
                    }
                }*/

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

        debug("\n---> Invocation: public long submitOrder(CreditCardInfo creditCardInfo, AirMilesContainer airMilesContainer)");

        creditCardInfo = new CreditCardInfo();
        inputMessage.setObjectPart("creditCardInfo", creditCardInfo);

        airMilesContainer = new AirMilesContainer();
        inputMessage.setObjectPart("airMilesContainer", airMilesContainer);

        inputMessage.setLongPart("orderConfirmationNumber", 0);

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

        assertTrue(
            "submitOrderOperation failed when it should have succeeded.",
            operationSucceeded);

        debug(
            "order confirmation no. = "
                + outputMessage.getObjectPart("orderConfirmationNumber"));
        debug(airMilesContainer);

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

        debug("\n---> Invocation: public static Orders queryOrders(String customerNumber)");
View Full Code Here

            while (it.hasNext()) {
                System.out.println((String) it.next());
            }
        }

        WSIFPort port = service.getPort();
        WSIFOperation operation;
        WSIFMessage inputMessage;
        WSIFMessage outputMessage;
        WSIFMessage faultMessage;

        String customerNumber;
        String tempString;
        Address address;
        ShoppingCart shoppingCart;
        Item item = null;
        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 (home): public ShoppingCart create(java.lang.String firstName, java.lang.String lastName, org.apache.wsif.ejb.sample.shop.Address address, java.lang.String customerNumber) throws org.apache.wsif.ejb.sample.shop.CreateException, javax.ejb.CreateException, java.rmi.RemoteException");

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

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

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

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

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

        assertTrue("createOperation failed!!", operationSucceeded);

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

        debug("\n---> Invocation (remote): public Item addItem(java.lang.String itemNumber, java.lang.String itemName, int itemQuantity) throws org.apache.wsif.ejb.sample.shop.OutOfStockException, java.rmi.RemoteException, org.apache.wsif.ejb.sample.shop.InvalidItemException");

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

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

        inputMessage.setIntPart("itemQuantity", 1);

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

        assertTrue("addItemOperation failed!!", operationSucceeded);

        if (operationSucceeded) {
            assertTrue(
                "addItemOperation (EJB) did not return an Item Object!!",
                outputMessage.getObjectPart("item") instanceof Item);
            debug(outputMessage.getObjectPart("item"));
        } else {
            part = faultMessage.getObjectPart("invalidItemException");
            if (part != null) {
                debug(faultMessage.getName() + ":\n" + part);
            } else {
                part = faultMessage.getObjectPart("outOfStockException");
                if (part != null) {
                    debug(faultMessage.getName() + ":\n" + part);
                } else {
                    debug("ERROR: Unknown fault message!");
                }
            }
        }

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

        debug("\n---> Invocation (remote): public Item addItem(java.lang.String itemNumber, java.lang.String itemName, int itemQuantity) throws org.apache.wsif.ejb.sample.shop.OutOfStockException, java.rmi.RemoteException, org.apache.wsif.ejb.sample.shop.InvalidItemException");

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

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

        inputMessage.setIntPart("itemQuantity", 12);

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

        assertTrue(
            "addItemOperation succeeded when it should have thrown an outOfStockException",
            !operationSucceeded);

        if (operationSucceeded) {
            assertTrue(
                "addItemOperation (EJB) did not return an Item Object!!",
                outputMessage.getObjectPart("item") instanceof Item);
            debug(outputMessage.getObjectPart("item"));
        } else {
            assertNotNull(
                "outputMessage should have contained outOfStockException",
                faultMessage.getObjectPart("outOfStockException"));

            /*            part = faultMessage.getObjectPart("invalidItemException");
                        if (part != null) {
                            debug(faultMessage.getName() + ":\n" + part);
                        } else {
                            part = faultMessage.getObjectPart("outOfStockException");
                            if (part != null) {
                                debug(faultMessage.getName() + ":\n" + part);
                            } else {
                                debug("ERROR: Unknown fault message!");
                            }
                        }
            */
        }

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

        debug("\n---> Invocation (remote): public Item addItem(java.lang.String itemNumber, java.lang.String itemName, int itemQuantity) throws org.apache.wsif.ejb.sample.shop.OutOfStockException, java.rmi.RemoteException, org.apache.wsif.ejb.sample.shop.InvalidItemException");

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

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

        inputMessage.setIntPart("itemQuantity", 8);

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

        assertTrue("addItemOperation failed!!", operationSucceeded);

        if (operationSucceeded) {
            assertTrue(
                "addItemOperation (EJB) did not return an Item Object!!",
                outputMessage.getObjectPart("item") instanceof Item);
            debug(outputMessage.getObjectPart("item"));
        } else {
            part = faultMessage.getObjectPart("invalidItemException");
            if (part != null) {
                debug(faultMessage.getName() + ":\n" + part);
            } else {
                part = faultMessage.getObjectPart("outOfStockException");
                if (part != null) {
                    debug(faultMessage.getName() + ":\n" + part);
                } else {
                    debug("ERROR: Unknown fault message!");
                }
            }
        }

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

        debug("\n---> Invocation (remote): public SubmitOrderResult submitOrder(org.apache.wsif.ejb.sample.shop.CreditCardInfo creditCardInfo, org.apache.wsif.ejb.sample.shop.AirMilesContainer airMilesContainer) throws java.rmi.RemoteException");
View Full Code Here

        "http://www.shoppingcart.com/definitions/ShoppingCartInterface",
        // portTypeNS,
        "ShoppingCart_JavaPortType" //  portTypeName
    );

        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();

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

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

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

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

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

        operation.executeInputOnlyOperation(inputMessage);

        // -----------------------------------------------------------------------------------------------------
        // First add something to the basket
        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)");

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

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

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

        inputMessage.setIntPart("itemQuantity", 1);

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

        assertTrue("addItem test failed", operationSucceeded);

        if (operationSucceeded) {
          assertTrue(
                "addItemOperation (EJB) did not return an Item Object!!",
                outputMessage.getObjectPart("item") instanceof Item);
            debug(outputMessage.getObjectPart("item"));
            debug("Current total = " + outputMessage.getObjectPart("currentTotal"));
        } else {
            // Cannot get here since test would have already failed!
        }

        // -----------------------------------------------------------------------------------------------------
        // Test an "Input Only" operation by invoking the emptyBasket method
        operation = port.createOperation("emptyOrderOperation");
        inputMessage = operation.createInputMessage();

        debug("\n---> Invocation: public void emptyOrder(String customerNumber)");

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

        operation.executeInputOnlyOperation(inputMessage);

        // -----------------------------------------------------------------------------------------------------
        // Add to the basket again - the basket should be empty before this if previous operation worked!!
        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)");
View Full Code Here

TOP

Related Classes of org.apache.wsif.WSIFPort

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.