Results 1 to 3 of 3

Thread: XFireClientFactoryBean problem with Collections

  1. #1

    Default XFireClientFactoryBean problem with Collections

    Hi.
    I have a problem with XFireClientFactoryBean.
    In fact, the XFire comes with an example (Book example).
    Basically, the problem is when I try to invoke a web service through XFireClientFactoryBean and the method of the service returns a Collection.

    The XFire example comes with a client example.
    It uses its own code.
    Code:
    String serviceURL = "http://localhost:8080/web-service-xfire-server/services/BookService";
            Service serviceModel = new ObjectServiceFactory().create(BookService.class,null,"http://xfire.codehaus.org/BookService",null);
            
            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();
    And this code works well.
    I made my own similar client code with XFireClientFactoryBean:
    Code:
    XFireClientFactoryBean bookService = new XFireClientFactoryBean();
    		bookService.setWsdlDocumentUrl("http://localhost:8080/web-service-xfire-server/services/BookService?wsdl");
    		bookService.setServiceInterface(BookService.class);
    		
    		bookService.afterPropertiesSet();
    		
    		BookService bookProxiedService = (BookService)bookService.getObject();
    		
    		Client client = Client.getInstance(bookProxiedService);
            client.addOutHandler(new OutHeaderHandler());
            // disable timeout
            client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT, "0");
    		
            Map booksMap = bookProxiedService.getBooksMap();
    and this code gets an exception, because the method invoked on the service returns a Map (a Collection).
    I've tried to invoke a method that returns an array of objects instead a Collection for example, or a single object and it works well. As I said before, the problem is when I invoke a method that returns a Collection (a Map in this case).

    It can be this an error in XFireClientFactoryBean?

    Am I making something wrong?

    Thanks a lot in advance

  2. #2

    Default

    More interesting data.
    I'm using XFire 1.2 and Spring 2.5

  3. #3

    Default

    Sorry for this post.
    I've just seen that XFireClientFactoryBean isn't included in Spring Framework, but in XFire. It's a helper Spring integration class included in XFire.
    Maybe, this post has sense in a XFire forum, not in a Spring forum.
    Sorry, and thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •