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

    no arg method triggers wrong number of arguments fault

    madhungarian

      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?

        • 1. Re: no arg method triggers wrong number of arguments fault
          madhungarian

          So, am I the only one with this issue?

          Anyone else having different results?

          • 2. Re: no arg method triggers wrong number of arguments fault
            ropalka

            Which JBossWS CXF version are you using. It should be fixed in 3.0.3 release?

            • 3. Re: no arg method triggers wrong number of arguments fault
              madhungarian

              I am using jbossws-cxf-3.0.3.GA and it still occurs.

              The only way I could get it to work was to use

              @SOAPBinding(style=Style.DOCUMENT, parameterStyle=ParameterStyle.WRAPPED)

              on the interface and:

              @WebMethod(operationName="sayHi")
              @RequestWrapper(className="java.lang.Object")
              @WebResult(name="greetingResponse")
               public String sayHi();


              on the method.

              Only then could I send:

              <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 get back the expected response:
              <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
               <soap:Body>
               <ns1:sayHiResponse xmlns:ns1="http://services.mim.com/">
               <greetingResponse>Bonjour</greetingResponse>
               </ns1:sayHiResponse>
               </soap:Body>
              </soap:Envelope>