2

after reading this post and many others i have client wsdl , from it i generated java stubs like this:

wsimport.bat   -Xnocompile -keep -Xendorsed  Client_aaa.wsdl

now in the client i want to be able to set dynamic endpoint urls, after reading few post here i did it like this:

responseUrl = "...each thread get different endpoint url ...."

    ApiService ApiService = new ApiService();        
    Api port = ApiService.getApiPort();
    int ws_request_timeout = 3000
    int ws_connect_timeout = 3000;
    try{
        ((BindingProvider)port).getRequestContext().put("com.sun.xml.internal.ws.request.timeout",ws_request_timeout);
        ((BindingProvider)port).getRequestContext().put("com.sun.xml.internal.ws.connect.timeout",ws_connect_timeout);
        ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,responseUrl);
    }
    catch(ClassCastException cco)
    {

        cco.printStackTrace();
    }
    catch(UnsupportedOperationException uso)
    {

        uso.printStackTrace();
    }
    catch(Exception e)
    {

        e.printStackTrace();
    }
    PACK PACK = port.sendAPI(MESSAGE);

but when it come to real invocation of the client im getting this exception:

Exception in thread "pool-1-thread-20" javax.xml.ws.WebServiceException: Failed to access th
e WSDL at: file:/D:/Java_2/libs/JAXWS2.2.5-20110729/jaxws-ri/bin/Client_aaa.wsdl.
 It failed with:
        Got D:\Java_2\libs\JAXWS2.2.5-20110729\jaxws-ri\bin\Client_aaa.wsdl (The
device is not ready) while opening stream from file:/D:/Java_2/libs/JAXWS2.2.5-20110729/jaxws
-ri/bin/Client_aaa.wsdl.
        at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:188
)
        at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:170)
        at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:135)
        at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:275)
        at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:238)
        at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:186)
        at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:111)
        at javax.xml.ws.Service.<init>(Service.java:56)
        at il.co.np.ApiService.<init>(Unknown Source)
        at com.serverrequest.RunnableTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

The error as you see that it tryes to read the wsdl file from which i compiled the stubs

UPDATE:
it seams i have annotation in the Service stub like this :

@WebServiceClient(name = "ApiService", targetNamespace = "http://www.endpointurl/NP/2.0/", wsdlLocation = "file:/D:/Java_2/libs/JAXWS2.2.5-20110729/jaxws-ri/bin/Client_aaa.wsdl")

how can it be removed? or better how to ignore it when i try to invoke with dynamic endpoit

Community
  • 1
  • 1
user63898
  • 29,839
  • 85
  • 272
  • 514

0 Answers0