Created
July 18, 2011 22:06
-
-
Save whaley/1090795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public <T> T publishEndpointAndReturnProxy(Class<T> jaxWsAnnotatedInterface, T serviceImplementation) { | |
if (jaxWsAnnotatedInterface.isInterface() && | |
jaxWsAnnotatedInterface.getAnnotation(WebService.class) != null && | |
jaxWsAnnotatedInterface.isInstance(serviceImplementation)) { | |
String endpointUrl = getAvailableEndpointUrl(); | |
endpoint = Endpoint.publish(endpointUrl, serviceImplementation); | |
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); | |
factory.setServiceClass(jaxWsAnnotatedInterface); | |
factory.setAddress(endpointUrl); | |
T serviceProxy = (T) factory.create(); | |
return serviceProxy; | |
} else { | |
throw new IllegalArgumentException("Passed in interface class type must be annotated with @WebService " + | |
"and object reference must be an implementing class of that interface."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment