JDK-8170462 : WebMethod returns null if there is no other parameter before the holder parameter
  • Type: Bug
  • Component: xml
  • Sub-Component: jax-ws
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2016-11-29
  • Updated: 2018-04-27
  • Resolved: 2018-04-27
Related Reports
Relates :  
Description
To reproduce the issue:
1. wsgen -cp . wstest.EchoImpl against the following java file:
package wstest;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.Holder;
import java.rmi.RemoteException;
import javax.jws.soap.SOAPBinding;

@WebService
@SOAPBinding(style=SOAPBinding.Style.RPC)
public class EchoImpl {
    @WebMethod
    public String holderOperation(@WebParam(name="holder1", mode=WebParam.Mode.INOUT)Holder<String> holder1,
                                  @WebParam(name="holder2", mode=WebParam.Mode.INOUT)Holder<String> holder2) throws RemoteException{
        holder1.value += "1";
        holder2.value += "2";
        return "success";
    }
}

2. start the web service with the following java file: 
package wstest;

import javax.xml.ws.Endpoint;

public class EchoService {
    public static void main(String[] args) {
        Endpoint.publish("http://localhost:8080/WebServices/echoimpl", new EchoImpl());
    }
}

3. generate the client:
wsimport -keep -p wstest.server http://localhost:8080/WebServices/echoimpl?wsdl

4. run the client test with the following java file:
import java.rmi.*;
import javax.naming.*;
import wstest.server.*;
import javax.xml.ws.Holder;

public class EchoClient {
    public static void main(String[] args) {
        EchoImplService service = new EchoImplService();
        EchoImpl port = service.getPort(EchoImpl.class);
        Holder h1 = new Holder("1");
        Holder h2 = new Holder("2");
        String result = port.holderOperation(h1, h2);
        
        System.out.println(result);
        System.out.println(h1.value);
        System.out.println(h2.value);
    }
}

Will get:
null
11
22

Note:
1. Obviously some changes made the result better, now only the return value is null.
2. If removing @SOAPBinding(style=SOAPBinding.Style.RPC) from EchoImpl java file or inserting a non-holder parameter at the first place in holderOperation method, it will have return value.
Comments
The Java EE modules have been removed from the JDK. This issue is now being tracked via https://github.com/javaee/metro-jax-ws/issues/1224
27-04-2018

I updated the description with the reproduction, I tested with b154.
04-02-2017

RULE "com.sun.xml.ws.test.exec.ClientExecutor::fromjava.nosei_rpclit_apt.client fromjava_nosei_rpclit_apt14" Exception java.lang.NullPointerException: Attempt to invoke method equals on null value RULE "com.sun.xml.ws.test.exec.ClientExecutor::fromwsdl.wsdl_rpclit.client fromwsdl_wsdl_rpclit_testCatalog" Exception java.lang.NullPointerException: Null Pointer in Method Invocation
29-11-2016