Hi,

I am trying to call a web service inside my webapp using xfire.

As a test, I put the BookClient in my webapp.
But I get this error, can anyone please help me understand what is the problem?

I appreciate if anyone can give me some help.

org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
Nested exception is org.codehaus.xfire.fault.XFireFault: For input
string: ""
org.codehaus.xfire.fault.XFireFault: For input string: ""
       at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
       at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
       at org.codehaus.xfire.client.Client.invoke(Client.java:335)
       at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
       at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
       at $Proxy12.getBooks(Unknown Source)
       ...
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
       at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
       at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
       at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
       at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
       at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)


Caused by: java.lang.NumberFormatException: For input string: ""
       at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
       at java.lang.Integer.parseInt(Integer.java:489)
       at java.lang.Integer.parseInt(Integer.java:518)
       at 
org.codehaus.xfire.transport.http.CommonsHttpMessageSender.createClient(CommonsHttpMessageSender.java:210)
       at 
org.codehaus.xfire.transport.http.CommonsHttpMessageSender.open(CommonsHttpMessageSender.java:87)
       at 
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:121)
       at 
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
       at 
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
  at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
       at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
       ... 105 more

Here is my code for calling the web service:


String serviceURL = "http://localhost:8080/xfire/services/BookService";;
       Service serviceModel = new
ObjectServiceFactory().create(ConfigService.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].geAuthor());


           }

           service.clearCache();

       }
       catch (Exception e)
       {
           e.printStackTrace();
       }

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to