Problems accessing SSL webservice
vitorisaia Sep 4, 2008 10:37 AMGreetings,
I have a working jax-ws webservice deployed, wich I access it through a java standalone client. Now I need to enable SSL on it. I've configured jboss-web.deployer/server.xml to create the SSL connection, and now I have my webservice successfully deployed in the following URL:
https://localhost:8443/abc/deteccaopcws?wsdl
with:
... <service name="DeteccaoPCWSService"> <port binding="tns:DeteccaoPCWSBinding" name="DeteccaoPCWSPort"> <soap:address location="https://localhost:8443/abc/deteccaopcws"/> </port> </service> ...
and in the webservice class:
... @WebService(targetNamespace = "xyz.abc.deteccaoPC") @WebContext(contextRoot = "/abc", urlPattern = "/deteccaopcws", transportGuarantee="CONFIDENTIAL") @Stateless @HandlerChain(file = "deteccaopc-handler.xml") public class DeteccaoPCWS ...
The problem is, since I've turned on SSL, my client doesn't work anymore...
I always get a "Target endpoint no set" exception:
Exception in thread "main" javax.xml.ws.WebServiceException: org.jboss.ws.WSException: Target endpoint address not set at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:410) at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:316) at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:172) at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:152) at $Proxy16.processarDeteccao(Unknown Source) at deteccaopc.abc.xyz.client.SingleClient.main(SingleClient.java:70) Caused by: org.jboss.ws.WSException: Target endpoint address not set at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:334) at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:304) ... 4 more
Here is my client service:
@WebServiceClient(name = "DeteccaoPCWSService",
targetNamespace = "xyz.abc.deteccaoPC", wsdlLocation = "https://localhost:8443/abc/deteccaopcws?wsdl")
public class DeteccaoPCWSService
extends Service
{
private final static URL DETECCAOPCWSSERVICE_WSDL_LOCATION;
private final static Logger logger = Logger.getLogger(deteccaopc.abc.xyz.DeteccaoPCWSService.class.getName());
static {
URL url = null;
try {
URL baseUrl;
baseUrl = deteccaopc.abc.xyz.DeteccaoPCWSService.class.getResource(".");
url = new URL(baseUrl, "https://localhost:8443/abc/deteccaopcws?wsdl");
} catch (MalformedURLException e) {
logger.warning("Failed to create URL for the wsdl Location: 'https://localhost:8443/abc/deteccaopcws?wsdl', retrying as a local file");
logger.warning(e.getMessage());
}
DETECCAOPCWSSERVICE_WSDL_LOCATION = url;
}
public DeteccaoPCWSService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public DeteccaoPCWSService() {
super(DETECCAOPCWSSERVICE_WSDL_LOCATION, new QName("xyz.abc.deteccaoPC", "DeteccaoPCWSService"));
}
@WebEndpoint(name = "DeteccaoPCWSPort")
public DeteccaoPCWS getDeteccaoPCWSPort() {
return super.getPort(new QName("xyz.abc.deteccaoPC", "DeteccaoPCWSPort"), DeteccaoPCWS.class);
}
}And in the client, I'm setting theseVM properties :
-Djavax.net.ssl.trustStore=/home/vitor/Desktop/wsse.truststore -Djavax.net.ssl.trustStorePassword=jbossws
So, the hole code I've show you was working without SSL, in the URL http://localhost:9090/abc/deteccaopcws?wsdl
Even having that exception (Target endpoint no set) I know the webservice is deployed because I can successfully access it in my browser...
One thing I suspect is: Since the certificate is a self-signed certficate, when I acess it in the browser it alerts me about it, asking for the confirmation. I guess that's what is causing the error.
I appreciate any help, thanks.
Vitor Isaia