Author: thomas.diesler(a)jboss.com
Date: 2006-11-22 07:18:15 -0500 (Wed, 22 Nov 2006)
New Revision: 1497
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
Log:
Fix endless loop.
Fix processing of methods without @WebMethod
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-11-21
20:58:12 UTC (rev 1496)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-11-22
12:18:15 UTC (rev 1497)
@@ -63,9 +63,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.addressing.AddressingPropertiesImpl;
import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.annotation.PortComponent;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.jaxrpc.Use;
import org.jboss.ws.jaxws.DynamicWrapperGenerator;
@@ -152,9 +150,9 @@
WebService seiAnnotation = null;
- for(Class<?> potentialSEI : sepClass.getInterfaces())
+ for (Class<?> potentialSEI : sepClass.getInterfaces())
{
- if(potentialSEI.isAnnotationPresent(WebService.class))
+ if (potentialSEI.isAnnotationPresent(WebService.class))
{
seiClass = potentialSEI;
seiName = seiClass.getName();
@@ -163,7 +161,7 @@
}
}
- if(seiAnnotation!=null)
+ if (seiAnnotation != null)
anWebService = seiAnnotation;
}
@@ -285,16 +283,16 @@
protected void createJAXBContext(EndpointMetaData epMetaData)
{
- try
- {
- String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
- log.debug("JAXBContext [types=" + javaTypes + ",tns=" + targetNS
+ "]");
- jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]), typeRefs,
targetNS, false);
- }
- catch (JAXBException ex)
- {
+ try
+ {
+ String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
+ log.debug("JAXBContext [types=" + javaTypes + ",tns=" +
targetNS + "]");
+ jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]), typeRefs,
targetNS, false);
+ }
+ catch (JAXBException ex)
+ {
throw new IllegalStateException("Cannot build JAXB context", ex);
- }
+ }
}
protected void populateXmlTypes(EndpointMetaData epMetaData)
@@ -354,7 +352,7 @@
paramMetaData.setXmlType(xmlType);
}
- types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName));
+ types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName));
}
private void populateXmlType(FaultMetaData faultMetaData)
@@ -395,6 +393,12 @@
return null;
}
+ // If the implementation bean does not implement a service endpoint interface and
+ // there are no @WebMethod annotations in the implementation bean (excluding
+ // @WebMethod annotations used to exclude inherited @WebMethods), all public
+ // methods other than those inherited from java.lang.Object will be exposed as Web
+ // Service operations, subject to the inheritance rules specified in Common
+ // Annotations for the Java Platform [12], section 2.1.
protected void processWebMethods(EndpointMetaData epMetaData, Class wsClass, boolean
includeAllMethods)
{
epMetaData.clearOperations();
@@ -414,28 +418,20 @@
//
http://jira.jboss.org/jira/browse/JBWS-754
if (webMethodCount == 0)
{
- Class superClass = wsClass.getSuperclass();
-
- while (superClass != null)
+ Class auxClass = wsClass;
+ while (auxClass != Object.class)
{
- boolean isJDKClass =
superClass.getPackage().getName().startsWith("java");
-
- if(!isJDKClass)
+ for (Method method : auxClass.getDeclaredMethods())
{
- for (Method method : superClass.getMethods())
- {
- processWebMethod(epMetaData, method);
- webMethodCount++;
- }
-
- superClass = superClass.getSuperclass();
-
+ processWebMethod(epMetaData, method);
+ webMethodCount++;
}
+ auxClass = auxClass.getSuperclass();
}
}
if (webMethodCount == 0)
- throw new WSException("At least one @WebMethod annotation is
required");
+ throw new WSException("At least one @WebMethod annotation is required:
" + wsClass.getName());
}
private void processWebMethod(EndpointMetaData epMetaData, Method method)
@@ -443,7 +439,7 @@
String javaName = method.getName();
// skip asnyc methods, they dont need meta data representation
- if(method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
+ if (method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
return;
ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
@@ -792,7 +788,7 @@
private QName getWebParamName(OperationMetaData opMetaData, int index, Class javaType,
WebParam webParam)
{
- String namespace = null ;
+ String namespace = null;
String name = null;
boolean header = false;