3 Replies Latest reply on Sep 9, 2008 11:08 AM by Kristof Batizy

    no arg method triggers wrong number of arguments fault

    Kristof Batizy Newbie

      I made a very simple java first jaxws service with a pojo, and it has me pulling my hair out. I am using SoapUI to test them, and when I call the method that takes an arg, it works fine, but when I call the no-arg method, it faults with a "wrong number of arguments" message.

      Here is the interface:

      package com.mim.services;
      import javax.jws.WebMethod;
      import javax.jws.WebParam;
      import javax.jws.WebService;
      public interface Greeter {
       public String greetMe(@WebParam(name="nameToGreet") String me);
       public String sayHi();

      here is the implementation:

      package com.mim.services;
      @javax.jws.WebService(portName = "GreeterPort", serviceName = "GreeterService",
       endpointInterface = "com.mim.services.Greeter")
      public class GreeterWS implements Greeter {
       public String greetMe(String me)
       System.out.println("Executing operation greetMe");
       System.out.println("Message received: " + me +"\n");
       return "Hello " + me;
       public String sayHi()
       System.out.println("Executing operation sayHi\n");
       return "Bonjour";

      here is my request:
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.mim.com/">

      and here is the fault:
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
       <faultstring>java.lang.IllegalArgumentException: wrong number of arguments</faultstring>

      I also tried a couple examples from the CXF binary distribution from Apache site, namely the java_first_jaxws sample, and called getUsers which is also a no-arg method, and it too chokes.

      If I add "String foo" as an argument and ignore it, everything works fine.

      So, what's the trick to get no-arg methods to work correctly?