Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Soap web service client - Configure wait time at service and port level

    I generated a web service client from a wsdl using Apache CXF and am trying to consume the operations available in that service.

    Client code:

    Code:
    try {
        String wsdlStr = Util.getPropertiesValue(Constants.WSDL);
        URL wsdlURL = new URL(wsdlStr);
        MyWebService service = new MyWebService(wsdlURL);
        ServiceEndpoint port = service.getServiceEndpointPort();
        BindingProvider bindingProvider = (BindingProvider)port;
        bindingProvider.getRequestContext().put("javax.xml.ws.client.connectionTimeout", "10000");
        bindingProvider.getRequestContext().put("javax.xml.ws.client.receiveTimeout", "20000");
    } catch(Exception e) {
        logger.error("EXCEPTION OCCURED \n",e);
        throw new WebServiceException(e);
      }

    'javax.xml.ws.client.connectionTimeout' and 'javax.xml.ws.client.receiveTimeout' is working fine at operation level(Time to establish the conenction by sending request and waiting for its response). I want timeout to be configured at service and port level.


    First Issue:

    Am providing actual wsdl url which is up and running and locates in different server instead the mock service which is in my local. I do not have access to actual wsdl.

    1) When i hit the actual wsdl url in browser, it say 'Site can't be reached. xxx took too long to respond. ERR_CONNECTION_TIMED_OUT'. Am getting this error within a minute.

    2) When i hit the actual wsdl url using client code, it is taking more than 5 minutes to throw 'ConnectException: Connection timed out'. In debug mode, when i hit the line 'MyWebService service = new MyWebService(wsdlURL);' it is waiting more than 5 minutes to process and then going to catch block to throw the error.

    Expected: Is there a way to handle the wait time to throw ConnectException at service level? I want the java code to throw the error message within the time i configure.


    Second Issue:

    1) I hit mock wsdl url using client code. Mock service runs in my local machine. In this case, it is taking atleast 5 seconds to get the port. ServiceEndpoint port = service.getServiceEndpointPort();

    Expected: Is there a way to handle the wait time to return port? I want the java code to wait for port until the time i configure.
    Last edited by BobbyRachel; 03-20-2017 at 07:28 AM.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •