Examples of WSIFPort


Examples of org.apache.wsif.WSIFPort

     * @generated
     */
    public java.util.Date echoDate(java.util.Date argInputDate)
        throws WSIFException {

        WSIFPort port = this.svc.getPort();

        WSIFOperation operation =
            port.createOperation("echoDate", "echoDateRequest", "echoDateResponse");

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

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

        inputMessage.setObjectPart("inputDate", argInputDate);

        operation.executeRequestResponseOperation(inputMessage, outputMessage, null);

        port.close();

        return (java.util.Date) outputMessage.getObjectPart("return");

    }
View Full Code Here

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

Examples of org.apache.wsif.WSIFPort

     * @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

Examples of org.apache.wsif.WSIFPort

     * 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

Examples of org.apache.wsif.WSIFPort

          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

Examples of org.apache.wsif.WSIFPort

               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

Examples of org.apache.wsif.WSIFPort

          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

Examples of org.apache.wsif.WSIFPort

        }
        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

Examples of org.apache.wsif.WSIFPort

            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

Examples of org.apache.wsif.WSIFPort

            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
TOP
Copyright © 2018 www.massapi.com. 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.