wsgen -cp . wstest.FaultImpl against the following java file, please note, the issue will happen either when createSOAPFaultException or createSOAP12FaultException :
package wstest;
run the client test with the following java file:
import java.rmi.;
import javax.naming.;
import wstest.server.*;
public class FaultClient {
public static void main(String[] args) throws java.lang.Exception {
FaultImplService service = new FaultImplService();
FaultImpl port = service.getPort(FaultImpl.class);
port.test();
}
}
Expect Client received "SOAP Fault from server: soap fault exception fault", but actually Client received "SOAP Fault from server: Cannot find SOAP wrapper for element [ns0:BasicFault: null]"
Previously Tracked by: https://bugs.openjdk.java.net/browse/JDK-8184905
To reproduce this issue:
import javax.jws.WebMethod; import javax.jws.WebService; import javax.xml.namespace.QName; import javax.xml.soap.Detail; import javax.xml.soap.DetailEntry; import javax.xml.soap.Name; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFactory; import javax.xml.soap.SOAPFault; import javax.xml.ws.soap.SOAPFaultException;
@WebService public class FaultImpl { @WebMethod public void test() throws SOAPException { throw createSOAPFaultException(); // throw createSOAP12FaultException(null, "SOAPFaultException"); }
}
start the web service with the following java file: package wstest;
import javax.xml.ws.Endpoint;
public class FaultService { public static void main(String[] args) { Endpoint.publish("http://localhost:8080/WebServices/faultimpl", new FaultImpl()); } }
generate the client: wsimport -keep -p wstest.server http://localhost:8080/WebServices/faultimpl?wsdl
run the client test with the following java file: import java.rmi.; import javax.naming.; import wstest.server.*;
public class FaultClient { public static void main(String[] args) throws java.lang.Exception { FaultImplService service = new FaultImplService(); FaultImpl port = service.getPort(FaultImpl.class); port.test(); } }
Expect Client received "SOAP Fault from server: soap fault exception fault", but actually Client received "SOAP Fault from server: Cannot find SOAP wrapper for element [ns0:BasicFault: null]"