// Check for the SOAPBinding annotation...
// look at the declaring class and method first
Class cl = method.getDeclaringClass();
Method eiMethod = null;
SOAPBinding soapBinding = (SOAPBinding) cl.getAnnotation(SOAPBinding.class);
if (method.isAnnotationPresent(SOAPBinding.class))
soapBinding = method.getAnnotation(SOAPBinding.class);
if (soapBinding == null) {
// Then look at the endpoint interface, if available
WebService webService = (WebService) cl.getAnnotation(WebService.class);
if (webService != null) {
if (! "".equals(webService.endpointInterface())) {
try {
ClassLoader loader = cl.getClassLoader();
Class endpointInterface =
loader.loadClass(webService.endpointInterface());
soapBinding =
(SOAPBinding) endpointInterface.getAnnotation(SOAPBinding.class);
eiMethod = endpointInterface.getMethod(method.getName(),
method.getParameterTypes());
if (eiMethod.isAnnotationPresent(SOAPBinding.class))
soapBinding = eiMethod.getAnnotation(SOAPBinding.class);
}
catch (ClassNotFoundException e) {
throw new WebServiceException(L.l("Endpoint interface {0} not found", webService.endpointInterface()), e);
}
catch (NoSuchMethodException e) {
// We don't care if the method isn't defined in the interface
}
}
}
}
// Document wrapped is the default for methods w/o a @SOAPBinding
if (soapBinding == null)
return new DocumentWrappedAction(method, eiMethod,
jaxbContext, targetNamespace, wsdl,
marshaller, unmarshaller);
if (soapBinding.use() == SOAPBinding.Use.ENCODED)
throw new UnsupportedOperationException(L.l("SOAP encoded style is not supported by JAX-WS"));
if (soapBinding.style() == SOAPBinding.Style.DOCUMENT) {
if (soapBinding.parameterStyle() == SOAPBinding.ParameterStyle.WRAPPED)
return new DocumentWrappedAction(method, eiMethod,
jaxbContext, targetNamespace, wsdl,
marshaller, unmarshaller);
else {
return new DocumentBareAction(method, eiMethod,
jaxbContext, targetNamespace, wsdl,
marshaller, unmarshaller);
}
}
else {
if (soapBinding.parameterStyle() != SOAPBinding.ParameterStyle.WRAPPED)
throw new UnsupportedOperationException(L.l("SOAP RPC bare style not supported"));
return new RpcAction(method, eiMethod, jaxbContext, targetNamespace, wsdl,
marshaller, unmarshaller);
}