Package org.apache.axis.client

Examples of org.apache.axis.client.Call


        }

    }

    public void testVectorConversion() throws Exception {
        Call call = new Call(new Service());
        call.setTransport(transport);

        Vector v = new Vector();
        v.addElement("Hi there!");
        v.addElement("This'll be a SOAP Array and then a LinkedList!");
        call.setOperationName(new QName(SERVICE_NAME, "echoLinkedList"));
        Object ret = call.invoke(new Object[]{v});
        if (!equals(v, ret)) assertEquals("Echo LinkedList mangled the result.  Result is underneath.\n" + ret, v, ret);
    }
View Full Code Here


        Object ret = call.invoke(new Object[]{v});
        if (!equals(v, ret)) assertEquals("Echo LinkedList mangled the result.  Result is underneath.\n" + ret, v, ret);
    }

    public void testLinkedListConversion() throws Exception {
        Call call = new Call(new Service());
        call.setTransport(transport);

        LinkedList l = new LinkedList();
        l.add("Linked list item #1");
        l.add("Second linked list item");
        l.add("This will be a SOAP Array then a Vector!");

        call.setOperationName(new QName(SERVICE_NAME, "echoVector"));
        Object ret = call.invoke(new Object[]{l});
        if (!equals(l, ret)) assertEquals("Echo Vector mangled the result.  Result is underneath.\n" + ret, l, ret);
    }
View Full Code Here

        Object ret = call.invoke(new Object[]{l});
        if (!equals(l, ret)) assertEquals("Echo Vector mangled the result.  Result is underneath.\n" + ret, l, ret);
    }

    public void testArrayConversion() throws Exception {
        Call call = new Call(new Service());
        call.setTransport(transport);

        Vector v = new Vector();
        v.addElement("Hi there!");
        v.addElement("This'll be a SOAP Array");

        call.setOperationName(new QName(SERVICE_NAME, "echoArray"));
        Object ret = call.invoke(new Object[]{v});
        if (!equals(v, ret)) assertEquals("Echo Array mangled the result.  Result is underneath\n" + ret, v, ret);
    }
View Full Code Here

     * Test the setReturnClass() API on Call by asking the runtime to
     * give us back a Vector instead of an array.  Confirm we get a Vector
     * back, and that it matches the data we send.
     */
    public void testReturnAsVector() throws Exception {
        Call call = new Call(new Service());
        call.setTransport(transport);

        LinkedList l = new LinkedList();
        l.add("Linked list item #1");
        l.add("Second linked list item");
        l.add("This will be a SOAP Array then a Vector!");

        call.setOperationName(new QName(SERVICE_NAME, "echoArray"));
        call.setReturnClass(Vector.class);
        Object ret = call.invoke(new Object[]{l});
        assertEquals("Return wasn't a Vector!", Vector.class, ret.getClass());
        Vector v = (Vector)ret;
        assertEquals("Sizes were different", l.size(), v.size());
        for (int i = 0; i < l.size(); i++) {
            String s = (String)l.get(i);
View Full Code Here

        super(s);
    }

  public void testCircularVectors() throws Exception {
        try {
            Call call = getCall();
            Object result = call.invoke("getCircle", null);
        } catch (AxisFault af){
            return;
        }
        fail("Expected a fault");
        // This just tests that we don't get exceptions during deserialization
View Full Code Here

        // a double.  We should figure this out and deserialize it
        // correctly, even without the xsi:type attribute, because
        // we set the return type manually.
       
        Service S_service = new Service();
        Call call = (Call) S_service.createCall();
        call.setTransport(new LocalTransport(server));
        call.setReturnType(XMLType.XSD_DOUBLE);
       
        Object result = call.invoke("TestService",
                                    "serviceMethod",
                                    new Object [] {});
       
        assertTrue("Return value (" + result.getClass().getName() +
                   ") was not the expected type (Double)!",
View Full Code Here

        transport = new LocalTransport(server);
        transport.setRemoteService("inheritanceTest");
    }

    public void testInheritance() throws Exception {
        Call call = new Call(new Service());
        call.setTransport(transport);

        String ret = (String)call.invoke("inherited", null);
        assertEquals("Inherited method returned bad result",
                Parent.HELLO_MSG, ret);

        ret = (String)call.invoke("normal", null);
        assertEquals("Child method returned bad result",
                Child.HELLO_MSG, ret);

        ret = (String)call.invoke("overloaded", new Object [] { "test" });
        assertTrue("Overloaded (String) method returned bad result",
                ret.startsWith(Parent.OVERLOAD_MSG));
        ret = (String)call.invoke("overloaded",
                                  new Object [] { new Integer(5) });
        assertTrue("Overloaded (int) method returned bad result",
                ret.startsWith(Child.OVERLOAD_MSG));

    }
View Full Code Here

        //Create the data for the attached file.
        DataHandler dhSource = new DataHandler( new FileDataSource( filename ));

        Service  service = new Service();

        Call     call    = (Call) service.createCall();


        call.setTargetEndpointAddress( new URL(opts.getURL()) ); //Set the target service host and service location,

        call.setOperationName(new QName("urn:EchoAttachmentsService","echo") ); //This is the target services method to invoke.

        QName qnameAttachment = new QName("urn:EchoAttachmentsService", "DataHandler");

        call.registerTypeMapping(dhSource.getClass(),//Add serializer for attachment.
                                 qnameAttachment,
                                 JAFDataHandlerSerializerFactory.class,
                                 JAFDataHandlerDeserializerFactory.class);

                                
        call.addParameter( "source", qnameAttachment,
                ParameterMode.IN ); //Add the file.

        call.setReturnType( qnameAttachment);

        call.setUsername( opts.getUser());

        call.setPassword( opts.getPassword() );

        if(doTheDIME)
            call.setProperty(call.ATTACHMENT_ENCAPSULATION_FORMAT,
              call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);


        Object ret = call.invoke( new Object[] {
                    dhSource
                }
            ); //Add the attachment.

        if (null == ret) {
View Full Code Here

                    "The directory \"" + filename + "\" has no files to send.");
        }

        Service  service = new Service(); //A new axis Service.

        Call     call    = (Call) service.createCall(); //Create a call to the service.

        /*Un comment the below statement to do HTTP/1.1 protocol*/
      //call.setScopedProperty(MessageContext.HTTP_TRANSPORT_VERSION,HTTPConstants.HEADER_PROTOCOL_V11);
        Hashtable myhttp= new Hashtable();
        myhttp.put("dddd","yyy");     //Send extra soap headers
        myhttp.put("SOAPAction","dyyy");
        myhttp.put("SOAPActions","prova");

        /*Un comment the below to do http chunking to avoid the need to calculate content-length. (Needs HTTP/1.1)*/
      //myhttp.put(HTTPConstants.HEADER_TRANSFER_ENCODING, HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED);

        /*Un comment the below to force a 100-Continue... This will cause  httpsender to wait for
         * this response on a post.  If HTTP 1.1 and this is not set, *SOME* servers *MAY* reply with this anyway.
         *  Currently httpsender won't handle this situation, this will require the resp. which it will handle.
         */
      //myhttp.put(HTTPConstants.HEADER_EXPECT, HTTPConstants.HEADER_EXPECT_100_Continue);
        call.setScopedProperty(HTTPConstants.REQUEST_HEADERS,myhttp);

        call.setTargetEndpointAddress( new URL(opts.getURL()) ); //Set the target service host and service location,

        call.setOperationName( new QName("urn:EchoAttachmentsService", "echoDir") ); //This is the target services method to invoke.

        QName qnameAttachment = new QName("urn:EchoAttachmentsService", "DataHandler");

        call.registerTypeMapping(attachments[0].getClass(),//Add serializer for attachment.
                                 qnameAttachment,
                                 JAFDataHandlerSerializerFactory.class,
                                 JAFDataHandlerDeserializerFactory.class);

        call.addParameter( "source",   XMLType.SOAP_ARRAY , // new XMLType(qnameAttachment),
            ParameterMode.IN ); //Add the file.

        call.setReturnType(XMLType.SOAP_ARRAY); // new XMLType(qnameAttachment));

        call.setUsername( opts.getUser());

        call.setPassword( opts.getPassword() );

        if(doTheDIME)
            call.setProperty(call.ATTACHMENT_ENCAPSULATION_FORMAT,
              call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);

        Object ret = call.invoke( new Object[] {
                    attachments
                }
            ); //Add the attachment.

        if (null == ret) {
View Full Code Here

            } else {
                textToSend = args[0];
            }
           
            Service  service = new Service();
            Call     call    = (Call) service.createCall();

            call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
            call.setOperationName( "serviceMethod" );
            call.addParameter( "arg1", XMLType.XSD_STRING, ParameterMode.IN);
            call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );

            String ret = (String) call.invoke( new Object[] { textToSend } );
           
            System.out.println("You typed : " + ret);
        } catch (Exception e) {
            System.err.println(e.toString());
        }
View Full Code Here

TOP

Related Classes of org.apache.axis.client.Call

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.