Package org.apache.wsif

Examples of org.apache.wsif.WSIFOperation


                    null,
                    null,
                    "http://wsifservice.addressbook/",
                    "AddressBook");
            WSIFPort port = service.getPort(server+"Port");
            WSIFOperation op = port.createOperation("addEntry", "AddEntryWholeNameRequest", null);           
            doItPort(port, "WSIFPort_ApacheAxis");            
        } catch (Exception e) {
            System.out.println(
                "\nAn error occured when running testWSIFPort_ApacheAxis " + e);
            assertTrue(false);
View Full Code Here


                    null,
                    null,
                    "http://wsifservice.addressbook/",
                    "AddressBook");
            WSIFPort port = service.getPort("NativeJmsPort");
            WSIFOperation op = port.createOperation("addEntry", "AddEntryWholeNameRequest", null);          
            doItPort(port, "WSIFPort_JMS");
        } catch (Exception e) {
            System.out.println(
                "\nAn error occured when running testWSIFPort_JMS " + e);
            assertTrue(false);
View Full Code Here

        }
    }

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

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

        boolean b =
            operation.executeRequestResponseOperation(
                inputMessage,
                outputMessage,
                faultMessage);

        if (b) {
View Full Code Here

                    "http://www.shoppingcart.com/definitions/ShoppingCartInterface",
                    "ShoppingCart_JavaService",
                    "http://www.shoppingcart.com/definitions/ShoppingCartInterface",
                    "ShoppingCart_JavaPortType");
            WSIFPort port = service.getPort();
            WSIFOperation op = port.createOperation("addItemOperation");
            WSIFMessage message = op.createInputMessage();
            message.setObjectPart("testPart1", "test1");           
//            message.setObjectPart("testPart2", new StringTokenizer("test2"));           
            doItMessage(message);         
        } catch (Exception e) {
            System.out.println(
View Full Code Here

            WSIFPort port = null;

            port = service.getPort(portName);

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

            WSIFMessage inputMessage = operation.createInputMessage();
            WSIFMessage outputMessage = operation.createOutputMessage();
            WSIFMessage faultMessage = operation.createFaultMessage();

            // Create a name and address to add to the addressbook
            String nameToAdd = "Chris P. Bacon";

            // Add the name and leave out address to the input message
            inputMessage.setObjectPart("name", nameToAdd);
            //inputMessage.setObjectPart("address", null); // should default to null

            // Execute the operation, obtaining a flag to indicate its success
            boolean ok =
                operation.executeRequestResponseOperation(
                    inputMessage,
                    outputMessage,
                    faultMessage);

            assertTrue( "Failed to add name and address to addressbook", ok );

            // Start from fresh
            operation = null;
            inputMessage = null;
            outputMessage = null;
            faultMessage = null;

            operation = port.createOperation("getAddressFromName");

            // Create the messages
            inputMessage = operation.createInputMessage();
            outputMessage = operation.createOutputMessage();
            faultMessage = operation.createFaultMessage();

            // Set the name to find in the addressbook
            String nameToLookup = "Chris P. Bacon";
            inputMessage.setObjectPart("name", nameToLookup);

            // Execute the operation
            ok = operation.executeRequestResponseOperation(
                    inputMessage,
                    outputMessage,
                    faultMessage);

            assertTrue( "Failed to lookup name from addressbook", ok );
View Full Code Here

    }

    private void addName(WSIFPort port, String name, Address addr)
       throws WSIFException {
        
       WSIFOperation operation =
          port.createOperation("addEntry", "AddEntryWholeNameRequest", null);
       WSIFMessage inputMessage = operation.createInputMessage();
       WSIFMessage outputMessage = operation.createOutputMessage();
       WSIFMessage faultMessage = operation.createFaultMessage();

       if ( name != null ) {
          inputMessage.setObjectPart( "name", name );
       }
       if ( addr != null ) {
          inputMessage.setObjectPart( "address", addr );
       }
       inputMessage.setObjectPart( "extra", "junk" );

       boolean ok = operation.executeRequestResponseOperation(
          inputMessage,
          outputMessage,
          faultMessage);

       assertTrue( "addEntry operation returned false!!", ok );
View Full Code Here

    }
   
    private Address getAddress(WSIFPort port, String name)
       throws WSIFException {

       WSIFOperation operation = port.createOperation("getAddressFromName");
       WSIFMessage inputMessage = operation.createInputMessage();
       WSIFMessage outputMessage = operation.createOutputMessage();
       WSIFMessage faultMessage = operation.createFaultMessage();

       if ( name != null ) {
          inputMessage.setObjectPart( "name", name );
       }
       inputMessage.setObjectPart( "extra", "junk" );

       boolean ok = operation.executeRequestResponseOperation(
          inputMessage,
          outputMessage,
          faultMessage);

       assertTrue( "getAddressFromName operation returned false!!", ok );
View Full Code Here

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

            // 1st a call that should work
            WSIFOperation op1 = port.createOperation("getQuote", inputName, outputName);
            WSIFMessage input1 = op1.createInputMessage();
            WSIFMessage output1 = op1.createOutputMessage();
            WSIFMessage fault1 = op1.createFaultMessage();
            input1.setObjectPart("symbol", "");
            boolean ok = op1.executeRequestResponseOperation(input1, output1, fault1);

            assertEquals("ok getQuote response", true, ok);
            float q1 = ((Float) output1.getObjectPart("quote")).floatValue();
            assertEquals("getQuote value", -1.0F, q1, 0F);

            // now a call that is defined in WSDL but not on server
            op1 = port.createOperation("XXXgetQuote", inputName, outputName);
            input1 = op1.createInputMessage();
            output1 = op1.createOutputMessage();
            fault1 = op1.createFaultMessage();
            input1.setObjectPart("symbol", "");
            ok = op1.executeRequestResponseOperation(input1, output1, fault1);

            assertEquals("ok getQuote response", false, ok);
            String name = fault1.getName();
            Object fobject = fault1.getObjectPart(WSIFConstants.SOAP_FAULT_OBJECT);
View Full Code Here

               Monitor.start( testName );
               port = service.getPort(portName);
               Monitor.stop( testName );
            }

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

            WSIFMessage inputMessage = operation.createInputMessage();
            WSIFMessage outputMessage = operation.createOutputMessage();
            WSIFMessage faultMessage = operation.createFaultMessage();

            // Create a name and address to add to the addressbook
            String nameToAdd = "Chris P. Bacon";
            Address addressToAdd =
                new Address(
                    1,
                    "The Waterfront",
                    "Some City",
                    "NY",
                    47907,
                    new Phone(765, "494", "4900"));

            // Add the name and address to the input message
            inputMessage.setObjectPart("name", nameToAdd);
            inputMessage.setObjectPart("address", addressToAdd);

            // Execute the operation, obtaining a flag to indicate its success
            boolean ok=
                operation.executeRequestResponseOperation(
                    inputMessage,
                    outputMessage,
                    faultMessage);

            assertTrue( "failed to add name and address!!", ok );

            /*
             * Run iterations of createOperation
             */
            testName = testNamePrefix + ".createOperation";
            iterations = (TEST_CREATEOP)? getIterations( testName ) : 1;
            System.out.println( "running " + iterations + " " + testName + " iterations..." );
            for (int i = 0; i < iterations; i++ ) {
               Monitor.start( testName );
         operation = port.createOperation("getAddressFromName");
               Monitor.stop( testName );
            }

            /*
             * Run iterations of executeRequestResponseOperation
             */
            testName = testNamePrefix + ".executeOperation";
            iterations = (TEST_EXECOP)? getIterations( testName ) : 1;
            System.out.println( "running " + iterations + " " + testName + " iterations..." );
            for (int i = 0; i < iterations; i++ ) {
         operation = port.createOperation("getAddressFromName");
         inputMessage = operation.createInputMessage();
         outputMessage = operation.createOutputMessage();
         faultMessage = operation.createFaultMessage();

         inputMessage.setObjectPart("name", nameToAdd);

               Monitor.start( testName );
         boolean operationSucceeded =
          operation.executeRequestResponseOperation(
           inputMessage,
           outputMessage,
           faultMessage);
               Monitor.stop( testName );
         if (!operationSucceeded) {
View Full Code Here

    private void bounce_image2(WSIFService service, Mime stub, String portName)
        throws Exception {
        DataHandler dh1 = new DataHandler(new FileDataSource(imageLocation));

        WSIFPort port = service.getPort(portName);
        WSIFOperation op = port.createOperation("bounceImage2");
        WSIFMessage in = op.createInputMessage();
        WSIFMessage out = op.createOutputMessage();
        WSIFMessage fault = op.createFaultMessage();
        in.setObjectPart("file",dh1);

        boolean success = op.executeRequestResponseOperation(in,out,fault);
        assertTrue(success);

        DataHandler dh2 = (DataHandler)(out.getObjectPart("file2"));

//        This commented out code displays the image, so proving that the
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.