You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2007/01/31 21:35:35 UTC
svn commit: r501978 [16/24] - in /webservices/axis2/branches/java/maven2: ./
etc/ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/
modules/adb-codegen/src/org/apache/axis2/s...
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java Wed Jan 31 12:35:21 2007
@@ -27,6 +27,7 @@
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.WebMethodAnnot;
+import static org.apache.axis2.jaxws.description.builder.MDQConstants.CONSTRUCTOR_METHOD;
/**
* Utilities used throughout the Description package.
@@ -249,4 +250,73 @@
// Don't make this public, its a security exposure
return Class.forName(className, true, Thread.currentThread().getContextClassLoader());
}
+
+ /**
+ * Determines whether a method should have an OperationDescription created for it
+ * based on the name. This is a convenience method to allow us to exlude methods
+ * such as constructors.
+ * @param methodName
+ * @return
+ */
+ static boolean createOperationDescription(String methodName) {
+ if(methodName.equals(CONSTRUCTOR_METHOD)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Determine the actual packager name for the generated artifacts by trying to load the class from one of two
+ * packages. This is necessary because the RI implementations of WSGen and WSImport generate the artifacts
+ * in different packages:
+ * - WSImport generates the artifacts in the same package as the SEI
+ * - WSGen generates the artifacts in a "jaxws" sub package under the SEI package.
+ * Note that from reading the JAX-WS spec, it seems that WSGen is doing that correctly; See
+ * the conformance requirement in JAX-WS 2.0 Spec Section 3.6.2.1 Document Wrapped on page 36:
+ * Conformance (Default wrapper bean package): In the absence of customizations, the wrapper beans package
+ * MUST be a generated jaxws subpackage of the SEI package.
+ * ^^^^^^^^^^^^^^^^
+ * @param requestWrapperClassName
+ * @return
+ */
+ static final String JAXWS_SUBPACKAGE = "jaxws";
+ static String determineActualAritfactPackage(String wrapperClassName) {
+ String returnWrapperClassName = null;
+
+ // Try to load the class that was passed in
+ try {
+ loadClass(wrapperClassName);
+ returnWrapperClassName = wrapperClassName;
+ }
+ catch (ClassNotFoundException e) {
+ // Couldn't load the class; we'll try another one below.
+ }
+
+ // If the original class couldn't be loaded, try adding ".jaxws." to the package
+ if (returnWrapperClassName == null) {
+ String originalPackage = getJavaPackageName(wrapperClassName);
+ if (originalPackage != null) {
+ String alternatePackage = originalPackage + "." + DescriptionUtils.JAXWS_SUBPACKAGE;
+ String className = getSimpleJavaClassName(wrapperClassName);
+ String alternateWrapperClass = alternatePackage + "." + className;
+ try {
+ loadClass(alternateWrapperClass);
+ returnWrapperClassName = alternateWrapperClass;
+ }
+ catch (ClassNotFoundException e) {
+ // Couldn't load the class
+ }
+ }
+ }
+
+ if (returnWrapperClassName == null){
+ // Couldn't load either class, so stick with the original wrapper class name
+ // REVIEW: Is this correct behavior? Note that some of the annotation unit tests don't have the actual
+ // classes available, and so will fail if this is changed.
+ returnWrapperClassName = wrapperClassName;
+ }
+ return returnWrapperClassName;
+ }
+
+
}
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Wed Jan 31 12:35:21 2007
@@ -27,8 +27,10 @@
import javax.wsdl.Binding;
import javax.wsdl.Definition;
import javax.wsdl.Port;
+import javax.wsdl.PortType;
import javax.wsdl.WSDLException;
import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.http.HTTPBinding;
import javax.wsdl.extensions.soap.SOAPAddress;
import javax.wsdl.extensions.soap12.SOAP12Address;
import javax.wsdl.extensions.soap12.SOAP12Binding;
@@ -301,26 +303,8 @@
DescriptionBuilderComposite seic =
getServiceDescriptionImpl().getDBCMap().get(composite.getWebServiceAnnot().endpointInterface());
- //TODO: This functionality is intended to fix the bug that potentially places the
- // wsdlDefinition on the wrong composite. This code should be moved to
- // ServiceDescriptionImpl.setupWsdlDefinition() eventually
- try {
- WSDL4JWrapper wsdl4jWrapper = null;
-
- if (seic.getWsdlDefinition() != null) {
- //set the sdimpl from the SEI composite
- wsdl4jWrapper = new WSDL4JWrapper(seic.getWsdlURL(), seic.getWsdlDefinition());
- getServiceDescriptionImpl().setWsdlWrapper(wsdl4jWrapper);
- } else if (composite.getWsdlDefinition() != null) {
- //set the sdimpl from the impl. class composite
- wsdl4jWrapper = new WSDL4JWrapper(composite.getWsdlURL(), composite.getWsdlDefinition());
- getServiceDescriptionImpl().setWsdlWrapper(wsdl4jWrapper);
- }
- } catch (WSDLException e) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage("wsdlException", e.getMessage()), e);
- }
- //If this is not null, then we don't bother generating wsdl
+ //Only generate WSDL if a definition doesn't already exist
if (seic.getWsdlDefinition() == null)
wsdlComposite = generateWSDL(composite);
}
@@ -465,7 +449,10 @@
try {
// TODO: Using Class.forName() is probably not the best long-term way to get the SEI class from the annotation
seiClass = Class.forName(seiClassName, false, Thread.currentThread().getContextClassLoader());
- } catch (ClassNotFoundException e) {
+ // Catch Throwable as ClassLoader can throw an NoClassDefFoundError that
+ // does not extend Exception, so lets catch everything that extends Throwable
+ // rather than just Exception.
+ } catch (Throwable e) {
// TODO: Throwing wrong exception
e.printStackTrace();
throw new UnsupportedOperationException("Can't create SEI class: " + e);
@@ -627,9 +614,11 @@
isAxisServiceBuiltFromWSDL = false;
if (getServiceDescriptionImpl().getWSDLWrapper() != null) {
isAxisServiceBuiltFromWSDL = buildAxisServiceFromWSDL();
+
}
if (!isAxisServiceBuiltFromWSDL) {
+ //generateWSDL(composite);
buildAxisServiceFromAnnotations();
}
@@ -704,10 +693,24 @@
axisService = serviceBuilder.populateService();
axisService.setName(createAxisServiceName());
isBuiltFromWSDL = true;
+
} catch (AxisFault e) {
- // TODO We should not swallow a fault here.
- log.warn(Messages.getMessage("warnAxisFault", e.toString()));
+ // REVIEW: If we couldn't use the WSDL, should we fail instead of continuing to process using annotations?
+ // Note that if we choose to fail, we need to distinguish the partial WSDL case (which can not fail)
+ // TODO: RAS/NLS Need to update the message with the appropriate inserts
+// log.warn(Messages.getMessage("warnAxisFault", e.toString()), e);
+ String wsdlLocation = (getServiceDescriptionImpl().getWSDLLocation() != null) ? getServiceDescriptionImpl().getWSDLLocation().toString() : null;
+ String implClassName = null;
+ if (getServiceDescriptionImpl().isDBCMap()) {
+ implClassName = composite.getClassName();
+ }
+ else {
+ implClassName = (implOrSEIClass != null) ? implOrSEIClass.getName() : null;
+ }
+ log.warn("The WSDL file could not be used due to an exception. The WSDL will be ignored and annotations will be used. Implementaiton class: "
+ + implClassName + "; WSDL Location: " + wsdlLocation +"; Exception: " + e.toString(), e);
isBuiltFromWSDL = false;
+ return isBuiltFromWSDL;
}
return isBuiltFromWSDL;
}
@@ -1181,7 +1184,7 @@
if (wsdlBinding != null) {
// If a WSDL binding was found, we need to find the proper extensibility
// element and return the namespace. The namespace will be different
- // for SOAP 1.1 vs. SOAP 1.2 bindings.
+ // for SOAP 1.1 vs. SOAP 1.2 bindings and HTTP.
// TODO: What do we do if no extensibility element exists?
List<ExtensibilityElement> elements = wsdlBinding.getExtensibilityElements();
Iterator<ExtensibilityElement> itr = elements.iterator();
@@ -1190,12 +1193,17 @@
if (javax.wsdl.extensions.soap.SOAPBinding.class.isAssignableFrom(e.getClass())) {
javax.wsdl.extensions.soap.SOAPBinding soapBnd = (javax.wsdl.extensions.soap.SOAPBinding) e;
wsdlBindingType = soapBnd.getElementType().getNamespaceURI();
- return wsdlBindingType;
+ break;
}
else if (SOAP12Binding.class.isAssignableFrom(e.getClass())) {
SOAP12Binding soapBnd = (SOAP12Binding) e;
wsdlBindingType = soapBnd.getElementType().getNamespaceURI();
- return wsdlBindingType;
+ break;
+ }
+ else if (HTTPBinding.class.isAssignableFrom(e.getClass())) {
+ HTTPBinding httpBnd = (HTTPBinding) e;
+ wsdlBindingType = httpBnd.getElementType().getNamespaceURI();
+ break;
}
}
}
@@ -1427,14 +1435,19 @@
WsdlComposite wsdlComposite = null;
Definition defn = dbc.getWsdlDefinition();
-
- if (defn == null ) {
+ if (defn == null || !isAxisServiceBuiltFromWSDL) {
//Invoke the callback for generating the wsdl
if (dbc.getCustomWsdlGenerator() != null) {
-
+ String implName = null;
+ if(axisService == null) {
+ implName = DescriptionUtils.javifyClassName(composite.getClassName());
+ }
+ else {
+ implName = (String)axisService.getParameterValue(MDQConstants.SERVICE_CLASS);
+ }
wsdlComposite =
- dbc.getCustomWsdlGenerator().generateWsdl((String)axisService.getParameterValue(MDQConstants.SERVICE_CLASS), getBindingType());
+ dbc.getCustomWsdlGenerator().generateWsdl(implName, getBindingType());
if (wsdlComposite != null) {
wsdlComposite.setWsdlFileName((this.getAnnoWebServiceServiceName() + ".wsdl").toLowerCase());
@@ -1458,6 +1471,7 @@
}
return wsdlComposite;
}
+
}
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Wed Jan 31 12:35:21 2007
@@ -164,17 +164,33 @@
//TODO: Verify that this classname is truly always the wrapper class
mdc.setDeclaringClass(dbc.getClassName());
- OperationDescription operation = new OperationDescriptionImpl(mdc, this);
-
- //TODO: Do we need to worry about a null AxisOperation at this level?
- //Add this AxisOperation to the AxisService
- getEndpointDescription().getAxisService().addOperation(operation.getAxisOperation());
-
- if (log.isDebugEnabled())
- log.debug("EID: Just added operation= " +operation.getOperationName());
- addOperation(operation);
+ // Only add if it is a method that would be or is in the WSDL i.e.
+ // don't create an OperationDescriptor for the MDC representing the
+ // constructor
+ if(DescriptionUtils.createOperationDescription(mdc.getMethodName())) {
+ //First check if this operation already exists on the AxisService, if so
+ //then use that in the description hierarchy
+
+ AxisService axisService = getEndpointDescription().getAxisService();
+ AxisOperation axisOperation = axisService.getOperation(OperationDescriptionImpl.determineOperationQName(mdc));
+
+ OperationDescription operation = new OperationDescriptionImpl(mdc, this, axisOperation);
+
+ if (axisOperation == null) {
+ //This axisOperation does not already exist on the AxisService, so add it now
+
+ // TODO: Do we need to worry about a null AxisOperation at this level?
+ axisService.addOperation(operation.getAxisOperation());
+
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("EID: Just added operation= " +operation.getOperationName());
+ addOperation(operation);
+ }
+
}
if (log.isDebugEnabled())
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java Wed Jan 31 12:35:21 2007
@@ -19,8 +19,10 @@
package org.apache.axis2.jaxws.description.impl;
import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
import java.util.StringTokenizer;
+import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.ws.WebFault;
import org.apache.axis2.jaxws.description.FaultDescription;
@@ -28,6 +30,8 @@
import org.apache.axis2.jaxws.description.FaultDescriptionWSDL;
import org.apache.axis2.jaxws.description.OperationDescription;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
+import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
+import org.apache.axis2.jaxws.util.XMLRootElementUtil;
/**
* @see ../FaultDescription
@@ -83,51 +87,55 @@
return annotation;
}
+
public String getFaultBean() {
if (faultBean.length() > 0) {
+ // Return the faultBean if it was already calculated
return faultBean;
- }
- else if (annotation.faultBean().length() > 0) {
- faultBean = annotation.faultBean();
- }
- else {
- /*
- * we need to figure out a default. The JAXWS spec
- * has no defaults defined, except what can be interpreted
- * from 2.5, 2.8, 2.8.1, and 7.2
- *
- * specifically, section 2.5 says "using the mapping
- * described in section 2.4."
- *
- * I have a better way:
- * The exception class defined by the JAXWS spec has two constructors where the second parameter
- * of each is the faultBean. Let's see if we can figure what the faultBean is from that:
- */
-
- 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();
- }
+ } else {
+ // Load up the WebFault annotation and get the faultBean.
+ // @WebFault may not be present
+ WebFault annotation = getAnnoWebFault();
+
+ if (annotation != null && annotation.faultBean() != null &&
+ annotation.faultBean().length() > 0) {
+ faultBean = annotation.faultBean();
+ } else {
+ // We don't have a faultBean. Try looking at the getFaultInfo method.
+ if (!isDBC()) {
+ try {
+ Method method = exceptionClass.getMethod("getFaultInfo", null);
+ faultBean = method.getReturnType().getCanonicalName();
+ } catch (Exception e) {
+ // This must be a legacy exception
+ }
+ } else {
+ MethodDescriptionComposite mdc =
+ composite.getMethodDescriptionComposite("getFaultInfo", 1);
+ if (mdc != null) {
+ faultBean = mdc.getReturnType();
+ }
+ }
+
+ // Still not found, this must be a non-compliant exception.
+ // Use the JAX-WS chap 3.7 algorithm
+ if (faultBean.length() <= 0) {
+ String simpleName = getSimpleName(getExceptionClassName()) + "Bean";
+ String packageName = null;
+ if (!isDBC()) {
+ Class clazz = getOperationDescription().getSEIMethod().getDeclaringClass();
+ packageName = clazz.getPackage().getName();
+ } else {
+ // Similar algorithm as the OperationDesc RequestWrapper and ResponseWrapper
+ String declaringClazz = ((OperationDescriptionImpl )getOperationDescription()).getMethodDescriptionComposite().getDeclaringClass();
+ packageName = declaringClazz.substring(0, declaringClazz.lastIndexOf("."));
+ }
+ faultBean = packageName + "." + simpleName;
+
+ // The following call adjusts the package name if necessary
+ faultBean = DescriptionUtils.determineActualAritfactPackage(faultBean);
+ }
+ }
}
return faultBean;
}
@@ -135,13 +143,24 @@
public String getName() {
if (name.length() > 0) {
return name;
- }
- else if (annotation.name().length() > 0) {
- name = annotation.name();
- }
- else {
- // need to figure out a default. Let's use the logic in getFaultBean()
- name = getSimpleName(getFaultBean());
+ } else {
+ // Load the annotation. The annotation may not be present in WSGen cases
+ WebFault annotation = this.getAnnoWebFault();
+ if (annotation != null &&
+ annotation.name().length() > 0) {
+ name = annotation.name();
+ } else {
+ // The default is the name on the @XmlRootElement of the FaultBean since this
+ // is what is flowed over the wire.
+ try {
+ Class clazz = DescriptionUtils.loadClass(getFaultBean());
+ XmlRootElement root = (XmlRootElement) clazz.getAnnotation(XmlRootElement.class);
+ name = root.name();
+ } catch (Exception e) {
+ // All else fails use the faultBean name
+ name = getSimpleName(getFaultBean());
+ }
+ }
}
return name;
}
@@ -149,15 +168,23 @@
public String getTargetNamespace() {
if (targetNamespace.length() > 0) {
return targetNamespace;
- }
- else if (annotation.targetNamespace().length() > 0) {
- 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
-
- targetNamespace = makeNamespace(getFaultBean());
+ } else {
+ // Load the annotation. The annotation may not be present in WSGen cases
+ WebFault annotation = this.getAnnoWebFault();
+ if (annotation != null &&
+ annotation.targetNamespace().length() > 0) {
+ targetNamespace = annotation.targetNamespace();
+ } else {
+ // The default is the namespace on the @XmlRootElement of the FaultBean since this
+ // is what is flowed over the wire.
+ try {
+ Class clazz = DescriptionUtils.loadClass(getFaultBean());
+ targetNamespace = XMLRootElementUtil.getXmlRootElementQName(clazz).getNamespaceURI();
+ } catch (Exception e) {
+ // All else fails use the faultBean to calculate a namespace
+ targetNamespace = makeNamespace(getFaultBean());
+ }
+ }
}
return targetNamespace;
}
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Wed Jan 31 12:35:21 2007
@@ -143,6 +143,8 @@
// Default value per JSR-181 MR sec 4.5, pg 24
public static final Boolean WebResult_Header_DEFAULT = new Boolean(false);
private Boolean webResultHeader;
+ private Method serviceImplMethod;
+ private boolean serviceImplMethodFound = false;
OperationDescriptionImpl(Method method, EndpointInterfaceDescription parent) {
// TODO: Look for WebMethod anno; get name and action off of it
@@ -159,81 +161,85 @@
this.operationName = axisOperation.getName();
}
- OperationDescriptionImpl(MethodDescriptionComposite mdc, EndpointInterfaceDescription parent) {
+ OperationDescriptionImpl( MethodDescriptionComposite mdc,
+ EndpointInterfaceDescription parent,
+ AxisOperation axisOperation) {
parentEndpointInterfaceDescription = parent;
methodComposite = mdc;
this.operationName = new QName(getOperationName());
webMethodAnnotation = methodComposite.getWebMethodAnnot();
- AxisOperation axisOperation = null;
-
- try {
- if (isOneWay()) {
- axisOperation = AxisOperationFactory.getOperationDescription(WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY);
- } else {
- axisOperation = AxisOperationFactory.getOperationDescription(WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT);
- }
- //TODO: There are several other MEP's, such as: OUT_ONLY, IN_OPTIONAL_OUT, OUT_IN, OUT_OPTIONAL_IN, ROBUST_OUT_ONLY,
- // ROBUST_IN_ONLY
- // Determine how these MEP's should be handled, if at all
-
- } catch (Exception e) {
- AxisFault ex = new AxisFault("OperationDescriptionImpl:cons - unable to build AxisOperation ");
- }
-
- if (axisOperation != null){
-
- axisOperation.setName(determineOperationQName(this.methodComposite));
- axisOperation.setSoapAction(this.getAction());
-
+ this.axisOperation = axisOperation;
- //TODO: Determine other axisOperation values that may need to be set
- // Currently, the following values are being set on AxisOperation in
- // ServiceBuilder.populateService which we are not setting:
- // AxisOperation.setPolicyInclude()
- // AxisOperation.setWsamappingList()
- // AxisOperation.setOutputAction()
- // AxisOperation.addFaultAction()
- // AxisOperation.setFaultMessages()
-
- // TODO: The WSMToAxisServiceBuilder sets the message receiver, not sure why this is done
- // since AxisService.addOperation does this as well by setting it to a default
- // MessageReceiver...it appears that this code is also setting it to a default
- // receiver..need to understand this
-
- /*
- String messageReceiverClass = "org.apache.axis2.rpc.receivers.RPCMessageReceiver";
- if(wsmOperation.isOneWay()){
- messageReceiverClass = "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver";
- }
- try{
- MessageReceiver msgReceiver = (MessageReceiver)Class.forName(messageReceiverClass).newInstance();
- axisOperation.setMessageReceiver(msgReceiver);
-
- }catch(Exception e){
- }
- */
-
- parameterDescriptions = createParameterDescriptions();
- faultDescriptions = createFaultDescriptions();
-
- //TODO: Need to process the other annotations that can exist, on the server side
- // and at the method level.
- // They are, as follows:
- // WebResultAnnot (181)
- // HandlerChain
- // SoapBinding (181)
- // WebServiceRefAnnot (List) (JAXWS)
- // WebServiceContextAnnot (JAXWS via injection)
- // RequestWrapper (JAXWS)
- // ResponseWrapper (JAXWS)
-
-//System.out.println("OperationDescription: Finished setting operation");
+ //If an AxisOperation was already created for us by populateService then just use that onw
+ //Otherwise, build it up here
+ if (this.axisOperation == null) {
+
+ try {
+ if (isOneWay()) {
+ axisOperation = AxisOperationFactory.getOperationDescription(WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY);
+ } else {
+ axisOperation = AxisOperationFactory.getOperationDescription(WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT);
+ }
+ //TODO: There are several other MEP's, such as: OUT_ONLY, IN_OPTIONAL_OUT, OUT_IN, OUT_OPTIONAL_IN, ROBUST_OUT_ONLY,
+ // ROBUST_IN_ONLY
+ // Determine how these MEP's should be handled, if at all
+
+ } catch (Exception e) {
+ AxisFault ex = new AxisFault("OperationDescriptionImpl:cons - unable to build AxisOperation ");
+ }
+ if (axisOperation != null){
+
+ axisOperation.setName(determineOperationQName(this.methodComposite));
+ axisOperation.setSoapAction(this.getAction());
+
+
+ //TODO: Determine other axisOperation values that may need to be set
+ // Currently, the following values are being set on AxisOperation in
+ // ServiceBuilder.populateService which we are not setting:
+ // AxisOperation.setPolicyInclude()
+ // AxisOperation.setWsamappingList()
+ // AxisOperation.setOutputAction()
+ // AxisOperation.addFaultAction()
+ // AxisOperation.setFaultMessages()
+
+ // TODO: The WSMToAxisServiceBuilder sets the message receiver, not sure why this is done
+ // since AxisService.addOperation does this as well by setting it to a default
+ // MessageReceiver...it appears that this code is also setting it to a default
+ // receiver..need to understand this
+
+ /*
+ String messageReceiverClass = "org.apache.axis2.rpc.receivers.RPCMessageReceiver";
+ if(wsmOperation.isOneWay()){
+ messageReceiverClass = "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver";
+ }
+ try{
+ MessageReceiver msgReceiver = (MessageReceiver)Class.forName(messageReceiverClass).newInstance();
+ axisOperation.setMessageReceiver(msgReceiver);
+
+ }catch(Exception e){
+ }
+ */
+
+ //TODO: Need to process the other annotations that can exist, on the server side
+ // and at the method level.
+ // They are, as follows:
+ // WebResultAnnot (181)
+ // HandlerChain
+ // SoapBinding (181)
+ // WebServiceRefAnnot (List) (JAXWS)
+ // WebServiceContextAnnot (JAXWS via injection)
+ // RequestWrapper (JAXWS)
+ // ResponseWrapper (JAXWS)
+ }
+
+ this.axisOperation = axisOperation;
}
- this.axisOperation = axisOperation;
+ parameterDescriptions = createParameterDescriptions();
+ faultDescriptions = createFaultDescriptions();
}
void setSEIMethod(Method method) {
@@ -367,11 +373,15 @@
Class[] webFaultClasses = seiMethod.getExceptionTypes();
for(Class wfClass:webFaultClasses) {
+ // according to JAXWS 3.7, the @WebFault annotation is only used for customizations,
+ // so we'll add all declared exceptions
+ WebFault wfanno = null;
for (Annotation anno:wfClass.getAnnotations()) {
if (anno.annotationType() == WebFault.class) {
- buildFaultList.add(new FaultDescriptionImpl(wfClass, (WebFault)anno, this));
+ wfanno = (WebFault)anno;
}
}
+ buildFaultList.add(new FaultDescriptionImpl(wfClass, wfanno, this));
}
} else {
// TODO do I care about methodComposite like the paramDescription does?
@@ -380,9 +390,7 @@
// 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
+ //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();
@@ -398,13 +406,11 @@
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));
- }
- }
+ // JAXWS 3.7 does not require @WebFault annotation
+ // We found a valid exception composite thats annotated
+ buildFaultList.add(new FaultDescriptionImpl(faultDBC, this));
+ }
+
}
}
}
@@ -425,7 +431,7 @@
//TODO: For now, we are overriding the above method only because it is static, these should
//be combined at some point
- static QName determineOperationQName(MethodDescriptionComposite mdc) {
+ public static QName determineOperationQName(MethodDescriptionComposite mdc) {
return new QName(determineOperationName(mdc));
}
@@ -607,14 +613,17 @@
// says the entire annotation "...MAY be omitted if all its properties would have default vaules."
// implying there IS some sort of default. We'll try this for now:
if (isDBC()) {
- requestWrapperClassName = this.methodComposite.getDeclaringClass();
+ String declaringClazz = this.methodComposite.getDeclaringClass();
+ String packageName = declaringClazz.substring(0, declaringClazz.lastIndexOf("."));
+ requestWrapperClassName = packageName + "." + DescriptionUtils.javaMethodtoClassName(methodComposite.getMethodName());
+
} else {
Class clazz = seiMethod.getDeclaringClass();
String packageName = clazz.getPackage().getName();
String className = DescriptionUtils.javaMethodtoClassName(seiMethod.getName());
requestWrapperClassName = packageName + "." + className;
}
- requestWrapperClassName = determineActualAritfactPackage(requestWrapperClassName);
+ requestWrapperClassName = DescriptionUtils.determineActualAritfactPackage(requestWrapperClassName);
}
}
return requestWrapperClassName;
@@ -715,9 +724,13 @@
String className = DescriptionUtils.javaMethodtoClassName(seiMethod.getName());
responseWrapperClassName = packageName + "." + className + "Response";
} else {
- responseWrapperClassName = methodComposite.getDeclaringClass() + "Response";
+ //JAXWS Spec is not clear on what default should be added. We think its the endpoint impls package + OperationName + Response.
+ //In situation where wsGen uses sei's package to store jaxb bean.
+ String declaringClazz = methodComposite.getDeclaringClass();
+ String packageName = declaringClazz.substring(0, declaringClazz.lastIndexOf("."));
+ responseWrapperClassName = packageName + "." + DescriptionUtils.javaMethodtoClassName(methodComposite.getMethodName()) + "Response";
}
- responseWrapperClassName = determineActualAritfactPackage(responseWrapperClassName);
+ responseWrapperClassName = DescriptionUtils.determineActualAritfactPackage(responseWrapperClassName);
}
}
return responseWrapperClassName;
@@ -747,17 +760,21 @@
}
public FaultDescription resolveFaultByFaultBeanName(String faultBeanName) {
- for(FaultDescription fd: faultDescriptions) {
- if (faultBeanName.equals(fd.getFaultBean()))
- return fd;
+ if (faultDescriptions != null) {
+ for(FaultDescription fd: faultDescriptions) {
+ if (faultBeanName.equals(fd.getFaultBean()))
+ return fd;
+ }
}
return null;
}
public FaultDescription resolveFaultByExceptionName(String exceptionClassName) {
- for(FaultDescription fd: faultDescriptions) {
- if (exceptionClassName.equals(fd.getExceptionClassName()))
- return fd;
+ if (faultDescriptions != null) {
+ for(FaultDescription fd: faultDescriptions) {
+ if (exceptionClassName.equals(fd.getExceptionClassName()))
+ return fd;
+ }
}
return null;
}
@@ -1091,59 +1108,6 @@
return false;
}
- /**
- * Determine the actual packager name for the generated artifacts by trying to load the class from one of two
- * packages. This is necessary because the RI implementations of WSGen and WSImport generate the artifacts
- * in different packages:
- * - WSImport generates the artifacts in the same package as the SEI
- * - WSGen generates the artifacts in a "jaxws" sub package under the SEI package.
- * Note that from reading the JAX-WS spec, it seems that WSGen is doing that correctly; See
- * the conformance requirement in JAX-WS 2.0 Spec Section 3.6.2.1 Document Wrapped on page 36:
- * Conformance (Default wrapper bean package): In the absence of customizations, the wrapper beans package
- * MUST be a generated jaxws subpackage of the SEI package.
- * ^^^^^^^^^^^^^^^^
- * @param requestWrapperClassName
- * @return
- */
- private static final String JAXWS_SUBPACKAGE = "jaxws";
- private static String determineActualAritfactPackage(String wrapperClassName) {
- String returnWrapperClassName = null;
-
- // Try to load the class that was passed in
- try {
- DescriptionUtils.loadClass(wrapperClassName);
- returnWrapperClassName = wrapperClassName;
- }
- catch (ClassNotFoundException e) {
- // Couldn't load the class; we'll try another one below.
- }
-
- // If the original class couldn't be loaded, try adding ".jaxws." to the package
- if (returnWrapperClassName == null) {
- String originalPackage = DescriptionUtils.getJavaPackageName(wrapperClassName);
- if (originalPackage != null) {
- String alternatePackage = originalPackage + "." + JAXWS_SUBPACKAGE;
- String className = DescriptionUtils.getSimpleJavaClassName(wrapperClassName);
- String alternateWrapperClass = alternatePackage + "." + className;
- try {
- DescriptionUtils.loadClass(alternateWrapperClass);
- returnWrapperClassName = alternateWrapperClass;
- }
- catch (ClassNotFoundException e) {
- // Couldn't load the class
- }
- }
- }
-
- if (returnWrapperClassName == null){
- // Couldn't load either class, so stick with the original wrapper class name
- // REVIEW: Is this correct behavior? Note that some of the annotation unit tests don't have the actual
- // classes available, and so will fail if this is changed.
- returnWrapperClassName = wrapperClassName;
- }
- return returnWrapperClassName;
- }
-
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.description.OperationDescription#getResultType()
*/
@@ -1270,7 +1234,6 @@
}
public Method getMethodFromServiceImpl(Class serviceImpl) {
- Method serviceImplMethod = null;
// TODO: This doesn't support overloaded methods in the service impl This is
// DIFFERENT than overloaded WSDL operations (which aren't supported). We
@@ -1287,29 +1250,69 @@
// There will be two OpDescs, Foo1 and Foo2; the incoming wsdl operation will correctly identify
// which OpDesc. However, to return the correct service impl method, we need to compare the
// signatures, not just the method names.
-
- Method[] methods = serviceImpl.getMethods();
- String opDescMethodName = getJavaMethodName();
- ParameterDescription[] paramDesc = getParameterDescriptions();
- // TODO: As noted above, a full signature is necessary, not just number of params
- int numberOfParams = 0;
- if (paramDesc != null) {
- numberOfParams = paramDesc.length;
- }
-
- // Loop through all the methods on the service impl and find the method that maps
- // to this OperationDescripton
- for (Method checkMethod : methods) {
- if (checkMethod.getName().equals(opDescMethodName)) {
- Class[] methodParams = checkMethod.getParameterTypes();
- // TODO: As noted above, a full signature is necessary, not just number of params
- if (methodParams.length == numberOfParams) {
- serviceImplMethod = checkMethod;
- break;
+ if(!serviceImplMethodFound) {
+ Method[] methods = serviceImpl.getMethods();
+ String opDescMethodName = getJavaMethodName();
+ ParameterDescription[] paramDesc = getParameterDescriptions();
+ // TODO: As noted above, a full signature is necessary, not just number of params
+ int numberOfParams = 0;
+ if (paramDesc != null) {
+ numberOfParams = paramDesc.length;
+ }
+
+ // Loop through all the methods on the service impl and find the method that maps
+ // to this OperationDescripton
+ for (Method checkMethod : methods) {
+ if (checkMethod.getName().equals(opDescMethodName)) {
+ Class[] methodParams = checkMethod.getParameterTypes();
+ // TODO: As noted above, a full signature is necessary, not just number of params
+ if (methodParams.length == numberOfParams) {
+ if (paramTypesMatch(paramDesc, methodParams)) {
+ serviceImplMethod = checkMethod;
+ break;
+ }
+ }
}
}
+ serviceImplMethodFound = true;
}
-
return serviceImplMethod;
}
+
+ /**
+ * This method will compare the types of the parameters in a
+ * <code>ParameterDescription</code> vs. the type of the arguments in
+ * the parameters of a <code>Method</code>.
+ * @param paramDescs - <code>ParameterDescription</code>[]
+ * @param methodParams - <code>Class</code>[]
+ * @return - <code>boolean</code>
+ */
+ private boolean paramTypesMatch(ParameterDescription[] paramDescs, Class[]
+ methodParams) {
+ for(int i=0; i < paramDescs.length; i++) {
+ String mParamType = methodParams[i].getName();
+ String pdType = getPDType(paramDescs[i]);
+ if(mParamType == null || !mParamType.equals(pdType)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * This will get a <code>String</code> representing the parameter class of a
+ * <code>ParameterDescription</code>.
+ * @param pd - <code>ParameterDescrition</code>
+ * @return - <code>String</code>
+ */
+ private String getPDType(ParameterDescription pd) {
+ String type = null;
+ if(pd.getParameterType() != null) {
+ type = pd.getParameterType().getName();
+ }
+ else if(pd.getParameterActualType() != null) {
+ type = pd.getParameterActualType().getName();
+ }
+ return type;
+ }
}
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/PackageSetBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/PackageSetBuilder.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/PackageSetBuilder.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/PackageSetBuilder.java Wed Jan 31 12:35:21 2007
@@ -202,10 +202,16 @@
// Also consider the request and response wrappers
String pkg = getPackageFromClassName(opDesc.getRequestWrapperClassName());
+ if(log.isDebugEnabled()){
+ log.debug("Package from Request Wrapper annotation = "+ pkg);
+ }
if (pkg != null) {
set.add(pkg);
}
pkg = getPackageFromClassName(opDesc.getResponseWrapperClassName());
+ if(log.isDebugEnabled()){
+ log.debug("Package from Response Wrapper annotation = "+ pkg);
+ }
if (pkg != null) {
set.add(pkg);
}
@@ -214,6 +220,9 @@
Class cls = opDesc.getResultActualType();
if (cls != null && cls != void.class && cls != Void.class) {
Package returnTypePkg = cls.getPackage();
+ if(log.isDebugEnabled()){
+ log.debug("Package from Return Type = "+ pkg);
+ }
if (returnTypePkg != null) {
pkg = returnTypePkg.getName();
set.add(pkg);
@@ -368,8 +377,10 @@
// TODO J2W AccessController Needed
// Don't make this public, its a security exposure
return Class.forName(className, true, Thread.currentThread().getContextClassLoader());
-
- } catch (ClassNotFoundException e) {
+ //Catch Throwable as ClassLoader can throw an NoClassDefFoundError that
+ //does not extend Exception, so lets catch everything that extends Throwable
+ //rather than just Exception.
+ } catch (Throwable e) {
// TODO Should the exception be swallowed ?
if (log.isDebugEnabled()) {
log.debug("PackageSetBuilder cannot load the following class:" + className);
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Wed Jan 31 12:35:21 2007
@@ -16,7 +16,10 @@
*/
package org.apache.axis2.jaxws.description.impl;
+import java.io.FileNotFoundException;
+import java.net.ConnectException;
import java.net.URL;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
@@ -46,6 +49,7 @@
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.builder.MDQConstants;
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
+import org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite;
import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.util.WSDL4JWrapper;
import org.apache.axis2.jaxws.util.WSDLWrapper;
@@ -406,27 +410,66 @@
if (isDBCMap()) {
- //TODO: Currently, there is a bug which allows the wsdlDefinition to be placed
+ // Currently, there is a bug which allows the wsdlDefinition to be placed
// on either the impl class composite or the sei composite, or both. We need to
- // look in both places and find the correct one, if it exists. There is a patch
- // in EndpointDescriptionImpl constructor which will reset the wsdlWrapper, if necessary. But
- // that functionality should be moved here at some point.
- if (composite.getWsdlDefinition() != null) {
- this.wsdlURL = composite.getWsdlURL();
-
- try {
- this.wsdlWrapper = new WSDL4JWrapper(this.wsdlURL,
- composite.getWsdlDefinition());
+ // look in both places and find the correct one, if it exists.
- } catch (WSDLException e) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage("wsdlException", e.getMessage()), e);
- }
- }
+ if (((composite.getWebServiceAnnot() != null) &&
+ DescriptionUtils.isEmpty(composite.getWebServiceAnnot().endpointInterface()))
+ ||
+ (!(composite.getWebServiceProviderAnnot() == null))) {
+ //This is either an implicit SEI, or a WebService Provider
+ if (composite.getWsdlDefinition() != null) {
+ this.wsdlURL = composite.getWsdlURL();
+
+ try {
+ this.wsdlWrapper = new WSDL4JWrapper(this.wsdlURL,
+ composite.getWsdlDefinition());
+ } catch (WSDLException e) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("wsdlException", e.getMessage()), e);
+ }
+ }
+
+ } else if (composite.getWebServiceAnnot() != null) {
+ //This impl class specifies an SEI...this is a special case. There is a bug
+ //in the tooling that allows for the wsdllocation to be specifed on either the
+ //impl. class, or the SEI, or both. So, we need to look for the wsdl as follows:
+ // 1. If the Wsdl exists on the SEI, then check for it on the impl.
+ // 2. If it is not found in either location, in that order, then generate
+
+ DescriptionBuilderComposite seic =
+ getDBCMap().get(composite.getWebServiceAnnot().endpointInterface());
+
+ try {
+ if (seic.getWsdlDefinition() != null) {
+ //set the sdimpl from the SEI composite
+ this.wsdlURL = seic.getWsdlURL();
+ this.wsdlWrapper = new WSDL4JWrapper(seic.getWsdlURL(), seic.getWsdlDefinition());
+ } else if (composite.getWsdlDefinition() != null) {
+ //set the sdimpl from the impl. class composite
+ this.wsdlURL = composite.getWsdlURL();
+ this.wsdlWrapper = new WSDL4JWrapper(composite.getWsdlURL(), composite.getWsdlDefinition());
+ }
+ } catch (WSDLException e) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("wsdlException", e.getMessage()), e);
+ }
+ }
+
//Deprecate this code block when MDQ is fully integrated
} else if (wsdlURL != null) {
try {
this.wsdlWrapper = new WSDL4JWrapper(this.wsdlURL);
- } catch (WSDLException e) {
+ }
+ catch(FileNotFoundException e) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("wsdlNotFoundErr", e.getMessage()), e);
+ }
+ catch(UnknownHostException e) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("unknownHost", e.getMessage()), e);
+ }
+ catch(ConnectException e) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("connectionRefused", e.getMessage()), e);
+ }
+ catch (WSDLException e) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("wsdlException", e.getMessage()), e);
}
}
@@ -507,7 +550,7 @@
this.wsdlWrapper = wrapper;
}
- private void validateDBCLIntegrity(){
+ private void validateDBCLIntegrity() {
//First, check the integrity of this input composite
//and retrieve
@@ -524,8 +567,11 @@
validateIntegrity();
}
catch (Exception ex) {
- //com.ibm.ws.ffdc.FFDCFilter.processException(ex, "org.apache.axis2.jaxws.description.ServiceDescription", "329", this);
- //Tr.error(_tc, msg, inserts);
+ if (log.isDebugEnabled()) {
+ log.debug("Validation phase 1 failure: " + ex.toString(), ex);
+ log.debug("Failing composite: " + composite.toString());
+ }
+ throw ExceptionFactory.makeWebServiceException("Validation Exception " + ex, ex);
}
}
@@ -549,18 +595,20 @@
Iterator<String> iter =
composite.getInterfacesList().iterator();
+ // Remember if we've validated the Provider interface. Later we'll make sure that if we have an
+ // WebServiceProvider annotation, we found a valid interface here.
+ boolean providerInterfaceValid = false;
while (iter.hasNext()) {
String interfaceString = iter.next();
- // REVIEW: These string compares may not be sufficient; they assume, for example Provider<SOAPMessage>. What about endpoint impls that:
- // (1) ... implement Provider<javax.xml.soap.SOAPMessage>
- // (2) import wrong.package.SOAPMessage;
- // ... implement Provider<SOAPMessage>;
if (interfaceString.equals(MDQConstants.PROVIDER_SOURCE)
|| interfaceString.equals(MDQConstants.PROVIDER_SOAP)
- || interfaceString.equals(MDQConstants.PROVIDER_DATASOURCE)) {
- //This is a provider based SEI, make sure the annotation exists
+ || interfaceString.equals(MDQConstants.PROVIDER_DATASOURCE)
+ || interfaceString.equals(MDQConstants.PROVIDER_STRING)) {
+ providerInterfaceValid = true;
+ //This is a provider based endpoint, make sure the annotation exists
if (composite.getWebServiceProviderAnnot() == null) {
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: This is a Provider based SEI that does not contain a WebServiceProvider annotation");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: This is a Provider based endpoint that does not contain a WebServiceProvider annotation. Provider class: " + composite.getClassName());
}
}
}
@@ -570,17 +618,30 @@
//Verify that WebService and WebServiceProvider are not both specified
//per JAXWS - Sec. 7.7
if (composite.getWebServiceAnnot() != null && composite.getWebServiceProviderAnnot() != null) {
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: WebService annotation and WebServiceProvider annotation cannot coexist");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: WebService annotation and WebServiceProvider annotation cannot coexist. Implementation class: " + composite.getClassName());
}
-// Make sure that we're only validating against WSDL, if there is WSDL...duh
if (composite.getWebServiceProviderAnnot() != null ) {
- // TODO: Verify that this Provider based WebService has a method named invoke
-
+ if (!providerInterfaceValid) {
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: This is a Provider that does not specify a valid Provider interface. Implementation class: " + composite.getClassName());
+ }
+ // There must be a public default constructor per JAXWS - Sec 5.1
+ if (!validateDefaultConstructor()) {
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: Provider must have a public default constructor. Implementation class: " + composite.getClassName());
+ }
+ // There must be an invoke method per JAXWS - Sec 5.1.1
+ if (!validateInvokeMethod()) {
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: Provider must have a public invoke method. Implementation class: " + composite.getClassName());
+ }
} else if (composite.getWebServiceAnnot() != null) {
if ( composite.getServiceModeAnnot() != null) {
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: ServiceMode annotation can only be specified for WebServiceProvider");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: ServiceMode annotation can only be specified for WebServiceProvider. Implementation class: " + composite.getClassName());
}
//TODO: hmmm, will we ever actually validate an interface directly...don't think so
@@ -591,7 +652,9 @@
// TODO: Validate on the class that a finalize() method does not exist
if (!DescriptionUtils.isEmpty(composite.getWebServiceAnnot().wsdlLocation())) {
if (composite.getWsdlDefinition() == null && composite.getWsdlURL() == null) {
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: cannot find WSDL Definition pertaining to this WebService annotation");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: cannot find WSDL Definition specified by this WebService annotation. Implementation class: "
+ + composite.getClassName() + "; WSDL location: " + composite.getWebServiceAnnot().wsdlLocation());
}
}
@@ -603,7 +666,9 @@
//Verify that we can find the SEI in the composite list
if (seic == null){
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: cannot find SEI composite specified by the endpoint interface");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: cannot find SEI specified by the WebService.endpointInterface. Implementaiton class: "
+ + composite.getClassName() + "; EndpointInterface: " + composite.getWebServiceAnnot().endpointInterface());
}
// Verify that the only class annotations are WebService and HandlerChain
@@ -615,26 +680,30 @@
|| composite.getWebServiceContextAnnot()!= null
|| !composite.getAllWebServiceRefAnnots().isEmpty()
) {
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: invalid annotations specified when WebService annotation specifies an endpoint interface");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: invalid annotations specified when WebService annotation specifies an endpoint interface. Implemntation class: "
+ + composite.getClassName());
}
//Verify that WebService annotation does not contain a name attribute
//(per JSR181 Sec. 3.1)
if (composite.getWebServiceAnnot().name() != null) {
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: invalid annotations specified when WebService annotation specifies an endpoint interface");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: WebService.name must not be specified when the bean specifies an endpoint interface. Implentation class: "
+ + composite.getClassName() + "; WebService.name: " + composite.getWebServiceAnnot().name());
}
+ validateSEI(seic);
//Verify that that this implementation class implements all methods in the interface
validateImplementation(seic);
//Verify that this impl. class does not contain any @WebMethod annotations
if (webMethodAnnotationsExist()) {
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: WebMethod annotations cannot exist on class when WebService.endpointInterface is set");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: WebMethod annotations cannot exist on implentation when WebService.endpointInterface is set. Implementation class: " +
+ composite.getClassName());
}
- //TODO: validateSEI() ...this should really be done here. No sense in validating
- // an interface just because its in the list
- validateSEI(seic);
} else { //this is an implicit SEI (i.e. impl w/out endpointInterface
@@ -644,7 +713,9 @@
//
}
} else { //this is an interface...we should not be processing interfaces here
- throw ExceptionFactory.makeWebServiceException("ValidateIntegrity: Improper usage: cannot invoke this method with an interface");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: Improper usage: cannot invoke this method with an interface. Implementation class: "
+ + composite.getClassName());
}
//TODO: don't think this is necessary
@@ -652,7 +723,41 @@
}
}
- private void validateImplementation(DescriptionBuilderComposite seic) {
+ /**
+ * Validate there is an invoke method on the composite.
+ * @return
+ */
+ private boolean validateInvokeMethod() {
+ boolean validInvokeMethod = false;
+ List<MethodDescriptionComposite> invokeMethodList = composite.getMethodDescriptionComposite("invoke");
+ if (invokeMethodList != null && !invokeMethodList.isEmpty()) {
+ validInvokeMethod = true;
+ }
+ return validInvokeMethod;
+ }
+
+ /**
+ * Validate there is a default no-argument constructor on the composite.
+ * @return
+ */
+ private boolean validateDefaultConstructor() {
+ boolean validDefaultCtor = false;
+ List<MethodDescriptionComposite> constructorList = composite.getMethodDescriptionComposite("<init>");
+ if (constructorList != null && !constructorList.isEmpty()) {
+ // There are public constructors; make sure there is one that takes no arguments.
+ for (MethodDescriptionComposite checkCtor : constructorList) {
+ List<ParameterDescriptionComposite> paramList = checkCtor.getParameterDescriptionCompositeList();
+ if (paramList == null || paramList.isEmpty()) {
+ validDefaultCtor = true;
+ break;
+ }
+ }
+ }
+
+ return validDefaultCtor;
+ }
+
+ private void validateImplementation(DescriptionBuilderComposite seic) {
/*
* Verify that an impl class implements all the methods of the SEI. We
* have to verify this because an impl class is not required to actually use
@@ -663,26 +768,56 @@
*/
HashMap compositeHashMap = new HashMap();
- Iterator<MethodDescriptionComposite> compIterator =
- composite.getMethodDescriptionsList().iterator();
-
+ Iterator<MethodDescriptionComposite> compIterator = composite.getMethodDescriptionsList().iterator();
while (compIterator.hasNext()) {
MethodDescriptionComposite mdc = compIterator.next();
compositeHashMap.put(mdc.getMethodName(),mdc);
}
+ // Add methods declared in the implementation's superclass
+ addSuperClassMethods(compositeHashMap, composite);
- Iterator<MethodDescriptionComposite> seiIterator =
- seic.getMethodDescriptionsList().iterator();
-
- while (seiIterator.hasNext()) {
- MethodDescriptionComposite mdc = seiIterator.next();
-
+ HashMap seiMethodHashMap = new HashMap();
+ Iterator<MethodDescriptionComposite> seiMethodIterator = seic.getMethodDescriptionsList().iterator();
+ while (seiMethodIterator.hasNext()) {
+ MethodDescriptionComposite mdc = seiMethodIterator.next();
+ seiMethodHashMap.put(mdc.getMethodName(),mdc);
+ }
+ // Add any methods declared in superinterfaces of the SEI
+ addSuperClassMethods(seiMethodHashMap, seic);
+
+ // Make sure all the methods in the SEI (including any inherited from superinterfaces) are
+ // implemented by the bean (including inherited methods on the bean).
+ Iterator<MethodDescriptionComposite> verifySEIIterator = seiMethodHashMap.values().iterator();
+ while (verifySEIIterator.hasNext()) {
+ MethodDescriptionComposite mdc = verifySEIIterator.next();
+ // REVIEW: Only the names are checked; this isn't checking signatures
if (compositeHashMap.get(mdc.getMethodName()) == null) {
- throw ExceptionFactory.makeWebServiceException("ServiceDescription: subclass does not implement method on specified interface");
+ // TODO: RAS/NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: Implementation subclass does not implement method on specified interface. Implementation class: "
+ + composite.getClassName() + "; missing method name: " + mdc.getMethodName() + "; endpointInterface: " + seic.getClassName());
}
}
-
}
+ /**
+ * Adds any methods declared in superclasses to the HashMap. The hierachy starting with the DBC will be walked
+ * up recursively, adding methods from each parent DBC encountered.
+ *
+ * Note that this can be used for either classes or interfaces.
+ * @param methodMap
+ * @param dbc
+ */
+ private void addSuperClassMethods(HashMap methodMap, DescriptionBuilderComposite dbc) {
+ DescriptionBuilderComposite superDBC = dbcMap.get(dbc.getSuperClassName());
+ if(superDBC != null) {
+ Iterator<MethodDescriptionComposite> mIter = superDBC.getMethodDescriptionsList().iterator();
+ while(mIter.hasNext()) {
+ MethodDescriptionComposite mdc = mIter.next();
+ methodMap.put(mdc.getMethodName(), mdc);
+ }
+ addSuperClassMethods(methodMap, superDBC);
+ }
+ }
+
/*
* This method verifies that, if there are any WebMethod with exclude == false, then
@@ -733,9 +868,16 @@
//TODO: Validate SEI superclasses -- hmmm, may be doing this below
//
-
+ if (seic.getWebServiceAnnot() == null) {
+ // TODO: RAS & NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: SEI does not contain a WebService annotation. Implementation class: "
+ + composite.getClassName() + "; SEI: " + seic.getClassName());
+ }
if (!seic.getWebServiceAnnot().endpointInterface().equals("")) {
- throw ExceptionFactory.makeWebServiceException("DescriptionBuilderComposite: WebService annotation contains a non-empty field for the SEI");
+ // TODO: RAS & NLS
+ throw ExceptionFactory.makeWebServiceException("Validation error: SEI must not set a value for @WebService.endpointInterface. Implementation class: "
+ + composite.getClassName() + "; SEI: " + seic.getClassName()
+ + "; Invalid endpointInterface value: " + seic.getWebServiceAnnot().endpointInterface());
}
checkSEIAgainstWSDL();
@@ -907,4 +1049,5 @@
}
return portsUsingAddress;
}
+
}
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java Wed Jan 31 12:35:21 2007
@@ -20,6 +20,8 @@
import javax.wsdl.Port;
import javax.wsdl.Service;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
@@ -63,14 +65,60 @@
private boolean validateWSDLBindingType() {
// TODO: The getWSDLBindingType is not getting the correct value; it needs to return the
// <soap:binding transport> value
- if (true) return VALID;
+ boolean isBindingValid = false;
String bindingType = endpointDesc.getBindingType();
String wsdlBindingType = endpointDescWSDL.getWSDLBindingType();
- if (wsdlBindingType != null && !wsdlBindingType.equals(bindingType)) {
- addValidationFailure(this, "Binding type is invald");
- return INVALID;
+ if (bindingType == null) {
+ // I don't think this can happen; the Description layer should provide a default
+ addValidationFailure(this, "Annotation binding type is null and did not have a default");
+ isBindingValid = false;
}
- return VALID;
+ // Validate that the annotation value specified is valid.
+ else if (!SOAPBinding.SOAP11HTTP_BINDING.equals(bindingType) &&
+ !SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingType) &&
+ !SOAPBinding.SOAP12HTTP_BINDING.equals(bindingType) &&
+ !SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingType) &&
+ !HTTPBinding.HTTP_BINDING.equals(bindingType)) {
+ addValidationFailure(this, "Invalid annotation binding value specified: " + bindingType);
+ isBindingValid = false;
+ }
+ // If there's no WSDL, then there will be no WSDL Binding Type to validate against
+ else if (wsdlBindingType == null) {
+ isBindingValid = true;
+ }
+ // Validate that the WSDL value is valid
+ else if (!EndpointDescriptionWSDL.SOAP11_WSDL_BINDING.equals(wsdlBindingType) &&
+ !EndpointDescriptionWSDL.SOAP12_WSDL_BINDING.equals(wsdlBindingType) &&
+ !EndpointDescriptionWSDL.HTTP_WSDL_BINDING.equals(wsdlBindingType)) {
+ addValidationFailure(this, "Invalid wsdl binding value specified: " + wsdlBindingType);
+ isBindingValid = false;
+ }
+ // Validate that the WSDL and annotations values indicate the same type of binding
+ else if (wsdlBindingType.equals(EndpointDescriptionWSDL.SOAP11_WSDL_BINDING)
+ && (bindingType.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
+ bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING))) {
+ isBindingValid = true;
+ }
+ else if (wsdlBindingType.equals(EndpointDescriptionWSDL.SOAP12_WSDL_BINDING)
+ && (bindingType.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
+ bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))) {
+ isBindingValid = true;
+ }
+ else if (wsdlBindingType.equals(EndpointDescriptionWSDL.HTTP_WSDL_BINDING) &&
+ bindingType.equals(HTTPBinding.HTTP_BINDING)) {
+ isBindingValid = true;
+ }
+ // The HTTP binding is not valid on a Java Bean SEI-based endpoint; only on a Provider based one.
+ else if (wsdlBindingType.equals(EndpointDescriptionWSDL.HTTP_WSDL_BINDING) &&
+ endpointDesc.isEndpointBased()) {
+ addValidationFailure(this, "The HTTPBinding can not be specified for SEI-based endpoints");
+ isBindingValid = false;
+ }
+ else {
+ addValidationFailure(this, "Invalid binding; wsdl = " + wsdlBindingType + ", annotation = " + bindingType);
+ isBindingValid = false;
+ }
+ return isBindingValid;
}
private boolean validateWSDLPort() {
@@ -81,7 +129,8 @@
if (wsdlService != null) {
Port wsdlPort = endpointDescWSDL.getWSDLPort();
if (wsdlPort == null) {
- addValidationFailure(this, "Serivce exists in WSDL, but Port does not. Not a valid Partial WSDL");
+ addValidationFailure(this, "Serivce exists in WSDL, but Port does not. Not a valid Partial WSDL. Service: "
+ + endpointDesc.getServiceQName() + "; Port: " + endpointDesc.getPortQName());
return INVALID;
}
}
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointInterfaceDescriptionValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointInterfaceDescriptionValidator.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointInterfaceDescriptionValidator.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointInterfaceDescriptionValidator.java Wed Jan 31 12:35:21 2007
@@ -18,8 +18,11 @@
*/
package org.apache.axis2.jaxws.description.validator;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import javax.wsdl.Operation;
import javax.wsdl.PortType;
import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
@@ -64,13 +67,54 @@
// TODO: Need more validation here, including: operation name, parameters, faults
List wsdlOperationList = portType.getOperations();
OperationDescription[] opDescArray = epInterfaceDesc.getOperations();
+
if (wsdlOperationList.size() != opDescArray.length) {
- addValidationFailure(this, "Operations did not match WSDL");
+ addValidationFailure(this, "The number of operations in the WSDL " +
+ "portType does not match the number of methods in the SEI or " +
+ "Web service implementation class.");
+ return INVALID;
+ }
+
+ // If they are the same size, let's check to see if the operation names match
+
+ if(!checkOperationsMatchMethods(wsdlOperationList, opDescArray)) {
+ addValidationFailure(this, "The operation names in the WSDL portType " +
+ "do not match the method names in the SEI or Web service i" +
+ "mplementation class.");
return INVALID;
}
}
return VALID;
}
+
+ private boolean checkOperationsMatchMethods(List wsdlOperationList, OperationDescription[]
+ opDescArray) {
+ List<String> opNameList = createWSDLOperationNameList(wsdlOperationList);
+ for(int i=0; i < opDescArray.length; i++) {
+ OperationDescription opDesc = opDescArray[i];
+ if(opNameList.contains(opDesc.getOperationName())) {
+ opNameList.remove(opDesc.getOperationName());
+ }
+ else {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private List<String> createWSDLOperationNameList(List wsdlOperationList) {
+ List<String> opNameList = new ArrayList<String>();
+ Iterator wsdlOpIter = wsdlOperationList.iterator();
+ while(wsdlOpIter.hasNext()) {
+ Object obj = wsdlOpIter.next();
+ if(obj instanceof Operation) {
+ Operation operation = (Operation) obj;
+ opNameList.add(operation.getName());
+ }
+ }
+ return opNameList;
+ }
+
private boolean validateSEIvsImplementation() {
// REVIEW: This level of validation is currently being done by the DBC Composite validation
return VALID;
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ServiceDescriptionValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ServiceDescriptionValidator.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ServiceDescriptionValidator.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ServiceDescriptionValidator.java Wed Jan 31 12:35:21 2007
@@ -18,6 +18,9 @@
*/
package org.apache.axis2.jaxws.description.validator;
+import java.util.Iterator;
+import java.util.List;
+
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.description.ServiceDescriptionJava;
@@ -73,4 +76,5 @@
}
return areAllValid;
}
+
}
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ValidationFailures.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ValidationFailures.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ValidationFailures.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ValidationFailures.java Wed Jan 31 12:35:21 2007
@@ -19,6 +19,8 @@
package org.apache.axis2.jaxws.description.validator;
import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
/**
@@ -31,6 +33,11 @@
public void add(Validator failingValidator, String message) {
validationFailures.add(new ValidationFailure(failingValidator, message));
}
+
+ public List<ValidationFailure> getValidationFailures() {
+ return validationFailures;
+ }
+
}
class ValidationFailure {
@@ -40,5 +47,13 @@
ValidationFailure(Validator validator, String message) {
this.validator = validator;
this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Validator getValidator() {
+ return validator;
}
}
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/Validator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/Validator.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/Validator.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/description/validator/Validator.java Wed Jan 31 12:35:21 2007
@@ -18,6 +18,9 @@
*/
package org.apache.axis2.jaxws.description.validator;
+import java.util.Iterator;
+import java.util.List;
+
/**
*
*/
@@ -26,7 +29,7 @@
public static final boolean VALID = true;
public static final boolean INVALID = false;
- private ValidationFailures validationFailures = new ValidationFailures();
+ protected ValidationFailures validationFailures = new ValidationFailures();
// TODO: turn on validation and change the ValidateWSDL test to start checking for failures.
private ValidationLevel validationLevel = ValidationLevel.FULL;
@@ -39,5 +42,21 @@
ValidationLevel getValidationLevel() {
return validationLevel;
}
-
+
+ public String toString() {
+ String messageString = "";
+ Iterator<ValidationFailure> failureIter = validationFailures.
+ getValidationFailures().iterator();
+ while(failureIter.hasNext()) {
+ ValidationFailure failure = failureIter.next();
+ messageString = messageString + " :: " + failure.getMessage();
+ Validator validator = failure.getValidator();
+ // if this is a different validator reference we want to call
+ // toString on it also
+ if(validator != this) {
+ messageString = messageString + " :: " + validator.toString();
+ }
+ }
+ return messageString;
+ }
}
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties Wed Jan 31 12:35:21 2007
@@ -41,6 +41,7 @@
serviceDescErr0=The service class is not valid. The service QName cannot be null.
serviceDescErr1=The service class is not valid. The Service class {0} must be assignable to javax.xml.ws.Service.
serviceDescErr2=The service is not valid. The {0} service QName cannot be found in the WSDL file.
+wsdlNotFoundErr=The WSDL file could not be found: {0}
wsdlException=The following WSDL exception occurred: {0}
noWebResultForProperty=The system cannot create the WebResult object for the {0} property of the {1} Java bean.
portInfoErr0=The system cannot construct the port data. The {0} service name is not valid.
@@ -144,3 +145,5 @@
invalidPropValue=The value of property {0} was invalid. {1} does not match expected type {2}.
RPCLitMethodMarshallerErr1=Input argument for Operation cannot be null for RPC/LIT messages.
RPCLitMethodMarshallerErr1=Input argument for Operation cannot be null for RPC/LIT messages.
+unknownHost=The host specified by the URL is unknown.
+connectionRefused=An attempt to connect to the URL was refused.
Modified: webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/util/JavaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/util/JavaUtils.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/util/JavaUtils.java (original)
+++ webservices/axis2/branches/java/maven2/modules/metadata/src/org/apache/axis2/jaxws/util/JavaUtils.java Wed Jan 31 12:35:21 2007
@@ -193,20 +193,28 @@
}
/**
- * Get a string containing the stack of the specified exception
+ * Get a string containing the stack of the current location
* @return String
*/
public static String stackToString(){
- Exception e = new RuntimeException();
+ return stackToString(new RuntimeException());
+ }
+
+ /**
+ * Get a string containing the stack of the specified exception
+ * @param e
+ * @return
+ */
+ public static String stackToString(Throwable e) {
java.io.StringWriter sw= new java.io.StringWriter();
java.io.BufferedWriter bw = new java.io.BufferedWriter(sw);
java.io.PrintWriter pw= new java.io.PrintWriter(bw);
e.printStackTrace(pw);
pw.close();
String text = sw.getBuffer().toString();
- // Jump past the "RuntimeException"
+ // Jump past the throwable
text = text.substring(text.indexOf("at"));
text = replace(text, "at ", "DEBUG_FRAME = ");
return text;
- }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org