Package org.apache.wsif

Examples of org.apache.wsif.WSIFOperation


     * @see org.apache.wsif.base.WSIFDefaultPort#createOperation(java.lang.String)
     */
    public WSIFOperation createOperation( String operationName ) throws WSIFException
    {
        Trc.entry( this, operationName );
        WSIFOperation wo = createOperation( operationName, null, null );
        Trc.exit( wo );
        return wo;
    }
View Full Code Here


        if ( op == null )
        {
            throw new WSIFException( "Could not create operation: " + operationName + ':' + inputName + ':'
                    + outputName );
        }
        WSIFOperation wo = op.copy();
        Trc.exit( wo );
        return wo;
    }
View Full Code Here

    }

    private Object invokeOperation( WSIFPort port, String name, Object partVal ) throws Exception
    {
        Object result = null;
        WSIFOperation operation = port.createOperation( name );

        WSIFMessage inputMessage = operation.createInputMessage();
        WSIFMessage outputMessage = operation.createOutputMessage();
        WSIFMessage faultMessage = operation.createFaultMessage();
        inputMessage.setObjectPart( "dummy", partVal );

        assertTrue( operation.executeRequestResponseOperation( inputMessage, outputMessage, faultMessage ) );

        result = outputMessage.getObjectPart( "return" );
        assertNotNull( result );

        return result;
View Full Code Here

        {
            // create the operation
            // note that we have two operations with the same name, so we need
            // to specify the
            // name of the input and output messages as well
            WSIFOperation operation = port.createOperation( "addEntry", "AddEntryFirstAndLastNamesRequest", null );

            assertNotNull( operation );

            // create the input message associated with this operation
            WSIFMessage input = operation.createInputMessage();

            // populate the input message
            input.setObjectPart( "firstName", "John" );
            input.setObjectPart( "lastName", "Smith" );

            // create an address object to populate the input
            Address address = new Address();
            address.setStreetNum( 20 );
            address.setStreetName( "Peachtree Avenue" );
            address.setCity( "Atlanta" );
            address.setState( "GA" );
            address.setZip( 39892 );
            Phone phone = new Phone();
            phone.setAreaCode( 701 );
            phone.setExchange( "555" );
            phone.setNumber( "8721" );
            address.setPhoneNumber( phone );

            input.setObjectPart( "address", address );

            // do the invocation
            System.out.println( "Adding address for John Smith..." );
            operation.executeInputOnlyOperation( input );

        }
        catch ( WSIFException we )
        {
            System.out.println( "Got exception from WSIF, details:" );
View Full Code Here

    public void testQueryAddresses()
    {
        try
        {
            // create the operation
            WSIFOperation operation = port.createOperation( "getAddressFromName" );

            assertNotNull( operation );

            // create the input message associated with this operation
            WSIFMessage input = operation.createInputMessage();
            WSIFMessage output = operation.createOutputMessage();
            WSIFMessage fault = operation.createFaultMessage();

            // populate the input message
            input.setObjectPart( "name", "John Smith" );

            // do the invocation
            System.out.println( "Querying address for John Smith..." );
            if ( operation.executeRequestResponseOperation( input, output, fault ) )
            {
                // invocation succeeded
                // extract the address from the output message
                Address address = (Address) output.getObjectPart( "address" );
                assertNotNull( address );
View Full Code Here

        try {
            // create the operation
            // note that we have two operations with the same name,
            // so we need to specify the name of the input and output
            // messages as well
            WSIFOperation operation =
                port.createOperation(
                    "addEntry",
                    "AddEntryWholeNameRequest",
                    null);
                   
            // create the input message associated with this operation
            WSIFMessage input = operation.createInputMessage();

            // populate the input message
            input.setObjectPart("name", "John Smith");

            // create an address object to populate the input
            Address address = new Address();
            address.setStreetNum(25);
            address.setStreetName("Willow Road");
            address.setCity("MyTown");
            address.setState("PA");
            address.setZip(28382);
            Phone phone = new Phone();
            phone.setAreaCode(288);
            phone.setExchange("555");
            phone.setNumber("9891");
            address.setPhoneNumber(phone);

            input.setObjectPart("address", address);

            // do the invocation
            System.out.println("Adding address for John Smith...");
            operation.executeInputOnlyOperation(input);

        } catch (WSIFException we) {
            System.out.println("Got exception from WSIF, details:");
            we.printStackTrace();
        }
View Full Code Here

        try {

            // create the operation
            // note that we have two operations with the same name, so we need to specify the
            // name of the input and output messages as well
            WSIFOperation operation =
                port.createOperation(
                    "addEntry",
                    "AddEntryFirstAndLastNamesRequest",
                    null);

            // create the input message associated with this operation
            WSIFMessage input = operation.createInputMessage();

            // populate the input message
            input.setObjectPart("firstName", "Jane");
            input.setObjectPart("lastName", "White");

            // create an address object to populate the input
            Address address = new Address();
            address.setStreetNum(20);
            address.setStreetName("Peachtree Avenue");
            address.setCity("Atlanta");
            address.setState("GA");
            address.setZip(39892);
            Phone phone = new Phone();
            phone.setAreaCode(701);
            phone.setExchange("555");
            phone.setNumber("8721");
            address.setPhoneNumber(phone);

            input.setObjectPart("address", address);

            // do the invocation
            System.out.println("Adding address for Jane White...");
            operation.executeInputOnlyOperation(input);

        } catch (WSIFException we) {
            System.out.println("Got exception from WSIF, details:");
            we.printStackTrace();
        }
View Full Code Here

    }

    private static void queryAddresses(WSIFPort port) {
        try {
            // create the operation
            WSIFOperation operation =
                port.createOperation("getAddressFromName");

            // create the input message associated with this operation
            WSIFMessage input = operation.createInputMessage();
            WSIFMessage output = operation.createOutputMessage();
            WSIFMessage fault = operation.createFaultMessage();

            // populate the input message
            input.setObjectPart("name", "John Smith");

            // do the invocation
            System.out.println("Querying address for John Smith...");
            if (operation.executeRequestResponseOperation(input, output, fault)) {
                // invocation succeeded
                // extract the address from the output message
                Address address = (Address) output.getObjectPart("address");
                System.out.println("Service returned the following address:");
                System.out.println(
                    address.getStreetNum()
                        + " "
                        + address.getStreetName()
                        + ", "
                        + address.getCity()
                        + " "
                        + address.getState()
                        + " "
                        + address.getZip()
                        + "; Phone: ("
                        + address.getPhoneNumber().getAreaCode()
                        + ") "
                        + address.getPhoneNumber().getExchange()
                        + "-"
                        + address.getPhoneNumber().getNumber());
            } else {
                // invocation failed, check fault message
            }
            // create the operation
            operation = port.createOperation("getAddressFromName");
            // create the input message associated with this operation
            input = operation.createInputMessage();
            output = operation.createOutputMessage();
            fault = operation.createFaultMessage();
            // populate the input message
            input.setObjectPart("name", "Jane White");
            // do the invocation
            System.out.println("Querying address for Jane White...");
            if (operation.executeRequestResponseOperation(input, output, fault)) {
                // invocation succeeded
                // extract the address from the output message
                Address address = (Address) output.getObjectPart("address");
                System.out.println("Service returned the following address:");
                System.out.println(
View Full Code Here

    }

    protected void addBindingOperation(Binding binding, BindingOperation bindingOperation) throws WSIFException {
        Operation operation = bindingOperation.getOperation();
        String name = operation.getName();
        WSIFOperation wsifOperation = service.getPort().createOperation(name);

        WSIFOperationInfo info = new WSIFOperationInfo(wsifOperation, bindingOperation);

        operationMap.put(name, info);
        operationMap.put(new QName(name), info);
View Full Code Here

    // Implementation methods
    //-------------------------------------------------------------------------
    protected void process(MessageExchange exchange, NormalizedMessage normalizedMessage) throws MessagingException {
        try {
            WSIFOperationInfo operationInfo = operationMap.getOperationForExchange(exchange);
            WSIFOperation operation = operationInfo.getWsifOperation();
            WSIFMessage message = operation.createInputMessage();
            marshaler.fromNMS(operationInfo, message, normalizedMessage, getBody(normalizedMessage));
            operation.executeInputOnlyOperation(message);
            done(exchange);
        }
        catch (WSIFException e) {
            exchange.setError(e);
            exchange.setStatus(ExchangeStatus.ERROR);
View Full Code Here

TOP

Related Classes of org.apache.wsif.WSIFOperation

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.