Package org.codehaus.xfire.client

Examples of org.codehaus.xfire.client.Client


    getServiceRegistry().register(service);
   
    AuthenticationServiceClient stub = new AuthenticationServiceClient();
    AuthenticationInterface client = stub.getAuthenticationInterfaceLocalEndpoint();
   
    Client xclient = Client.getInstance(client);
    xclient.setProperty(JaxbType.SEARCH_PACKAGES, search);
    
    Object object = client.login("dan", "dan");
    assertEquals("hello", object);
   
    //object = client.login("foo", "dan");
View Full Code Here


    public void testInvoke()
            throws Exception
    {
        Transport transport = getTransportManager().getTransport(LocalTransport.BINDING_ID);
        Client client = new Client(transport, service, "xfire.log://Echo");
        client.setXFire(getXFire());

        OperationInfo op = service.getServiceInfo().getOperation("echo");
        Object[] response = client.invoke(op, new Object[] { null });
        assertNotNull("response from client invoke is null", response);
        assertEquals("unexpected array size in invoke response", 1, response.length);
       
        assertNull(response[0]);
    }
View Full Code Here

        Object handler = Proxy.getInvocationHandler(obj);
        Class handlerClass = handler.getClass();
        assertTrue("factory created own proxy: " + handlerClass, XFireProxy.class.isAssignableFrom(handlerClass));       
        XFireProxy fireProxy = (XFireProxy)handler;
        checkAuth(fireProxy, null, null);
        Client c = fireProxy.getClient();
        System.out.println(serviceURL);
        System.out.println(c.getUrl());
        assertEquals("wrong service URL", serviceURL, c.getUrl());
    }   
View Full Code Here

        Object handler = Proxy.getInvocationHandler(obj);
        Class handlerClass = handler.getClass();
        assertTrue("factory created own proxy: " + handlerClass, XFireProxy.class.isAssignableFrom(handlerClass));       
        XFireProxy fireProxy = (XFireProxy)handler;
        checkAuth(fireProxy, null, null);
        Client c = fireProxy.getClient();
      
        assertEquals("wrong service URL", "http://localhost/test2", c.getUrl());
    }
View Full Code Here

        checkAuth(handler, expectedUsername, expectedPassword);
    }

    private void checkAuth(XFireProxy handler, String expectedUsername, String expectedPassword)
    {
        Client client = handler.getClient();
        String username = (String)client.getProperty(Channel.USERNAME);
        assertEquals("wrong username", expectedUsername, username);
        String password = (String)client.getProperty(Channel.PASSWORD);
        assertEquals("wrong password", expectedPassword, password);
    }
View Full Code Here

    }
    public void test(boolean chunking)
            throws Exception
    {
        Client client = new Client(service.getBinding(SoapHttpTransport.SOAP11_HTTP_BINDING),
                                   "http://localhost:8191/AttachmentEcho");

        client.setProperty(HttpTransport.CHUNKING_ENABLED, new Boolean(chunking).toString());
       
        File f = getTestFile("src/test/org/codehaus/xfire/attachments/echo11.xml");
        FileDataSource fs = new FileDataSource(f);

        final DataHandler dh = new DataHandler(fs);
       
        client.addOutHandler(new AbstractHandler() {

            public void invoke(MessageContext context)
                throws Exception
            {
                Attachments atts = new JavaMailAttachments();
                atts.addPart(new SimpleAttachment("test.jpg", dh));
                context.getOutMessage().setAttachments(atts);
            }
        });
       
        client.addInHandler(new AbstractHandler() {

            public void invoke(MessageContext context)
                throws Exception
            {
                Attachments atts = context.getInMessage().getAttachments();

                assertEquals(1, atts.size());
                Attachment att = atts.getPart("test.jpg");
                assertNotNull(att);
            }
        });

        client.invoke("echo", new Object[] { new Element("hi") });
    }
View Full Code Here

        XFireProxyFactory serviceFactory = new XFireProxyFactory();
       
        try
        {
            BookService service = (BookService) serviceFactory.create(serviceModel, serviceURL);
            Client client = Client.getInstance(service);
            client.addOutHandler(new OutHeaderHandler());
            // disable timeout
            client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT, "0");
           
            Book[] books = service.getBooks();
            Map booksMap = service.getBooksMap();
            System.out.print("Received map with "+booksMap.size()+" book(s) \n");
            System.out.println("BOOKS:");
View Full Code Here

    public void testProxy() throws MalformedURLException, XFireFault
    {
        Echo echo = (Echo) new XFireProxyFactory().create(service, "http://localhost:8191/Echo");
       
        Client client = ((XFireProxy) Proxy.getInvocationHandler(echo)).getClient();
        client.setProperty(Channel.USERNAME, "user");
        client.setProperty(Channel.PASSWORD, "pass");
       
        Element root = new Element("root", "a", "urn:a");
        root.addContent("hello");
       
        Element e = echo.echo(root);
View Full Code Here

    public void testGzip() throws Exception
    {
        Echo echo = (Echo) new XFireProxyFactory().create(service, "http://localhost:8391/Echo");
       
        Client client = Client.getInstance(echo);
        client.setProperty(CommonsHttpMessageSender.GZIP_ENABLED, "true");
        Element root = new Element("root", "a", "urn:a");
        root.addContent("hello");
       
        Element e = echo.echo(root);
       
View Full Code Here

   
    public void testWithChunking() throws Exception
    {
        Echo echo = (Echo) new XFireProxyFactory().create(service, "http://localhost:8391/Echo");
       
        Client client = Client.getInstance(echo);
        client.setProperty(CommonsHttpMessageSender.GZIP_ENABLED, "true");
        client.setProperty(HttpTransport.CHUNKING_ENABLED, "true");
       
        Element root = new Element("root", "a", "urn:a");
        root.addContent("hello");
       
        Element e = echo.echo(root);
View Full Code Here

TOP

Related Classes of org.codehaus.xfire.client.Client

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.