I have a SOAP client written with JAX-WS. My code is something like this:
UpdateSub port = service.getUpdateSub();
port.soapMethod(parameter);
I want to have specific code for the case when the connection to the SOAP server is refused or when it is timed out. I tested these cases and I see that the soapMethod throws a ClientTransportException. The ClientTransportException is from a sun package, so if I import it in order to catch it the compiler throws this error:
package com.sun.xml.internal.ws.client does not exist
I solved this problem the way karmakaze suggests here
From what I understand this is only a workaround and Oracle doesn't recommend doing it. So, what would be the proper way of catching this kind of exception without compiler arguments?