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;
      
      @WebService
      public interface Greeter {
      
       @WebMethod
       public String greetMe(@WebParam(name="nameToGreet") String me);
       @WebMethod
       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/">
       <soapenv:Header/>
       <soapenv:Body>
       <ser:sayHi/>
       </soapenv:Body>
      </soapenv:Envelope>
      


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


      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?