Hello,

 

I am trying to develop some webservices using xfire, and most works very well, but my client will not work.

 

First, I used the bookservice example with its three methods: getBooks(), findBook(isbn), getBooksMap().

 

Using Soap-UI I can call all three methods well and the correct values return, but with the client, the array that is returned by getBooks() is empty, and the method getBooksMap() ends in a “org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Fault: java.lang.NullPointerException”.

 

There seems to be something wrong with the more complex data types I think. Creating a simple method in the service returning a string works fine.

 

Can someone help me or give me a hint of what to do?

 

Thanks for reading,

 

Nick

 

 

 

 

 

PS: “My” client-code (its mostly from the example…):

 

 

 

package service.test;

 

import java.net.MalformedURLException;

import java.util.Map;

 

import org.codehaus.xfire.client.Client;

import org.codehaus.xfire.client.XFireProxyFactory;

import catega.test.OutHeaderHandler;

import org.codehaus.xfire.service.Service;

import org.codehaus.xfire.service.binding.ObjectServiceFactory;

 

/**

 * @author <a href="" PROTECTED]">Nathan Peles</a>

 * @author <a href="" PROTECTED]">Tomasz Sztelak</a>

 */

public class BookClient

{

    public static void main(String args[])

    {

        String serviceURL = "http://localhost:8080/book/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());

            Book[] books = service.getBooks();

            Map booksMap = service.getBooksMap();

            System.out.print("Received map with "+booksMap.size()+" book(s) \n");

            System.out.println("BOOKS:");

           

            for (int i = 0; i < books.length; i++)

            {

                System.out.println(books[i].getTitle());

            }

        }

        catch (MalformedURLException e)

        {

            e.printStackTrace();

        }

    }

}

Reply via email to