Skip to content

Instantly share code, notes, and snippets.

@aviramsegal
Created July 9, 2012 11:35
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aviramsegal/3075966 to your computer and use it in GitHub Desktop.
Save aviramsegal/3075966 to your computer and use it in GitHub Desktop.
JAX-WS Custom Endpoint
/**
* The following snippets shows how to set a custom endpoint for a JAX-WS generated WebClient on runtime
*/
// Get the service and the port
SampleService service = new SampleService();
Sample port = service.getESamplePort();
// Use the BindingProvider's context to set the endpoint
BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://www.aviramsegal.com/ws/sample");
/* Optional credentials */
bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "user");
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "password");
@MathieuLorber
Copy link

9 years later, THANK YOU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment