[jbossws-commits] JBossWS SVN: r8437 - stack/metro/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Sat Oct 11 06:25:31 EDT 2008
Author: alessio.soldano at jboss.com
Date: 2008-10-11 06:25:31 -0400 (Sat, 11 Oct 2008)
New Revision: 8437
Modified:
stack/metro/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java
Log:
[JBWS-2129] Adding @WebFault check to understand whether wrapper generation is required
Modified: stack/metro/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java
===================================================================
--- stack/metro/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java 2008-10-10 18:08:27 UTC (rev 8436)
+++ stack/metro/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java 2008-10-11 10:25:31 UTC (rev 8437)
@@ -25,17 +25,21 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.jws.soap.SOAPBinding.Style;
@@ -44,6 +48,7 @@
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.WebFault;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.MTOMFeature;
@@ -332,24 +337,57 @@
if (webServiceAnnotation == null)
return false;
String wsdlLocation = webServiceAnnotation.wsdlLocation();
- String endpointInterface = webServiceAnnotation.endpointInterface();
if (wsdlLocation != null && !"".equals(wsdlLocation))
return false; //provided wsdlLocation means a top-down (contract first) development is used, thus the user should use wsimport
+
+ String endpointInterface = webServiceAnnotation.endpointInterface();
javax.jws.soap.SOAPBinding soapBinding;
if (endpointInterface == null || "".equalsIgnoreCase(endpointInterface))
{
+ if (isFaultWrapperGenerationRequired(endpoint))
+ return true;
soapBinding = endpoint.getAnnotation(javax.jws.soap.SOAPBinding.class);
}
else
{
- //getting the annotation from the SEI
+ //Using the SEI to get annotations
Class<?> sei = getImplementorClass(endpointInterface, reader, classLoader);
+ if (isFaultWrapperGenerationRequired(sei))
+ return true;
soapBinding = sei.getAnnotation(javax.jws.soap.SOAPBinding.class);
}
if (soapBinding == null)
return true; //no @SOAPBinding means default settings, ie. doc/lit wrapped
return !(ParameterStyle.BARE.equals(soapBinding.parameterStyle()) || Style.RPC.equals(soapBinding.style()) || Use.ENCODED.equals(soapBinding.use()));
}
+
+
+ private boolean isFaultWrapperGenerationRequired(Class<?> clazz)
+ {
+ Method[] classMethods = clazz.getMethods();
+ boolean webMethodAnnUsed = false;
+ List<Method> webMethods = new LinkedList<Method>();
+ for (Method m : classMethods)
+ {
+ if (m.getAnnotation(WebMethod.class) != null)
+ {
+ webMethods.add(m);
+ webMethodAnnUsed = true;
+ }
+ }
+ List<Method> methods = webMethodAnnUsed ? webMethods : Arrays.asList(classMethods);
+ for (Method m : methods)
+ {
+ Class<?>[] exceptionClasses = m.getExceptionTypes();
+ for (Class<?> exceptionClass : exceptionClasses)
+ {
+ if (exceptionClass.getAnnotation(WebFault.class) != null)
+ return true;
+ }
+ }
+ return false;
+ }
+
protected Invoker createInvoker(Class<?> implementorClass)
{
More information about the jbossws-commits
mailing list