18 Temmuz 2011 Pazartesi

how to change web service endpoint at run time

In order to change web service url endpoint at runtime, change call code as follows:
try { // Call Web Service Operation
           MyServiceService service = new MyServiceService();
           MyService port = service.getMyServicePort();
            BindingProvider bp = (BindingProvider)port;
            bp.getRequestContext().put(
                    BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                    "http://localhost:8080/MyServiceService?wsdl");
           
            java.lang.String username = "admin";
            java.lang.String password = "admin";

            ResultType result = port.myServiceOperation(username, password);
     
        } catch (Exception ex) {
             //..
        }


Hiç yorum yok:

Yorum Gönder