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 2008/03/31 22:08:54 UTC
svn commit: r643123 - in
/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description:
EndpointDescriptionWSDL.java impl/DescriptionUtils.java
impl/EndpointDescriptionImpl.java validator/EndpointDescriptionValidator.java
Author: barrettj
Date: Mon Mar 31 13:08:48 2008
New Revision: 643123
URL: http://svn.apache.org/viewvc?rev=643123&view=rev
Log:
Cleanup binding type exception log from EnpdointDescription validator to make it more usable.
Modified:
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java?rev=643123&r1=643122&r2=643123&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java Mon Mar 31 13:08:48 2008
@@ -52,6 +52,18 @@
/**
* Returns the namespace for the specific wsdl:binding extensibility element. Typically, this is
* the <soap:binding> element that defines either a SOAP 1.1 or a SOAP 1.2 binding.
+ *
+ * IMPORTANT NOTE: The value returned is converted from the WSDL Binding type (which is the
+ * namespace on the assocaited binding extensibility element) to the corresponding value
+ * for the SOAPBinding annotation. For example, the following SOAP12 WSDL
+ * ...
+ * xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ * ...
+ * <wsdl:binding ...>
+ * <soap12:binding ...>
+ *
+ * Would return the value javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING which is
+ * "http://www.w3.org/2003/05/soap/bindings/HTTP/"
*
* @return String constants defined in javax.xml.ws.soap.SOAPBinding
*/
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java?rev=643123&r1=643122&r2=643123&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java Mon Mar 31 13:08:48 2008
@@ -26,8 +26,11 @@
import org.apache.axis2.jaxws.description.AttachmentDescription;
import org.apache.axis2.jaxws.description.AttachmentType;
import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.EndpointDescriptionWSDL;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import static org.apache.axis2.jaxws.description.builder.MDQConstants.CONSTRUCTOR_METHOD;
+
+import org.apache.axis2.jaxws.description.builder.MDQConstants;
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.WebMethodAnnot;
import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
@@ -51,6 +54,8 @@
import javax.xml.namespace.QName;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.soap.SOAPBinding;
+
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
@@ -524,5 +529,66 @@
log.warn(Messages.getMessage("regHandlerHeadersErr",axisService.getName(),e.getMessage()));
}
}
+ }
+
+ /**
+ * Given a binding type value based on a JAXWS anntation, return the corresponding WSDL
+ * binding type. The JAXWS annotation values understood are those returned by
+ * mapBindingTypeWsdltoAnnotation.
+ *
+ * @see #mapBindingTypeWsdlToAnnotation(String, String)
+ *
+ * @param annotationBindingType The binding type as represented by a JAXWS annotation value
+ * @return The binding type as represented by a WSDL binding extension namespace value
+ */
+ public static String mapBindingTypeAnnotationToWsdl(String annotationBindingType) {
+ String wsdlBindingType = null;
+
+ if (SOAPBinding.SOAP11HTTP_BINDING.equals(annotationBindingType)
+ || MDQConstants.SOAP11JMS_BINDING.equals(annotationBindingType)) {
+ wsdlBindingType = EndpointDescriptionWSDL.SOAP11_WSDL_BINDING;
+ } else if (SOAPBinding.SOAP12HTTP_BINDING.equals(annotationBindingType)
+ || MDQConstants.SOAP12JMS_BINDING.equals(annotationBindingType)) {
+ wsdlBindingType = EndpointDescriptionWSDL.SOAP12_WSDL_BINDING;
+ } else if (javax.xml.ws.http.HTTPBinding.HTTP_BINDING.equals(annotationBindingType)) {
+ wsdlBindingType = EndpointDescriptionWSDL.HTTP_WSDL_BINDING;
+ }
+
+ return wsdlBindingType;
+ }
+
+ /**
+ * Given a binding type value based on WSDL, return the corresponding JAXWS annotation value.
+ * The WSDL binding type values are based on the namespace of the binding extension element.
+ * The JAXWS annotation values correspond to the values to the HTTPBinding and SOAPBinding
+ * annotations. Additionally, proprietary values for JMS bindings are supported. The JAXWS
+ * binding type annotation values returned could be from SOAPBinding or HTTPBinding.
+ *
+ * @param wsdlBindingType The binding type as represnted by the WSDL binding extension namespace
+ * @param soapTransport The WSDL transport. Used to determine if a JMS binding type should
+ * be returned
+ * @return The binding represented by a JAXWS Binding Type Annotation value from either
+ * SOAPBinding or HTTPBinding.
+ */
+ public static String mapBindingTypeWsdlToAnnotation(String wsdlBindingType, String soapTransport) {
+ String soapBindingType = null;
+ if (EndpointDescriptionWSDL.SOAP11_WSDL_BINDING.equals(wsdlBindingType)) {
+ if (MDQConstants.SOAP11JMS_BINDING.equals(soapTransport)) {
+ soapBindingType = MDQConstants.SOAP11JMS_BINDING;
+ } else {
+ //REVIEW: We are making the assumption that if not JMS, then HTTP
+ soapBindingType = SOAPBinding.SOAP11HTTP_BINDING;
+ }
+ } else if (EndpointDescriptionWSDL.SOAP12_WSDL_BINDING.equals(wsdlBindingType)) {
+ if (MDQConstants.SOAP12JMS_BINDING.equals(soapTransport)) {
+ soapBindingType = MDQConstants.SOAP12JMS_BINDING;
+ } else {
+ //REVIEW: We are making the assumption that if not JMS, then HTTP
+ soapBindingType = SOAPBinding.SOAP12HTTP_BINDING;
+ }
+ } else if (EndpointDescriptionWSDL.HTTP_WSDL_BINDING.equals(wsdlBindingType)) {
+ soapBindingType = javax.xml.ws.http.HTTPBinding.HTTP_BINDING;
+ }
+ return soapBindingType;
}
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?rev=643123&r1=643122&r2=643123&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Mon Mar 31 13:08:48 2008
@@ -1683,25 +1683,13 @@
}
// We need to convert the wsdl-based SOAP and HTTP namespace into the expected Binding Type for
- //HTTP or SOAPBindings with the appropriate transport (HTTP, JMS, etc.)
-
- if (SOAP11_WSDL_BINDING.equals(wsdlBindingType)) {
- if (MDQConstants.SOAP11JMS_BINDING.equals(soapTransport)) {
- wsdlBindingType = MDQConstants.SOAP11JMS_BINDING;
- } else {
- //REVIEW: We are making the assumption that if not JMS, then HTTP
- wsdlBindingType = SOAPBinding.SOAP11HTTP_BINDING;
- }
- } else if (SOAP12_WSDL_BINDING.equals(wsdlBindingType)) {
- if (MDQConstants.SOAP12JMS_BINDING.equals(soapTransport)) {
- wsdlBindingType = MDQConstants.SOAP12JMS_BINDING;
- } else {
- //REVIEW: We are making the assumption that if not JMS, then HTTP
- wsdlBindingType = SOAPBinding.SOAP12HTTP_BINDING;
- }
- } else if (HTTP_WSDL_BINDING.equals(wsdlBindingType)) {
- wsdlBindingType = javax.xml.ws.http.HTTPBinding.HTTP_BINDING;
- }
+ // HTTP or SOAPBindings with the appropriate transport (HTTP, JMS, etc.)
+ //
+ // Note that what we're actually returning is the WSDL binding type value conveted
+ // to the corresponding SOAPBinding or HTTPBinding value. We are overwite the
+ // wsdlBindingType with that converted JAXWS annotation binding type value and
+ // return it.
+ wsdlBindingType = DescriptionUtils.mapBindingTypeWsdlToAnnotation(wsdlBindingType, soapTransport);
}
return wsdlBindingType;
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java?rev=643123&r1=643122&r2=643123&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java Mon Mar 31 13:08:48 2008
@@ -24,6 +24,7 @@
import org.apache.axis2.jaxws.description.EndpointDescriptionWSDL;
import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
import org.apache.axis2.jaxws.description.builder.MDQConstants;
+import org.apache.axis2.jaxws.description.impl.DescriptionUtils;
import org.apache.axis2.jaxws.i18n.Messages;
import javax.wsdl.Port;
@@ -78,8 +79,14 @@
//Get the binding type from the annotation
String bindingType = endpointDesc.getBindingType();
- //The wsdl binding type that we now receive has been previously mapped to the expected
- //SOAP and HTTP bindings. So, there is now limited validation to perform
+ // The wsdl binding type that we now receive has been previously mapped to the expected
+ // SOAP and HTTP bindings. So, there is now limited validation to perform.
+ //
+ // IMPORTANT NOTE: The value returned is NOT the WSDL Binding Type value; it has been
+ // normalized to be the value corresponding to the JAXWS BindingType annotations.
+ // That means when we log this value below we need to un-normalize it so the value
+ // is one that actuall appears in the WSDL. This isn't an issue for SOAP11 because
+ // the values are the same; but it IS an issue for SOAP12.
String wsdlBindingType = endpointDescWSDL.getWSDLBindingType();
if (bindingType == null) {
// I don't think this can happen; the Description layer should provide a default
@@ -110,7 +117,8 @@
else if (!SOAPBinding.SOAP11HTTP_BINDING.equals(wsdlBindingType)
&& !SOAPBinding.SOAP12HTTP_BINDING.equals(wsdlBindingType)
&& !javax.xml.ws.http.HTTPBinding.HTTP_BINDING.equals(wsdlBindingType)) {
- addValidationFailure(this, "Invalid wsdl binding value specified: " + wsdlBindingType);
+ addValidationFailure(this, "Invalid wsdl binding value specified: "
+ + DescriptionUtils.mapBindingTypeAnnotationToWsdl(wsdlBindingType));
isBindingValid = false;
}
// Validate that the WSDL and annotations values indicate the same type of binding
@@ -138,7 +146,7 @@
// Mismatched bindings
String wsdlInsert = "[" + bindingHumanReadableDescription(wsdlBindingType) + "]" +
- "namespace = {" + wsdlBindingType +"}";
+ "namespace = {" + DescriptionUtils.mapBindingTypeAnnotationToWsdl(wsdlBindingType) +"}";
String annotationInsert = "[" + bindingHumanReadableDescription(bindingType) + "]" +
"namespace = {" + bindingType +"}";
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org