lundi 22 juin 2015

How to test JAX-WS connection timeout

I`m trying to test connection timeout property for jaxws client which is deployed on IBM Websphere Application Server 8.5. I set timeout properties the following way:

((BindingProvider) port).getRequestContext().
           put(com.ibm.wsspi.webservices.Constants.RESPONSE_TIMEOUT_PROPERTY, "30");
((BindingProvider) port).getRequestContext().
           put(com.ibm.wsspi.webservices.Constants.CONNECTION_TIMEOUT_PROPERTY, "15";

RESPONSE_TIMEOUT_PROPERTY works fine.

But I have no idea how to test CONNECTION_TIMEOUT_PROPERTY. If webservice is not available during creating an instance of Service I get the following exception:

javax.xml.ws.WebServiceException: The following WSDL exception occurred: 
            WSDLException: faultCode=WSDL4JWrapper : : javax.wsdl.WSDLException: 
            WSDLException: faultCode=WSDL4JWrapper : :
            java.net.ConnectException: Connection refused: connect

If webservice is not available during creating port(invoking getPort(...) method) I get the following exception:

javax.xml.ws.WebServiceException: 
            java.net.ConnectException: HTTP ( 404 ) Not Found address :
            http://myhost:myport/WsServer/helloService

Exceptions are thrown immediately. I suppose I do something wrong. Any pointers would be helpful.

Aucun commentaire:

Enregistrer un commentaire