You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ba...@apache.org on 2006/11/14 04:39:38 UTC
svn commit: r474640 - in
/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description:
./ builder/ impl/
Author: barrettj
Date: Mon Nov 13 19:39:37 2006
New Revision: 474640
URL: http://svn.apache.org/viewvc?view=rev&rev=474640
Log:
AXIS2-1696
Patch contributed by Roy Wood Jr. with minor modifications by Jeff Barrett
Added:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/WsdlGenerator.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/ParameterDescriptionComposite.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java Mon Nov 13 19:39:37 2006
@@ -69,6 +69,7 @@
public abstract boolean isProviderBased();
public abstract boolean isEndpointBased();
+ public abstract String getTargetNamespace();
public abstract String getBindingType();
public abstract List<String> getHandlerList();
public abstract QName getPortQName();
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java Mon Nov 13 19:39:37 2006
@@ -62,5 +62,7 @@
public abstract ServiceClient getServiceClient(QName portQName);
public abstract QName getServiceQName();
+
+
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java Mon Nov 13 19:39:37 2006
@@ -7,6 +7,7 @@
public interface ServiceDescriptionWSDL {
// TODO: Remove these and replace with appropraite get* methods for WSDL information
public abstract WSDLWrapper getWSDLWrapper();
+ public abstract WSDLWrapper getGeneratedWsdlWrapper();
public abstract URL getWSDLLocation();
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java Mon Nov 13 19:39:37 2006
@@ -10,9 +10,6 @@
import javax.wsdl.Definition;
-import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.util.WSDL4JWrapper;
-
public class DescriptionBuilderComposite {
/*
* This structure contains the full reflected class, as well as, the
@@ -23,10 +20,10 @@
public DescriptionBuilderComposite () {
- methodDescriptions = new ArrayList<MethodDescriptionComposite>();
- fieldDescriptions = new ArrayList<FieldDescriptionComposite>();
- webServiceRefAnnotList = new ArrayList<WebServiceRefAnnot>();
- interfacesList = new ArrayList<String>();
+ methodDescriptions = new ArrayList<MethodDescriptionComposite>();
+ fieldDescriptions = new ArrayList<FieldDescriptionComposite>();
+ webServiceRefAnnotList = new ArrayList<WebServiceRefAnnot>();
+ interfacesList = new ArrayList<String>();
}
//Class type within the module
@@ -58,6 +55,9 @@
private List<MethodDescriptionComposite> methodDescriptions;
private List<FieldDescriptionComposite> fieldDescriptions;
+
+ private WsdlGenerator wsdlGenerator;
+ private ClassLoader classLoader;
// Methods
public WebServiceAnnot getWebServiceAnnot() {
@@ -238,6 +238,22 @@
}
/**
+ * @return Returns the ModuleClassType.
+ */
+ public WsdlGenerator getCustomWsdlGenerator() {
+
+ return this.wsdlGenerator;
+ }
+
+ /**
+ * @return Returns the ClassLoader.
+ */
+ public ClassLoader getClassLoader() {
+
+ return this.classLoader;
+ }
+
+ /**
*
* @return Returns true if this is an interface
*/
@@ -393,6 +409,22 @@
//TODO: Determine the class type
}
return moduleClassType;
+ }
+
+ /**
+ * @return Returns the ModuleClassType.
+ */
+ public void setCustomWsdlGenerator(WsdlGenerator wsdlGenerator) {
+
+ this.wsdlGenerator = wsdlGenerator;
+ }
+
+ /**
+ * @return Returns the ModuleClassType.
+ */
+ public void setClassLoader(ClassLoader classLoader) {
+
+ this.classLoader = classLoader;
}
/**
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java Mon Nov 13 19:39:37 2006
@@ -28,7 +28,7 @@
public static final String WSDL_PORT = "WSDL_PORT";
public static final String WSDL_DEFINITION = WSDLConstants.WSDL_4_J_DEFINITION;
public static final String WSDL_LOCATION = "WSDL_LOCATION";
- public static final String SERVICE_CLASS = "SERVICE_CLASS";
+ public static final String SERVICE_CLASS = "ServiceClass";
public static final String WSDL_PORTTYPE_NAME = "WSDL_PORTTYPE_NAME";
public static final String OBJECT_CLASS_NAME = "java.lang.Object";
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java Mon Nov 13 19:39:37 2006
@@ -27,6 +27,7 @@
private ResponseWrapperAnnot responseWrapperAnnot;//TODO EDIT CHECK: only on methods of SEI
private List<ParameterDescriptionComposite> parameterDescriptions;//TODO EDIT CHECK: only on methods of SEI
+ private DescriptionBuilderComposite parentDBC;
/*
* Default Constructor
@@ -174,6 +175,14 @@
}
/**
+ * @return Returns the ModuleClassType.
+ */
+ public DescriptionBuilderComposite getDescriptionBuilderCompositeRef() {
+
+ return this.parentDBC;
+ }
+
+ /**
* @param methodName The methodName to set.
*/
public void setMethodName(String methodName) {
@@ -308,6 +317,14 @@
*/
public void setDeclaringClass(String declaringClass) {
this.declaringClass = declaringClass;
+ }
+
+ /**
+ * @return Returns the ModuleClassType.
+ */
+ public void setDescriptionBuilderCompositeRef(DescriptionBuilderComposite dbc) {
+
+ this.parentDBC = dbc;
}
/**
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/ParameterDescriptionComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/ParameterDescriptionComposite.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/ParameterDescriptionComposite.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/ParameterDescriptionComposite.java Mon Nov 13 19:39:37 2006
@@ -17,8 +17,9 @@
private WebServiceRefAnnot webServiceRefAnnot;
private WebServiceContextAnnot webServiceContextAnnot;
private int listOrder;
- private ClassLoader classLoader;
+ private MethodDescriptionComposite parentMDC;
+
public ParameterDescriptionComposite () {
}
@@ -51,6 +52,10 @@
* Do lazy loading
*/
public Class getParameterTypeClass() {
+
+ ClassLoader classLoader = null;
+ // classLoader = getMethodDescriptionCompositeRef().getDescriptionBuilderCompositeRef().getClassLoader();
+
if (parameterTypeClass == null) {
if (getParameterType() != null) {
parameterTypeClass = getPrimitiveClass(getParameterType());
@@ -116,13 +121,13 @@
return listOrder;
}
- /*
- * @return Returns the classloader to use
+ /**
+ * @return Returns the parentMDC.
*/
- public ClassLoader getClassLoader() {
- return this.classLoader;
+ public MethodDescriptionComposite getMethodDescriptionCompositeRef() {
+ return this.parentMDC;
}
-
+
/**
* @param parameterType The parameterType to set.
*/
@@ -172,17 +177,17 @@
this.listOrder = listOrder;
}
- /*
- * @param classLoader the class loader to set
+ /**
+ * @param mdc The parent MethodDescriptionComposite to set.
*/
- public void setClassLoader(ClassLoader classLoader) {
- this.classLoader = classLoader;
+ public void setMethodDescriptionCompositeRef(MethodDescriptionComposite mdc) {
+ this.parentMDC = mdc;
}
private Class getPrimitiveClass(String classType) {
Class paramClass = null;
-System.out.println("classType: " +classType);
+
if (classType.equals("int")) {
paramClass = int.class;
} else if (classType.equals("byte")) {
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/WsdlGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/WsdlGenerator.java?view=auto&rev=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/WsdlGenerator.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/builder/WsdlGenerator.java Mon Nov 13 19:39:37 2006
@@ -0,0 +1,8 @@
+package org.apache.axis2.jaxws.description.builder;
+
+import javax.wsdl.Definition;
+
+public interface WsdlGenerator {
+
+ public Definition generateWsdl(Class implClass);
+}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Mon Nov 13 19:39:37 2006
@@ -52,6 +52,7 @@
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.builder.MDQConstants;
import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.util.WSDL4JWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
@@ -65,7 +66,6 @@
* somehow from an AxisService/AxisPort combination, and not directly from the WSDL.
*/
class EndpointDescriptionImpl implements EndpointDescription, EndpointDescriptionJava, EndpointDescriptionWSDL {
-
private ServiceDescriptionImpl parentServiceDescription;
private AxisService axisService;
@@ -230,41 +230,52 @@
// Remember that this will only happen when we generate an AxisService from existing
// WSDL and then need to perform further processing because we have annotations as well
// If there is no WSDL, we would never process the Method to begin with.
-
+
+
buildDescriptionHierachy();
- //Currently, we need to set the anonymous operations only for the client
- //side
- //TODO: Determine if we need to do this for server side?
- // addAnonymousAxisOperations();
-
- // This will set the serviceClient field after adding the AxisService
- // to the AxisConfig...probably not necessary on server side
- //getServiceClient();
+ //Invoke the callback for generating the wsdl
+ if (composite.getCustomWsdlGenerator() != null) {
+ Definition wsdlDef =
+ composite.getCustomWsdlGenerator().generateWsdl((Class)axisService.getParameterValue(MDQConstants.SERVICE_CLASS));
+
+ try {
+ WSDL4JWrapper wsdl4jWrapper = new WSDL4JWrapper(composite.getWsdlURL(), wsdlDef);
+ getServiceDescriptionImpl().setGeneratedWsdlWrapper(wsdl4jWrapper);
+ } catch (Exception e) {
+ throw ExceptionFactory.makeWebServiceException("EndpointDescriptionImpl: WSDLException thrown when attempting to instantiate WSDL4JWrapper ");
+ }
+ }
+
+ //Save the WSDL Definition
+ // REVIEW: This could be a PARTIAL WSDL; not sure if that will cause trouble later on.
+ // Maybe we should always be setting it to generated WSDL
+ Parameter wsdlDefParameter = new Parameter();
+ wsdlDefParameter.setName(MDQConstants.WSDL_DEFINITION);
- // Give the configuration builder a chance to finalize configuration for this service
+ if (getServiceDescriptionImpl().getWSDLWrapper() != null) {
+ wsdlDefParameter.setValue(getServiceDescriptionImpl().getWSDLWrapper().getDefinition());
+ } else {
+ if (getServiceDescriptionImpl().getGeneratedWsdlWrapper() != null) {
+ wsdlDefParameter.setValue(getServiceDescriptionImpl().getGeneratedWsdlWrapper().getDefinition());
+ } else {
+ //TODO: Hmmm, this should probably be an exception, will probably always need to set wsdl
+ }
+ }
- //Supposedly, this call should only be made for the client, comment out
- //for now. Be careful, this may be needed for finalizing configuration
-/*
+ //Save the WSDL Location
+ //REVIEW: hmm, this won't always be set
+ Parameter wsdlLocationParameter = new Parameter();
+ wsdlLocationParameter.setName(MDQConstants.WSDL_LOCATION);
+ wsdlLocationParameter.setValue(getAnnoWebServiceWSDLLocation());
+
try {
- getServiceDescription().getClientConfigurationFactory().completeAxis2Configuration(axisService);
- } catch (DeploymentException e) {
- // TODO RAS
- // TODO NLS
- // TODO: Remove this println
- System.out.println("Caught exception in ServiceDescription.ServiceDescription: " + e);
- e.printStackTrace();
-// throw ExceptionFactory.makeWebServiceException("ServiceDescription caught " + e);
+ axisService.addParameter(wsdlDefParameter);
+ axisService.addParameter(wsdlLocationParameter);
} catch (Exception e) {
- // TODO RAS
- // TODO NLS
- // TODO: Remove this println
- System.out.println("Caught exception in ServiceDescription.ServiceDescription: " + e);
- e.printStackTrace();
-// throw ExceptionFactory.makeWebServiceException("ServiceDescription caught " + e);
+ throw ExceptionFactory.makeWebServiceException("EndpointDescription: Unable to add parms. to AxisService");
}
- */
+
}
/**
@@ -549,22 +560,6 @@
portParameter.setName(MDQConstants.WSDL_PORT);
portParameter.setValue(getPortQName().getLocalPart());
- //Save the WSDL Definition
- // REVIEW: This could be a PARTIAL WSDL; not sure if that will cause trouble later on.
- Parameter wsdlDefParameter = new Parameter();
- wsdlDefParameter.setName(MDQConstants.WSDL_DEFINITION);
-
- //TODO: At some point this should always return a valid WSDL definition, for now just
- // make sure we don't get an NPE
- if (getServiceDescriptionImpl().getWSDLWrapper() != null)
- wsdlDefParameter.setValue(getServiceDescriptionImpl().getWSDLWrapper().getDefinition());
- else
- wsdlDefParameter.setValue(getServiceDescriptionImpl().getWSDLWrapper());
-
- //Save the WSDL Location
- Parameter wsdlLocationParameter = new Parameter();
- wsdlDefParameter.setName(MDQConstants.WSDL_LOCATION);
- wsdlDefParameter.setValue(getAnnoWebServiceWSDLLocation());
//Save the fully qualified class name for the serviceImpl
Parameter serviceClassNameParameter = new Parameter();
@@ -575,8 +570,6 @@
axisService.addParameter(portTypeNameParameter);
axisService.addParameter(serviceNameParameter);
axisService.addParameter(portParameter);
- axisService.addParameter(wsdlDefParameter);
- axisService.addParameter(wsdlLocationParameter);
axisService.addParameter(serviceClassNameParameter);
}
catch (AxisFault e) {
@@ -605,7 +598,7 @@
else
serviceBuilder.setServerSide(false);
- axisService = serviceBuilder.populateService();
+ axisService = serviceBuilder.populateService();
axisService.setName(createAxisServiceName());
isBuiltFromWSDL = true;
} catch (AxisFault e) {
@@ -1074,6 +1067,11 @@
public Service.Mode getServiceMode() {
// TODO: (JLB) WSDL/Anno Merge
return getAnnoServiceModeValue();
+ }
+
+ public String getTargetNamespace() {
+ // TODO: (JLB) WSDL/Anno Merge
+ return getAnnoWebServiceTargetNamespace();
}
public Service.Mode getAnnoServiceModeValue() {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Mon Nov 13 19:39:37 2006
@@ -22,6 +22,7 @@
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import javax.jws.soap.SOAPBinding;
import javax.xml.namespace.QName;
@@ -118,14 +119,18 @@
* @param parent
*/
EndpointInterfaceDescriptionImpl( DescriptionBuilderComposite dbc,
- boolean isClass,
- EndpointDescriptionImpl parent){
+ boolean isClass,
+ EndpointDescriptionImpl parent){
parentEndpointDescription = parent;
this.dbc = dbc;
// BasicConfigurator.configure();
+ //TODO: yikes! ...too much redirection, consider setting this in higher level
+ getEndpointDescription().getAxisService().setName(getEndpointDescriptionImpl().getServiceQName().getLocalPart());
+ getEndpointDescription().getAxisService().setTargetNamespace(getEndpointDescriptionImpl().getTargetNamespace());
+
//TODO: Determine if the isClass parameter is really necessary
// Per JSR-181 all methods on the SEI are mapped to operations regardless
@@ -467,6 +472,9 @@
return soapParameterStyle;
}
+ /*
+ * Returns a non-null (possibly empty) list of MethodDescriptionComposites
+ */
Iterator<MethodDescriptionComposite> retrieveReleventMethods(DescriptionBuilderComposite dbc) {
/*
@@ -492,6 +500,10 @@
//Now gather methods off the chain of superclasses, if any
DescriptionBuilderComposite tempDBC = dbc;
while (!DescriptionUtils.isEmpty(tempDBC.getSuperClassName())) {
+
+ if (DescriptionUtils.javifyClassName(tempDBC.getSuperClassName()).equals(MDQConstants.OBJECT_CLASS_NAME))
+ break;
+
DescriptionBuilderComposite superDBC =
getEndpointDescriptionImpl().getServiceDescriptionImpl().getDBCMap().get(tempDBC.getSuperClassName());
retrieveList.addAll(retrieveSEIMethods(superDBC));
@@ -552,6 +564,9 @@
return retrieveList.iterator();
}
+ /*
+ * This is called when we know that this DBC is an implicit SEI
+ */
private ArrayList<MethodDescriptionComposite> retrieveImplicitSEIMethods(DescriptionBuilderComposite dbc) {
ArrayList<MethodDescriptionComposite> retrieveList = new ArrayList<MethodDescriptionComposite>();
@@ -560,14 +575,20 @@
//If this list is empty, then there are no false exclusions, so gather
//all composites that don't have exclude == true
+ //If the list is not empty, then it means we found at least one method with 'exclude==false'
+ //so the list should contain only those methods
if (retrieveList == null || retrieveList.size() == 0) {
- Iterator<MethodDescriptionComposite> iter = dbc.getMethodDescriptionsList().iterator();
-
- while (iter.hasNext()) {
- MethodDescriptionComposite mdc = iter.next();
-
- if (!DescriptionUtils.isExcludeTrue(mdc)) {
- retrieveList.add(mdc);
+ Iterator<MethodDescriptionComposite> iter = null;
+ List<MethodDescriptionComposite> mdcList = dbc.getMethodDescriptionsList();
+
+ if (mdcList != null) {
+ iter = dbc.getMethodDescriptionsList().iterator();
+ while (iter.hasNext()) {
+ MethodDescriptionComposite mdc = iter.next();
+
+ if (!DescriptionUtils.isExcludeTrue(mdc)) {
+ retrieveList.add(mdc);
+ }
}
}
}
@@ -581,13 +602,17 @@
//Just retrieve all methods regardless of WebMethod annotations
ArrayList<MethodDescriptionComposite> retrieveList = new ArrayList<MethodDescriptionComposite>();
- Iterator<MethodDescriptionComposite> iter = dbc.getMethodDescriptionsList().iterator();
+ Iterator<MethodDescriptionComposite> iter = null;
+ List<MethodDescriptionComposite> mdcList = dbc.getMethodDescriptionsList();
- while (iter.hasNext()) {
- MethodDescriptionComposite mdc = iter.next();
- retrieveList.add(mdc);
+ if (mdcList != null) {
+ iter = dbc.getMethodDescriptionsList().iterator();
+ while (iter.hasNext()) {
+ MethodDescriptionComposite mdc = iter.next();
+ retrieveList.add(mdc);
+ }
}
-
+
return retrieveList;
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java Mon Nov 13 19:39:37 2006
@@ -21,12 +21,14 @@
import java.lang.reflect.Constructor;
import java.util.StringTokenizer;
+import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.WebFault;
import org.apache.axis2.jaxws.description.FaultDescription;
import org.apache.axis2.jaxws.description.FaultDescriptionJava;
import org.apache.axis2.jaxws.description.FaultDescriptionWSDL;
import org.apache.axis2.jaxws.description.OperationDescription;
+import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
/**
* @see ../FaultDescription
@@ -37,9 +39,11 @@
class FaultDescriptionImpl implements FaultDescription, FaultDescriptionJava, FaultDescriptionWSDL {
private Class exceptionClass;
+ private DescriptionBuilderComposite composite;
private WebFault annotation;
private OperationDescription parent;
+
private String name = ""; // WebFault.name
private String faultBean = ""; // WebFault.faultBean
private String targetNamespace = ""; // WebFault.targetNamespace
@@ -58,13 +62,25 @@
* @param annotation the WebFault annotation object on this exception class
* @param parent the OperationDescription that is the parent of this FaultDescription
*/
- public FaultDescriptionImpl(Class exceptionClass, WebFault annotation, OperationDescription parent) {
+ FaultDescriptionImpl(Class exceptionClass, WebFault annotation, OperationDescription parent) {
this.exceptionClass = exceptionClass;
this.annotation = annotation;
this.parent = parent;
}
+ FaultDescriptionImpl(DescriptionBuilderComposite faultDBC, OperationDescription parent) {
+ this.composite = faultDBC;
+ this.parent = parent;
+ }
+
public WebFault getAnnoWebFault() {
+
+ if (annotation == null) {
+ if (isDBC()) {
+ annotation = this.composite.getWebFaultAnnot();
+ }
+ }
+
return annotation;
}
@@ -89,26 +105,30 @@
* of each is the faultBean. Let's see if we can figure what the faultBean is from that:
*/
- try {
- Constructor[] cons = exceptionClass.getConstructors();
- Class[] parms = cons[0].getParameterTypes();
- faultBean = parms[1].getCanonicalName();
- } catch (Exception e) {
- /*
- * if faultBean is still not set, then something is wrong with the exception
- * class that the code generators generated, or someone instantiated a FaultDescription
- * object for a generic exception.
- *
- * TODO log it? I don't think we need to worry about throwing an exception here, as we're just
- * doing a best-effort to determine the faultBean name. If the try{} fails, something is really
- * messed up in the generated code anyway, and I suspect nothing would work right.
- */
- }
-
- // If all else fails, this might get us what we want:
- if ((faultBean == null) || (faultBean.length() == 0))
- faultBean = getOperationDescription().getRequestWrapperClassName().toString() + FAULT;
-
+ if (!isDBC()) {
+ try {
+ Constructor[] cons = exceptionClass.getConstructors();
+ Class[] parms = cons[0].getParameterTypes();
+ faultBean = parms[1].getCanonicalName();
+ } catch (Exception e) {
+ /*
+ * if faultBean is still not set, then something is wrong with the exception
+ * class that the code generators generated, or someone instantiated a FaultDescription
+ * object for a generic exception.
+ *
+ * TODO log it? I don't think we need to worry about throwing an exception here, as we're just
+ * doing a best-effort to determine the faultBean name. If the try{} fails, something is really
+ * messed up in the generated code anyway, and I suspect nothing would work right.
+ */
+ }
+
+ // If all else fails, this might get us what we want:
+ if ((faultBean == null) || (faultBean.length() == 0))
+ faultBean = getOperationDescription().getRequestWrapperClassName().toString() + FAULT;
+ } else {
+ //REVIEW: Need to verify that this is the name we need...hmm, seems to easy
+ faultBean = composite.getClassName();
+ }
}
return faultBean;
}
@@ -135,7 +155,8 @@
targetNamespace = annotation.targetNamespace();
}
else {
- // need to figure out a default. Let's use the logic in getFaultBean() and make a namespace out of the package
+ // need to figure out a default. Let's use the logic in getFaultBean()
+ //and make a namespace out of the package
targetNamespace = makeNamespace(getFaultBean());
}
@@ -143,10 +164,14 @@
}
public String getExceptionClassName() {
- // no need for defaults here. The exceptionClass stored in this
- // FaultDescription object is one that has been declared to be
- // thrown from the service method
- return exceptionClass.getCanonicalName();
+ if (!isDBC()) {
+ // no need for defaults here. The exceptionClass stored in this
+ // FaultDescription object is one that has been declared to be
+ // thrown from the service method
+ return exceptionClass.getCanonicalName();
+ } else {
+ return composite.getClassName();
+ }
}
public OperationDescription getOperationDescription() {
@@ -198,6 +223,13 @@
}
namespace.append('/');
return namespace.toString();
+ }
+
+ private boolean isDBC() {
+ if (this.composite != null)
+ return true;
+ else
+ return false;
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Mon Nov 13 19:39:37 2006
@@ -22,6 +22,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import javax.jws.Oneway;
@@ -37,6 +38,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisOperationFactory;
+import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
import org.apache.axis2.jaxws.description.FaultDescription;
@@ -45,6 +47,7 @@
import org.apache.axis2.jaxws.description.OperationDescriptionWSDL;
import org.apache.axis2.jaxws.description.ParameterDescription;
import org.apache.axis2.jaxws.description.ParameterDescriptionJava;
+import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.OneWayAnnot;
import org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite;
@@ -245,7 +248,11 @@
public EndpointInterfaceDescription getEndpointInterfaceDescription() {
return parentEndpointInterfaceDescription;
}
-
+
+ public EndpointInterfaceDescriptionImpl getEndpointInterfaceDescriptionImpl() {
+ return (EndpointInterfaceDescriptionImpl) parentEndpointInterfaceDescription;
+ }
+
public AxisOperation getAxisOperation() {
return axisOperation;
}
@@ -364,7 +371,40 @@
}
} else {
// TODO do I care about methodComposite like the paramDescription does?
+ //Call FaultDescriptionImpl for all non-generic exceptions...Need to check a
+ // a couple of things
+ // 1. If this is a generic exception, ignore it
+ // 2. If this is not a generic exception, then find it in the DBC Map
+ // If not found in map, then throw not found exception
+ // Else it was found, Verify that it has a WebFault Annotation, if not
+ // then throw exception
+ //3. Pass the validated WebFault dbc and possibly the classImpl dbc to FaultDescription
+ //4. Possibly set AxisOperation.setFaultMessages array...or something like that
+
+ String[] webFaultClassNames = methodComposite.getExceptions();
+
+ HashMap<String, DescriptionBuilderComposite> dbcMap =
+ getEndpointInterfaceDescriptionImpl().getEndpointDescriptionImpl().getServiceDescriptionImpl().getDBCMap();
+
+ if (webFaultClassNames != null) {
+ for (String wfClassName:webFaultClassNames) {
+ // Try to find this exception class in the dbc list. If we can't find it
+ // then just assume that its a generic exception.
+
+ DescriptionBuilderComposite faultDBC = dbcMap.get(wfClassName);
+
+ if (faultDBC != null){
+ if (faultDBC.getWebFaultAnnot() == null) {
+ throw ExceptionFactory.makeWebServiceException("OperationDescription: custom exception does not contain WebFault annotation");
+ } else {
+ //We found a valid exception composite thats annotated
+ buildFaultList.add(new FaultDescriptionImpl(faultDBC, this));
+ }
+ }
+ }
+ }
}
+
return buildFaultList.toArray(new FaultDescription[0]);
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?view=diff&rev=474640&r1=474639&r2=474640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Mon Nov 13 19:39:37 2006
@@ -32,6 +32,7 @@
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
import org.apache.axis2.jaxws.ClientConfigurationFactory;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.EndpointDescription;
@@ -64,6 +65,7 @@
// TODO: Possibly remove Definition and delegate to the Defn on the AxisSerivce set as a paramater by WSDLtoAxisServicBuilder?
private WSDLWrapper wsdlWrapper;
+ private WSDLWrapper generatedWsdlWrapper;
private Hashtable<QName, EndpointDescriptionImpl> endpointDescriptions = new Hashtable<QName, EndpointDescriptionImpl>();
@@ -153,6 +155,7 @@
// it will be set to the annotation value.
//EndpointDescription endpointDescription = new EndpointDescription(null, this, serviceImplName);
EndpointDescriptionImpl endpointDescription = new EndpointDescriptionImpl(this, serviceImplName);
+
addEndpointDescription(endpointDescription);
}
@@ -419,6 +422,10 @@
return wsdlURL;
}
+ public WSDLWrapper getGeneratedWsdlWrapper() {
+ return this.generatedWsdlWrapper;
+ }
+
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.description.ServiceDescription#getAxisConfigContext()
*/
@@ -467,6 +474,10 @@
return dbcMap;
}
+ void setGeneratedWsdlWrapper(WSDL4JWrapper wrapper) {
+ this.generatedWsdlWrapper = wrapper;
+ }
+
private void validateDBCLIntegrity(){
//First, check the integrity of this input composite
@@ -573,7 +584,7 @@
|| composite.getWebFaultAnnot() != null
|| composite.getWebServiceClientAnnot() != null
|| composite.getWebServiceContextAnnot()!= null
- || composite.getAllWebServiceRefAnnots() != null
+ || !composite.getAllWebServiceRefAnnots().isEmpty()
) {
throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: invalid annotations specified when WebService annotation specifies an endpoint interface");
}
@@ -711,9 +722,6 @@
//TODO: Validate that the interface is public
- if (!composite.getWebServiceAnnot().endpointInterface().equals("")) {
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: WebService annotation contains a non-empty field for the SEI");
- }
// Call ValidateWebMethodAnnots()
//
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org