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 pr...@apache.org on 2008/01/15 17:22:27 UTC
svn commit: r612147 [15/17] - in /webservices/axis2/branches/java/jaxws21:
./ 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/schem...
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Tue Jan 15 08:21:22 2008
@@ -182,6 +182,10 @@
private boolean _setAttachmentDesc = false;
private AttachmentDescription attachmentDesc = null;
+ private boolean hasRequestSwaRefAttachments = false;
+ private boolean hasResponseSwaRefAttachments = false;
+ private Map<String, AttachmentDescription> partAttachmentMap;
+
private Method serviceImplMethod;
private boolean serviceImplMethodFound = false;
// For JAX-WS client async methods, this is the corresponding Sync method; for everything else,
@@ -190,8 +194,7 @@
// RUNTIME INFORMATION
Map<String, OperationRuntimeDescription> runtimeDescMap =
Collections.synchronizedMap(new HashMap<String, OperationRuntimeDescription>());
- private Map<String, AttachmentDescription> partAttachmentMap;
-
+
OperationDescriptionImpl(Method method, EndpointInterfaceDescription parent) {
// TODO: Look for WebMethod anno; get name and action off of it
parentEndpointInterfaceDescription = parent;
@@ -1951,6 +1954,22 @@
public void addPartAttachmentDescription(String partName, AttachmentDescription attachmentDesc) {
partAttachmentMap.put(partName, attachmentDesc);
+ }
+
+ public boolean hasRequestSwaRefAttachments() {
+ return hasRequestSwaRefAttachments;
+ }
+
+ public void setHasRequestSwaRefAttachments(boolean b) {
+ hasRequestSwaRefAttachments = b;
+ }
+
+ public boolean hasResponseSwaRefAttachments() {
+ return hasResponseSwaRefAttachments;
+ }
+
+ public void setHasResponseSwaRefAttachments(boolean b) {
+ hasResponseSwaRefAttachments = b;
}
public String toString() {
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Tue Jan 15 08:21:22 2008
@@ -56,8 +56,10 @@
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceClient;
import javax.xml.ws.soap.SOAPBinding;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -84,10 +86,6 @@
private URL wsdlURL;
private QName serviceQName;
- // Only ONE of the following will be set in a ServiceDescription, depending on whether this Description
- // was created from a service-requester or service-provider flow.
- private Class serviceClass; // A service-requester generated service or generic service class
-
// TODO: Possibly remove Definition and delegate to the Defn on the AxisSerivce set as a paramater by WSDLtoAxisServicBuilder?
private WSDLWrapper wsdlWrapper;
private WSDLWrapper generatedWsdlWrapper;
@@ -112,7 +110,8 @@
/**
- * This is (currently) the client-side-only constructor Construct a service description hierachy
+ * Create a service-requester side (aka client-side) service description.
+ * Construct a service description hierachy
* based on WSDL (may be null), the Service class, and a service QName.
*
* @param wsdlURL The WSDL file (this may be null).
@@ -123,6 +122,23 @@
* not be null.
*/
ServiceDescriptionImpl(URL wsdlURL, QName serviceQName, Class serviceClass) {
+ this(wsdlURL, serviceQName, serviceClass, null, null);
+ }
+
+ /**
+ * Create a service-requester side service description. Same as constructor above with an
+ * additonal composite paramater. Note that the composite is "sparse" in that any values it
+ * contains overrides any values on the corresponding class annotation HOWEVER if the composite
+ * doesn't specify a value, it is gotten from the class annotation.
+ * @param wsdlURL
+ * @param serviceQName
+ * @param serviceClass
+ * @param sparseComposite a composite with any annotation overrides such as from a client deployment
+ * descriptor. CAN NOT BE NULL, but it can be an object created with a default constructor
+ */
+ ServiceDescriptionImpl(URL wsdlURL, QName serviceQName, Class serviceClass,
+ DescriptionBuilderComposite sparseComposite,
+ Object sparseCompositeKey) {
if (serviceQName == null) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDescErr0"));
}
@@ -135,25 +151,108 @@
Messages.getMessage("serviceDescErr1", serviceClass.getName()));
}
+ composite = new DescriptionBuilderComposite();
+ composite.setIsServiceProvider(false);
+ composite.setCorrespondingClass(serviceClass);
+ composite.setSparseComposite(sparseCompositeKey, sparseComposite);
+ URL sparseCompositeWsdlURL = getWsdlURL(serviceClass, sparseComposite);
+ // The classloader was originally gotten off this class, but it seems more logical to
+ // get it off the application service class.
+// composite.setClassLoader(this.getClass().getClassLoader());
+ composite.setClassLoader(serviceClass.getClassLoader());
+
// TODO: On the client side, we should not support partial WSDL; i.e. if the WSDL is specified it must be
// complete and must contain the ServiceQName. This is how the Sun RI behaves on the client.
// When this is fixed, the check in ServiceDelegate(URL, QName, Class) should be removed
- this.wsdlURL = wsdlURL;
+
+ // If there's a WSDL URL specified in the sparse composite, that is a override, for example
+ // from a JSR-109 deployment descriptor, and that's the one to use.
+ if (sparseCompositeWsdlURL != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Wsdl location overriden by sparse composite; overriden value: " + this.wsdlURL);
+ }
+ this.wsdlURL = sparseCompositeWsdlURL;
+ } else {
+ this.wsdlURL = wsdlURL;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Wsdl Location value used: " + this.wsdlURL);
+ }
// TODO: The serviceQName needs to be verified between the argument/WSDL/Annotation
this.serviceQName = serviceQName;
- this.serviceClass = serviceClass;
setupWsdlDefinition();
}
+
+ URL getWsdlURL(Class clazz, DescriptionBuilderComposite sparseComposite) {
+ // Use the WSDL file if it is specified in the composite
+ // TODO: (JLB) This logic is common with stuff Dustin put in ServiceDescriptionImpl to
+ // do WSDL file reading in MDQ; refactor them into common helper class.
+ URL url = null;
+ if (sparseComposite != null) {
+ WebServiceClient wsc = (WebServiceClient) sparseComposite.getWebServiceClientAnnot();
+ if (wsc != null && wsc.wsdlLocation() != null) {
+ String wsdlLocation = wsc.wsdlLocation();
+ // Look for the WSDL file as follows:
+ // 1) As a resource on the classpath
+ // 2) As a fully specified URL
+ // 3) As a file on the filesystem. This is analagous to what the generated
+ // Service client does. Is prepends "file:/" to whatever is specified in the
+ // @WegServiceClient.wsdlLocation element.
+ URL wsdlUrl = null;
+ wsdlUrl = clazz.getClassLoader().getResource(wsdlLocation);
+ if (wsdlUrl == null) {
+ wsdlUrl = createWsdlURL(wsdlLocation);
+ }
+ if (wsdlUrl == null) {
+ // This check is necessary because Unix/Linux file paths begin
+ // with a '/'. When adding the prefix 'jar:file:/' we may end
+ // up with '//' after the 'file:' part. This causes the URL
+ // object to treat this like a remote resource
+ if(wsdlLocation.indexOf("/") == 0) {
+ wsdlLocation = wsdlLocation.substring(1, wsdlLocation.length());
+ }
+ wsdlUrl = createWsdlURL("file:/" + wsdlLocation);
+ }
+
+ if (wsdlUrl == null) {
+ // TODO: (JLB) NLS
+ throw ExceptionFactory.makeWebServiceException("Unable to access wsdlLocation: "
+ + wsdlLocation);
+ } else {
+ url = wsdlUrl;
+ }
+ }
+ }
+ return url;
+ }
+ private static URL createWsdlURL(String wsdlLocation) {
+ URL theUrl = null;
+ try {
+ theUrl = new URL(wsdlLocation);
+ } catch (Exception ex) {
+ // Just return a null to indicate we couldn't create a URL from the string
+ }
+ return theUrl;
+ }
+
+
/**
- * This is (currently) the service-provider-side-only constructor. Create a service Description
- * based on a service implementation class
+ * Create a service-provider side ServiceDesci. Create a service Description
+ * based on a service implementation class. Note this is for test-only code; it should not be
+ * used in production code. And it is being removed from the test code as well.
*
+ * @deprecated
* @param serviceImplClass
*/
ServiceDescriptionImpl(Class serviceImplClass, AxisService axisService) {
+ composite = new DescriptionBuilderComposite();
+ composite.setIsDeprecatedServiceProviderConstruction(true);
+ composite.setIsServiceProvider(true);
+ // TODO: (JLB) does the composite corresponding class AND the classloader need to be set here?
isServerSide = true;
+
// Create the EndpointDescription hierachy from the service impl annotations; Since the PortQName is null,
// it will be set to the annotation value.
EndpointDescriptionImpl endpointDescription =
@@ -164,10 +263,11 @@
}
/**
- * This is (currently) the service-provider-side-only constructor. Create a service Description
- * based on a service implementation class
- *
- * @param serviceImplClass
+ * Create a service-provider side Service description hierachy. The hierachy is created entirely
+ * from composite. All relevant classes and interfaces referenced from the class represented by
+ * composite must be included in the map.
+ * @param dbcMap
+ * @param composite
*/
ServiceDescriptionImpl(
HashMap<String, DescriptionBuilderComposite> dbcMap,
@@ -218,6 +318,11 @@
* port is one that is not defined (e.g. not via WSDL or annotations) and has been added via
* Serivce.addPort.
* <p/>
+ * For predefined ports, a composite of sparse metadata, such as from a deployment descriptor
+ * may be supplied. This can be used to modify the endpoint interfaceannotations such as
+ * adding a handler chain. The sparse composite is NOT supported for dynamic (i.e. ADD_PORT)
+ * or dispatch clients.
+ * <p/>
* Notes on how an EndpointDescription can be updated or created: 1) Service.createDispatch can
* create a Dispatch client for either a declared or dynamic port 2) Note that creating a
* Dispatch does not associate an SEI with an endpoint 3) Service.getPort will associate an SEI
@@ -234,20 +339,37 @@
* non-existent dynamic port CREATE_DISPATCH is an attempt to create a
* Dispatch-based client to either a declared port or a pre-existing dynamic
* port.
+ * @param composite May contain sparse metadata, for example from a deployment descriptor, that
+ * should be used in conjuction with the class annotations to update the
+ * description hierachy. For example, it may contain a HandlerChain annotation
+ * based on information in a JSR-109 deploment descriptor.
*/
EndpointDescription updateEndpointDescription(Class sei, QName portQName,
- DescriptionFactory.UpdateType updateType) {
+ DescriptionFactory.UpdateType updateType,
+ DescriptionBuilderComposite composite,
+ Object compositeKey) {
EndpointDescriptionImpl endpointDescription = getEndpointDescriptionImpl(portQName);
boolean isPortDeclared = isPortDeclared(portQName);
+ // If no QName was specified in the arguments, one may have been specified in the sparse
+ // composite metadata when the service was created.
+ if (DescriptionUtils.isEmpty(portQName)) {
+ QName preferredPortQN = getPreferredPort(compositeKey);
+ if (!DescriptionUtils.isEmpty(preferredPortQN)) {
+ portQName = preferredPortQN;
+ }
+ }
switch (updateType) {
case ADD_PORT:
+ if (composite != null) {
+ // TODO: (JLB) NLS
+ throw ExceptionFactory.makeWebServiceException("AddPort can not have a composite");
+ }
// Port must NOT be declared (e.g. can not already exist in WSDL)
// If an EndpointDesc doesn't exist; create it as long as it doesn't exist in the WSDL
- // TODO: This test can be simplified once isPortDeclared(QName) understands annotations and WSDL as ways to declare a port.
if (DescriptionUtils.isEmpty(portQName)) {
throw ExceptionFactory
.makeWebServiceException(Messages.getMessage("addPortErr2"));
@@ -289,8 +411,7 @@
Messages.getMessage("updateEPDescrErr2",(portQName != null ? portQName.toString() : "not specified")));
} else if (endpointDescription == null) {
// Use the SEI Class and its annotations to finish creating the Description hierachy: Endpoint, EndpointInterface, Operations, Parameters, etc.
- // TODO: Need to create the Axis Description objects after we have all the config info (i.e. from this SEI)
- endpointDescription = new EndpointDescriptionImpl(sei, portQName, this);
+ endpointDescription = new EndpointDescriptionImpl(sei, portQName, this, composite, compositeKey);
addEndpointDescription(endpointDescription);
/*
* We must reset the service runtime description after adding a new endpoint
@@ -301,19 +422,36 @@
resetServiceRuntimeDescription();
} else
if (getEndpointSEI(portQName) == null && !endpointDescription.isDynamicPort()) {
- // Existing endpointDesc from a declared port needs to be updated with an SEI
- // Note that an EndpointDescritption created from an addPort (i.e. a dynamic port) can not do this.
- endpointDescription.updateWithSEI(sei);
+ // Existing endpointDesc from a declared port needs to be updated with an SEI.
+ // This could happen if the client first did a CREATE_DISPATCH on a declared
+ // port, which would cause it to be created, and then did a GET_PORT on the
+ // same port later, providing an SEI.
+ // Notes
+ // 1) An EndpointDescritption created from an addPort (i.e. a dynamic port) can
+ // not do this.
+ // 2) A sparse composite may be specified. We don't allow mixing JAX-WS unmanaged
+ // apis (CREATE_DISPATCH) with JSR-109 managed apis (GET_PORT with sparse
+ // composite metadata from a DD). Since the sparse composite is stored by
+ // a key AND CREATE_DISPATCH and ADD_PORT will thrown an exception of a composite
+ // is specified, having a composite and key on the GET_PORTs shouldn't be
+ // a problem.
+ endpointDescription.updateWithSEI(sei, composite, compositeKey);
} else if (getEndpointSEI(portQName) != sei) {
throw ExceptionFactory.makeWebServiceException(
Messages.getMessage("updateEPDescrErr3",portQName.toString(),
sei.getName(),getEndpointSEI(portQName).getName()));
} else {
// All error check above passed, the EndpointDescription already exists and needs no updating
+ // Just add the sparse composite if one was specified.
+ endpointDescription.getDescriptionBuilderComposite().setSparseComposite(compositeKey, composite);
}
break;
case CREATE_DISPATCH:
+ if (composite != null) {
+ // TODO: (JLB) NLS
+ throw ExceptionFactory.makeWebServiceException("CreateDispatch can not have a composite");
+ }
// Port may or may not exist in WSDL.
// If an endpointDesc doesn't exist and it is in the WSDL, it can be created
// Otherwise, it is an error.
@@ -422,7 +560,7 @@
return null;
}
- DescriptionBuilderComposite getDescriptionBuilderComposite() {
+ public DescriptionBuilderComposite getDescriptionBuilderComposite() {
return composite;
}
@@ -450,16 +588,6 @@
return returnEndpointDesc;
}
- /*
- * @return True - if we are processing with the DBC List instead of reflection
- */
- boolean isDBCMap() {
- if (dbcMap == null)
- return false;
- else
- return true;
- }
-
// END of public accessor methods
/*=======================================================================*/
/*=======================================================================*/
@@ -471,7 +599,7 @@
// Note that there may be no WSDL provided, for example when called from
// Service.create(QName serviceName).
- if (isDBCMap()) {
+ if (composite.isServiceProvider()) {
// 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
@@ -492,6 +620,15 @@
throw ExceptionFactory.makeWebServiceException(
Messages.getMessage("wsdlException", e.getMessage()), e);
}
+ } else {
+ String wsdlLocation = null;
+ wsdlLocation = composite.getWebServiceAnnot() != null ? composite.getWebServiceAnnot().wsdlLocation() :
+ composite.getWebServiceProviderAnnot().wsdlLocation();
+ if(wsdlLocation != null
+ &&
+ !"".equals(wsdlLocation)) {
+ setWSDLDefinitionOnDBC(wsdlLocation);
+ }
}
} else if (composite.getWebServiceAnnot() != null) {
@@ -505,16 +642,57 @@
getDBCMap().get(composite.getWebServiceAnnot().endpointInterface());
try {
- if (seic.getWsdlDefinition() != null) {
- //set the sdimpl from the SEI composite
+ if (seic == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("The SEI class " + composite.getWebServiceAnnot().endpointInterface() + " was not found.");
+ }
+ }
+ if (seic != null && seic.getWsdlDefinition() != null) {
+ // set the wsdl def from the SEI composite
+ if (log.isDebugEnabled()) {
+ log.debug("Get the wsdl definition 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
+ //set the wsdl def from the impl. class composite
+ if (log.isDebugEnabled()) {
+ log.debug("Get the wsdl definition from the impl class composite.");
+ }
this.wsdlURL = composite.getWsdlURL();
this.wsdlWrapper = new WSDL4JWrapper(composite.getWsdlURL(),
composite.getWsdlDefinition());
+ } else {
+ String wsdlLocation = null;
+ // first check to see if the wsdlLocation is on the SEI
+ if(seic != null
+ &&
+ seic.getWebServiceAnnot() != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Get the wsdl location from the SEI composite.");
+ }
+ wsdlLocation = seic.getWebServiceAnnot().wsdlLocation();
+ }
+
+ // now check the impl
+ if(wsdlLocation == null
+ ||
+ "".equals(wsdlLocation)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Get the wsdl location from the impl class composite.");
+ }
+ wsdlLocation = composite.getWebServiceAnnot().wsdlLocation();
+ }
+
+ if(wsdlLocation != null
+ &&
+ !"".equals(wsdlLocation)) {
+ if (log.isDebugEnabled()) {
+ log.debug("wsdl location =" + wsdlLocation);
+ }
+ setWSDLDefinitionOnDBC(wsdlLocation);
+ }
}
} catch (WSDLException e) {
throw ExceptionFactory.makeWebServiceException(
@@ -548,6 +726,68 @@
}
}
}
+
+ /**
+ * This method accepts a location of a WSDL document and attempts to
+ * load and set the WSDL definition on the DBC object.
+ * @param wsdlLocation
+ */
+ private void setWSDLDefinitionOnDBC(String wsdlLocation) {
+ if(log.isDebugEnabled()) {
+ log.debug("Attempting to load WSDL file from location specified in annotation: " +
+ wsdlLocation);
+ }
+ if(composite.getClassLoader() == null) {
+ if(log.isDebugEnabled()) {
+ log.debug("A classloader could not be found for class: " + composite.
+ getClassName() + ". The WSDL file: " + wsdlLocation + " will not be " +
+ "processed, and the ServiceDescription will be built from " +
+ "annotations");
+ }
+ }
+ try {
+ if(log.isDebugEnabled()) {
+ log.debug("Attempting to read WSDL: " + wsdlLocation + " for web " +
+ "service endpoint: " + composite.getClassName());
+ }
+ URL url = getWSDLURL(wsdlLocation);
+ this.wsdlWrapper = new WSDL4JWrapper(url);
+ composite.setWsdlDefinition(wsdlWrapper.getDefinition());
+ }
+ catch(Exception e) {
+ if(log.isDebugEnabled()) {
+ log.debug("The WSDL file: " + wsdlLocation + " for class: " + composite.getClassName() +
+ "could not be processed. The ServiceDescription will be built from " +
+ "annotations");
+ }
+ }
+ }
+
+ /**
+ * This method will handle obtaining a URL for the given WSDL location.
+ */
+ private URL getWSDLURL(String wsdlLocation) {
+ URL url = composite.getClassLoader().getResource(wsdlLocation);
+ if(url == null) {
+ if(log.isDebugEnabled()) {
+ log.debug("URL for wsdl file: " + wsdlLocation + " could not be " +
+ "determined by classloader... looking for file reference");
+ }
+ File file = new File(wsdlLocation);
+ if(file != null) {
+ try {
+ url = file.toURL();
+ }
+ catch(Exception e) {
+ if(log.isDebugEnabled()) {
+ log.debug("Unable to obtain URL for WSDL file: " + wsdlLocation +
+ " by using file reference");
+ }
+ }
+ }
+ }
+ return url;
+ }
// TODO: Remove these and replace with appropraite get* methods for WSDL information
/* (non-Javadoc)
@@ -636,7 +876,23 @@
serviceQName = theName;
}
-
+ /* (non-Javadoc)
+ * @see org.apache.axis2.jaxws.description.ServiceDescription#isMTOMEnabled(java.lang.Object)
+ */
+ public boolean isMTOMEnabled(Object key) {
+ return getDescriptionBuilderComposite().isMTOMEnabled(key);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.jaxws.description.ServiceDescription#getPreferredPort(java.lang.Object)
+ */
+ public QName getPreferredPort(Object key) {
+ return getDescriptionBuilderComposite().getPreferredPort(key);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.jaxws.description.ServiceDescription#isServerSide()
+ */
public boolean isServerSide() {
return isServerSide;
}
@@ -895,20 +1151,31 @@
if (interfaceString.equals(MDQConstants.PROVIDER_SOAP)) {
// Make sure BindingType is SOAP/HTTP with SOAPMessage
- // object, Default for Binding Type is SOAP/HTTP
- if (!DescriptionUtils.isEmpty(bindingType)
- && !bindingType
- .equals(SOAPBinding.SOAP11HTTP_BINDING)
- && !bindingType
- .equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
- && !bindingType
- .equals(SOAPBinding.SOAP12HTTP_BINDING)
- && !bindingType
- .equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))
-
- throw ExceptionFactory.makeWebServiceException(
- Messages.getMessage("validatePIsErr2",composite.getClassName()));
-
+ // object, Default for Binding Type is SOAP/HTTP
+ if (!DescriptionUtils.isEmpty(bindingType)
+ && !bindingType
+ .equals(SOAPBinding.SOAP11HTTP_BINDING)
+ && !bindingType
+ .equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
+ && !bindingType
+ .equals(SOAPBinding.SOAP12HTTP_BINDING)
+ && !bindingType
+ .equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)
+ && !bindingType
+ .equals(MDQConstants.SOAP11JMS_BINDING)
+ && !bindingType
+ .equals(MDQConstants.SOAP11JMS_MTOM_BINDING)
+ && !bindingType
+ .equals(MDQConstants.SOAP12JMS_BINDING)
+ && !bindingType
+ .equals(MDQConstants.SOAP12JMS_MTOM_BINDING))
+
+ throw ExceptionFactory.makeWebServiceException(Messages
+ .getMessage("validatePIsErr2", composite
+ .getClassName()));
+
+
+
} else if (interfaceString
.equals(MDQConstants.PROVIDER_DATASOURCE)) {
@@ -1380,22 +1647,13 @@
String handlerFileName = handlerChainAnnotation.file();
if (log.isDebugEnabled()) {
- if (composite != null) {
- log.debug("EndpointDescriptionImpl.getHandlerChain: fileName: "
- + handlerFileName + " className: " + composite.getClassName());
- }
- else {
- log.debug("EndpointDescriptionImpl.getHandlerChain: fileName: "
- + handlerFileName + " className: " + serviceClass.getName());
- }
+ log.debug("EndpointDescriptionImpl.getHandlerChain: fileName: "
+ + handlerFileName + " className: " + composite.getClassName());
}
- String className =
- (composite != null) ? composite.getClassName() : serviceClass.getName();
+ String className = composite.getClassName();
- ClassLoader classLoader =
- (composite != null) ? composite.getClassLoader() : this.getClass()
- .getClassLoader();
+ ClassLoader classLoader = composite.getClassLoader();
InputStream is =
DescriptionUtils.openHandlerConfigStream(handlerFileName,
@@ -1421,6 +1679,7 @@
*/
public HandlerChain getAnnoHandlerChainAnnotation() {
if (this.handlerChainAnnotation == null) {
+ Class serviceClass = composite.getCorrespondingClass();
if (serviceClass != null) {
handlerChainAnnotation =
(HandlerChain) getAnnotation(serviceClass, HandlerChain.class);
@@ -1549,6 +1808,15 @@
private void resetServiceRuntimeDescription() {
runtimeDescMap.clear();
+ }
+
+ /**
+ * Return the name of the client-side service class if it exists.
+ */
+ protected String getServiceClassName() {
+ return composite.getClassName();
+ // TODO: (JLB) Remove commented out code from 1/7/08 merge
+// return (this.serviceClass != null ? this.serviceClass.getName() : null);
}
/** Return a string representing this Description object and all the objects it contains. */
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java Tue Jan 15 08:21:22 2008
@@ -22,6 +22,7 @@
import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
import org.apache.axis2.jaxws.description.EndpointDescriptionWSDL;
import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
+import org.apache.axis2.jaxws.description.builder.MDQConstants;
import javax.wsdl.Port;
import javax.wsdl.Service;
@@ -67,7 +68,10 @@
private boolean validateWSDLBindingType() {
boolean isBindingValid = false;
+
+ //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
String wsdlBindingType = endpointDescWSDL.getWSDLBindingType();
@@ -82,7 +86,12 @@
!SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingType) &&
!SOAPBinding.SOAP12HTTP_BINDING.equals(bindingType) &&
!SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingType) &&
+ !MDQConstants.SOAP11JMS_BINDING.equals(bindingType) &&
+ !MDQConstants.SOAP11JMS_MTOM_BINDING.equals(bindingType) &&
+ !MDQConstants.SOAP12JMS_BINDING.equals(bindingType) &&
+ !MDQConstants.SOAP12JMS_MTOM_BINDING.equals(bindingType) &&
!HTTPBinding.HTTP_BINDING.equals(bindingType)) {
+
addValidationFailure(this,
"Invalid annotation binding value specified: " + bindingType);
isBindingValid = false;
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties Tue Jan 15 08:21:22 2008
@@ -281,3 +281,4 @@
pDescrErr=Null Descriptor. PropertyDescriptor not found.
pDescrErr2=No read Method found to read property Value from jaxbObject: {0}
restWithSOAPErr=Expected an XML over HTTP message, but the message appears to be a SOAP message. The namespace is {0}
+noDataHandler=A data handler was not found for content id {0}
\ No newline at end of file
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/util/ClassLoaderUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/util/ClassLoaderUtils.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/util/ClassLoaderUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/util/ClassLoaderUtils.java Tue Jan 15 08:21:22 2008
@@ -56,13 +56,13 @@
}
/** @return ClassLoader */
- public static ClassLoader getContextClassLoader() {
- ClassLoader cl = null;
+ public static ClassLoader getContextClassLoader(final ClassLoader classLoader) {
+ ClassLoader cl;
try {
cl = (ClassLoader)AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws ClassNotFoundException {
- return Thread.currentThread().getContextClassLoader();
+ return classLoader != null ? classLoader : Thread.currentThread().getContextClassLoader();
}
}
);
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java Tue Jan 15 08:21:22 2008
@@ -22,6 +22,7 @@
import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.wsdl.WSDLReaderConfigurator;
import org.apache.axis2.metadata.factory.ResourceFinderFactory;
import org.apache.axis2.metadata.registry.MetadataFactoryRegistry;
import org.apache.axis2.metadata.resource.ResourceFinder;
@@ -84,44 +85,9 @@
}
});
this.wsdlURL = wsdlURL;
+
try {
- URL url = wsdlURL;
- String filePath = null;
- boolean isFileProtocol =
- (url != null && "file".equals(url.getProtocol())) ? true : false;
- if (isFileProtocol) {
- filePath = (url != null) ? url.getPath() : null;
- //Check is the uri has relative path i.e path is not absolute and is not starting with a "/"
- boolean isRelativePath =
- (filePath != null && !new File(filePath).isAbsolute()) ? true : false;
- if (isRelativePath) {
- if (log.isDebugEnabled()) {
- log.debug("WSDL URL has a relative path");
- }
- //Lets read the complete WSDL URL for relative path from class loader
- //Use relative path of url to fetch complete URL.
- url = getAbsoluteURL(classLoader, filePath);
- if (url == null) {
- if (log.isDebugEnabled()) {
- log.debug("WSDL URL for relative path not found in ClassLoader");
- log.warn(
- "Unable to read WSDL from relative path, check the relative path");
- log.info("Relative path example: file:/WEB-INF/wsdl/<wsdlfilename>");
- log.warn(
- "Using relative path as default wsdl URL to create wsdl Definition.");
- }
- url = wsdlURL;
- }
- else {
- if(log.isDebugEnabled()) {
- log.debug("WSDL URL found for relative path: " + filePath + " scheme: " +
- url.getProtocol());
- }
- }
- }
- }
-
- URLConnection urlCon = url.openConnection();
+ URLConnection urlCon = getURLConnection(this.wsdlURL);
InputStream is = null;
try {
is = getInputStream(urlCon);
@@ -131,8 +97,9 @@
log.debug("Could not open url connection. Trying to use " +
"classloader to get another URL.");
}
+ String filePath = wsdlURL != null ? wsdlURL.getPath() : null;
if(filePath != null) {
- url = getAbsoluteURL(classLoader, filePath);
+ URL url = getAbsoluteURL(classLoader, filePath);
if(url == null) {
if(log.isDebugEnabled()) {
log.debug("Could not locate URL for wsdl. Reporting error");
@@ -140,7 +107,7 @@
throw new WSDLException("WSDL4JWrapper : ", e.getMessage(), e);
}
else {
- urlCon = url.openConnection();
+ urlCon = openConnection(url);
if(log.isDebugEnabled()) {
log.debug("Found URL for WSDL from jar");
}
@@ -171,6 +138,75 @@
throw new WSDLException("WSDL4JWrapper : ", ex.getMessage());
}
}
+
+ /**
+ * This is a helper method to retrieve a URLConnection object
+ * based on a URL for the WSDL document.
+ */
+ private URLConnection getURLConnection(URL url) throws IOException {
+ String filePath = null;
+ boolean isFileProtocol =
+ (url != null && "file".equals(url.getProtocol())) ? true : false;
+ if (isFileProtocol) {
+ filePath = (url != null) ? url.getPath() : null;
+ //Check is the uri has relative path i.e path is not absolute and is not starting with a "/"
+ boolean isRelativePath =
+ (filePath != null && !new File(filePath).isAbsolute()) ? true : false;
+ if (isRelativePath) {
+ if (log.isDebugEnabled()) {
+ log.debug("WSDL URL has a relative path");
+ }
+ //Lets read the complete WSDL URL for relative path from class loader
+ //Use relative path of url to fetch complete URL.
+ url = getAbsoluteURL(getThreadClassLoader(), filePath);
+ if (url == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("WSDL URL for relative path not found in ClassLoader");
+ log.warn(
+ "Unable to read WSDL from relative path, check the relative path");
+ log.info("Relative path example: file:/WEB-INF/wsdl/<wsdlfilename>");
+ log.warn(
+ "Using relative path as default wsdl URL to create wsdl Definition.");
+ }
+ url = wsdlURL;
+ }
+ else {
+ if(log.isDebugEnabled()) {
+ log.debug("WSDL URL found for relative path: " + filePath + " scheme: " +
+ url.getProtocol());
+ }
+ }
+ }
+ }
+ URLConnection connection = null;
+ if(url != null) {
+ if(log.isDebugEnabled()) {
+ log.debug("Retrieving URLConnection from WSDL URL");
+ }
+ connection = openConnection(url);
+ }
+ return connection;
+ }
+
+ private URLConnection openConnection(final URL url) throws IOException {
+ try {
+ return (URLConnection) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws IOException {
+ return url.openConnection();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (IOException) e.getException();
+ }
+ }
+
+ private ClassLoader getThreadClassLoader() {
+ return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
private URL getAbsoluteURL(ClassLoader classLoader, String filePath){
URL url = classLoader.getResource(filePath);
@@ -182,14 +218,43 @@
URLClassLoader urlLoader = (URLClassLoader)classLoader;
url = getURLFromJAR(urlLoader, wsdlURL);
}
+ else {
+ URLClassLoader nestedLoader = (URLClassLoader) getNestedClassLoader(URLClassLoader.class, classLoader);
+ if (nestedLoader != null) {
+ url = getURLFromJAR(nestedLoader, wsdlURL);
+ }
+ }
}
return url;
}
- private URL getURLFromJAR(URLClassLoader urlLoader, URL relativeURL) {
+
+ private ClassLoader getNestedClassLoader(Class type, ClassLoader root) {
+ if (log.isDebugEnabled()) {
+ log.debug("Searching for nested URLClassLoader");
+ }
+ while (!(root instanceof URLClassLoader)) {
+ if (root == null) {
+ break;
+ }
+
+ root = root.getParent();
+ if (log.isDebugEnabled() && root != null) {
+ log.debug("Checking parent ClassLoader: " + root.getClass().getName());
+ }
+ }
- URL[] urlList = null;
+ return root;
+ }
+
+ private URL getURLFromJAR(URLClassLoader urlLoader, URL relativeURL) {
+ URL[] urlList = null;
ResourceFinderFactory rff =(ResourceFinderFactory)MetadataFactoryRegistry.getFactory(ResourceFinderFactory.class);
- ResourceFinder cf = rff.getResourceFinder();
+ ResourceFinder cf = rff.getResourceFinder();
+ if (log.isDebugEnabled()) {
+ log.debug("ResourceFinderFactory: " + rff.getClass().getName());
+ log.debug("ResourceFinder: " + cf.getClass().getName());
+ }
+
urlList = cf.getURLs(urlLoader);
if(urlList == null){
if(log.isDebugEnabled()){
@@ -255,6 +320,14 @@
} catch (PrivilegedActionException e) {
throw (WSDLException)e.getException();
}
+ WSDLReaderConfigurator configurator = (WSDLReaderConfigurator) MetadataFactoryRegistry.
+ getFactory(WSDLReaderConfigurator.class);
+ if(configurator != null) {
+ if(log.isDebugEnabled()) {
+ log.debug("Calling configureReaderInstance with: " + configurator.getClass().getName());
+ }
+ configurator.configureReaderInstance(reader);
+ }
return reader;
}
@@ -327,17 +400,57 @@
if (wsdlExplicitURL != null) {
try {
- def = (Definition) AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws WSDLException {
- WSDLReader reader = getWSDLReader();
- return reader.readWSDL(wsdlExplicitURL);
+ URLConnection urlConn = getURLConnection(wsdlURL);
+ if(urlConn != null) {
+ try {
+ InputStream is = getInputStream(urlConn);
+ if(is != null) {
+ final ModuleWSDLLocator locator = new ModuleWSDLLocator(wsdlExplicitURL, is,
+ getThreadClassLoader());
+ if(log.isDebugEnabled()) {
+ log.debug("Loading WSDL using ModuleWSDLLocator from base " +
+ "location: " + wsdlExplicitURL);
+ }
+ def = (Definition) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws WSDLException {
+ WSDLReader reader = getWSDLReader();
+ return reader.readWSDL(locator);
+ }
+ });
+ }
}
- });
+ catch(Exception e) {
+ if(log.isDebugEnabled()) {
+ log.debug("Using ModuleWSDLLocator was not successful for loading " +
+ "WSDL due to the following error: " + e.toString() + ". The " +
+ "WSDL will be read from the WSDL location: " + wsdlExplicitURL);
+ }
+ }
+ }
+ if(def == null) {
+ if(log.isDebugEnabled()) {
+ log.debug("Loading WSDL from location: " + wsdlExplicitURL);
+ }
+ def = (Definition) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws WSDLException {
+ WSDLReader reader = getWSDLReader();
+ return reader.readWSDL(wsdlExplicitURL);
+ }
+ });
+ }
+
} catch (PrivilegedActionException e) {
if (log.isDebugEnabled()) {
log.debug("Exception thrown from AccessController: " + e);
}
throw ExceptionFactory.makeWebServiceException(e.getException());
+ }
+ catch(IOException ioe) {
+ if(log.isDebugEnabled()) {
+ log.debug("An error occurred while attempting to load the WSDL " +
+ "file at the following location: " + wsdlExplicitURL);
+ }
+ throw ExceptionFactory.makeWebServiceException(ioe);
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/metadata/registry/MetadataFactoryRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/metadata/registry/MetadataFactoryRegistry.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/metadata/registry/MetadataFactoryRegistry.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/metadata/registry/MetadataFactoryRegistry.java Tue Jan 15 08:21:22 2008
@@ -28,6 +28,8 @@
import org.apache.axis2.jaxws.ClientConfigurationFactory;
import org.apache.axis2.jaxws.util.ClassLoaderUtils;
import org.apache.axis2.jaxws.util.Constants;
+import org.apache.axis2.jaxws.wsdl.WSDLReaderConfigurator;
+import org.apache.axis2.jaxws.wsdl.WSDLReaderConfiguratorImpl;
import org.apache.axis2.metadata.factory.ResourceFinderFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -43,6 +45,7 @@
table = new Hashtable<Class,Object>();
table.put(ResourceFinderFactory.class, new ResourceFinderFactory());
table.put(ClientConfigurationFactory.class, new ClientConfigurationFactory());
+ table.put(WSDLReaderConfigurator.class, new WSDLReaderConfiguratorImpl());
if(configurationFileLoc == null) {
if(log.isDebugEnabled()) {
log.debug("A configuration file location was not set. The " +
@@ -87,7 +90,7 @@
private static void loadConfigFromFile() {
String pairSeparator = "|";
try {
- ClassLoader classLoader = ClassLoaderUtils.getContextClassLoader();
+ ClassLoader classLoader = ClassLoaderUtils.getContextClassLoader(null);
URL url = null;
url = classLoader.getResource(configurationFileLoc);
if(url == null) {
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationProviderImplDescriptionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationProviderImplDescriptionTests.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationProviderImplDescriptionTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationProviderImplDescriptionTests.java Tue Jan 15 08:21:22 2008
@@ -19,7 +19,7 @@
package org.apache.axis2.jaxws.description;
-import junit.framework.TestCase;
+import org.apache.axis2.jaxws.description.builder.MDQConstants;
import org.apache.log4j.BasicConfigurator;
import javax.jws.WebService;
@@ -32,6 +32,8 @@
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceProvider;
+import junit.framework.TestCase;
+
public class AnnotationProviderImplDescriptionTests extends TestCase {
static {
// Note you will probably need to increase the java heap size, for example
@@ -66,6 +68,34 @@
assertEquals("BasicProviderTestImplPort", testEndpointDesc.getAnnoWebServicePortName());
assertEquals("http://description.jaxws.axis2.apache.org/",
testEndpointDesc.getAnnoWebServiceTargetNamespace());
+
+ }
+
+ public void testBasicProviderWithJMS() {
+ // Use the description factory directly; this will be done within the JAX-WS runtime
+ ServiceDescription serviceDesc =
+ DescriptionFactory.createServiceDescription(BasicProviderJMSTestImpl.class);
+ assertNotNull(serviceDesc);
+
+ EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
+ assertNotNull(endpointDesc);
+ assertEquals(1, endpointDesc.length);
+
+ // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
+ EndpointDescriptionJava testEndpointDesc = (EndpointDescriptionJava)endpointDesc[0];
+ assertNotNull(testEndpointDesc);
+ assertEquals(Service.Mode.MESSAGE, testEndpointDesc.getAnnoServiceModeValue());
+ assertEquals(MDQConstants.SOAP12JMS_BINDING,
+ testEndpointDesc.getAnnoBindingTypeValue());
+
+ // The WebServiceProvider annotation specified no values on it.
+ // TODO: When the Description package changes to provide default values when no annotation present, this may need to change.
+ assertEquals("", testEndpointDesc.getAnnoWebServiceWSDLLocation());
+ assertEquals("BasicProviderJMSTestImplService",
+ testEndpointDesc.getAnnoWebServiceServiceName());
+ assertEquals("BasicProviderJMSTestImplPort", testEndpointDesc.getAnnoWebServicePortName());
+ assertEquals("http://description.jaxws.axis2.apache.org/",
+ testEndpointDesc.getAnnoWebServiceTargetNamespace());
}
public void testWebServiceProvider() {
@@ -90,6 +120,30 @@
assertEquals("ProviderServicePort", testEndpointDesc.getAnnoWebServicePortName());
assertEquals("http://namespace.test", testEndpointDesc.getAnnoWebServiceTargetNamespace());
}
+
+ public void testWebServiceProviderWithJMS() {
+ // Use the description factory directly; this will be done within the JAX-WS runtime
+ ServiceDescription serviceDesc =
+ DescriptionFactory.createServiceDescription(WebServiceProviderJMSTestImpl.class);
+ assertNotNull(serviceDesc);
+
+ EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
+ assertNotNull(endpointDesc);
+ assertEquals(1, endpointDesc.length);
+
+ // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
+ EndpointDescriptionJava testEndpointDesc = (EndpointDescriptionJava)endpointDesc[0];
+ assertNotNull(testEndpointDesc);
+ assertEquals(Service.Mode.PAYLOAD, testEndpointDesc.getAnnoServiceModeValue());
+ assertEquals(MDQConstants.SOAP12JMS_BINDING,
+ testEndpointDesc.getAnnoBindingTypeValue());
+
+ assertEquals("http://wsdl.test", testEndpointDesc.getAnnoWebServiceWSDLLocation());
+ assertEquals("ProviderService", testEndpointDesc.getAnnoWebServiceServiceName());
+ assertEquals("ProviderServicePort", testEndpointDesc.getAnnoWebServicePortName());
+ assertEquals("http://namespace.test", testEndpointDesc.getAnnoWebServiceTargetNamespace());
+ }
+
public void testDefaultServiceModeProvider() {
// Use the description factory directly; this will be done within the JAX-WS runtime
@@ -174,37 +228,70 @@
}
}
-// ===============================================
-// Basic Provider service implementation class
-// ===============================================
+//===============================================
+//Basic Provider service implementation class
+//===============================================
@ServiceMode(value = Service.Mode.MESSAGE)
@WebServiceProvider()
@BindingType(value = "http://www.w3.org/2003/05/soap/bindings/HTTP/")
class BasicProviderTestImpl implements Provider<SOAPMessage> {
- public BasicProviderTestImpl() {
- }
+ public BasicProviderTestImpl() {
+ }
- public SOAPMessage invoke(SOAPMessage obj) {
- return null;
- }
+ public SOAPMessage invoke(SOAPMessage obj) {
+ return null;
+ }
+}
+
+//===============================================
+//Basic Provider service implementation class using SOAP/JMS
+//===============================================
+
+@ServiceMode(value = Service.Mode.MESSAGE)
+@WebServiceProvider()
+@BindingType(MDQConstants.SOAP12JMS_BINDING)
+class BasicProviderJMSTestImpl implements Provider<SOAPMessage> {
+ public BasicProviderJMSTestImpl() {
+ }
+
+ public SOAPMessage invoke(SOAPMessage obj) {
+ return null;
+ }
}
-// ===============================================
-// WebServiceProvider service implementation class
-// ===============================================
+//===============================================
+//WebServiceProvider service implementation class
+//===============================================
@ServiceMode(value = Service.Mode.PAYLOAD)
@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderServicePort",
- targetNamespace = "http://namespace.test", wsdlLocation = "http://wsdl.test")
+ targetNamespace = "http://namespace.test", wsdlLocation = "http://wsdl.test")
@BindingType(value = "http://www.w3.org/2003/05/soap/bindings/HTTP/")
class WebServiceProviderTestImpl implements Provider<String> {
- public WebServiceProviderTestImpl() {
- }
+ public WebServiceProviderTestImpl() {
+ }
- public String invoke(String obj) {
- return null;
- }
+ public String invoke(String obj) {
+ return null;
+ }
+}
+
+//===============================================
+//WebServiceProvider service implementation class
+//===============================================
+
+@ServiceMode(value = Service.Mode.PAYLOAD)
+@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderServicePort",
+ targetNamespace = "http://namespace.test", wsdlLocation = "http://wsdl.test")
+@BindingType(MDQConstants.SOAP12JMS_BINDING)
+class WebServiceProviderJMSTestImpl implements Provider<String> {
+ public WebServiceProviderJMSTestImpl() {
+ }
+
+ public String invoke(String obj) {
+ return null;
+ }
}
// ===============================================
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplWithDBCTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplWithDBCTests.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplWithDBCTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplWithDBCTests.java Tue Jan 15 08:21:22 2008
@@ -27,11 +27,18 @@
import org.apache.axis2.jaxws.description.builder.WebMethodAnnot;
import org.apache.axis2.jaxws.description.builder.WebParamAnnot;
import org.apache.axis2.jaxws.description.builder.WebServiceAnnot;
+import org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter;
import javax.jws.WebParam;
+import javax.jws.WebService;
import javax.xml.ws.WebServiceException;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* Tests the creation of the Description classes based on a service implementation bean and various
@@ -187,6 +194,98 @@
dbc.addMethodDescriptionComposite(mdc);
return dbc;
+ }
+
+ public void testLoadWSDLImpl() {
+ String wsdlLocation = getEchoMessageServiceWSDLLocation();
+
+ // Build up a DBC, including the WSDL Definition and the annotation information for
+ // the impl class.
+ JavaClassToDBCConverter converter = new JavaClassToDBCConverter(EchoMessageService.class);
+ HashMap<String, DescriptionBuilderComposite> dbcMap = converter.produceDBC();
+ assertNotNull(dbcMap);
+ DescriptionBuilderComposite dbc = dbcMap.get(EchoMessageService.class.getName());
+ assertNotNull(dbc);
+ dbc.setClassLoader(this.getClass().getClassLoader());
+
+ WebServiceAnnot webServiceAnnot = dbc.getWebServiceAnnot();
+ assertNotNull(webServiceAnnot);
+ webServiceAnnot.setWsdlLocation(wsdlLocation);
+ dbc.setWebServiceAnnot(webServiceAnnot);
+ dbcMap.put(EchoMessageService.class.getName(), dbc);
+
+ List<ServiceDescription> serviceDescList =
+ DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
+ assertEquals(1, serviceDescList.size());
+ ServiceDescription sd = serviceDescList.get(0);
+ assertNotNull(sd);
+
+ // make sure the WSDL definition was read in from the appropriate location
+ assertNotNull(((ServiceDescriptionWSDL) sd).getWSDLDefinition());
+ }
+
+ public void testLoadWSDLSEI() {
+ String wsdlLocation = getEchoMessageServiceWSDLLocation();
+
+ // Build up a DBC, including the WSDL Definition and the annotation information for
+ // the impl class.
+ JavaClassToDBCConverter converter = new JavaClassToDBCConverter(EchoMessageServiceSEI.class);
+ HashMap<String, DescriptionBuilderComposite> dbcMap = converter.produceDBC();
+ assertNotNull(dbcMap);
+ DescriptionBuilderComposite dbc = dbcMap.get(EchoMessageServiceSEI.class.getName());
+ assertNotNull(dbc);
+ DescriptionBuilderComposite seiDBC = dbcMap.get(EchoMessageServiceInterface.class.getName());
+ assertNotNull(seiDBC);
+ dbc.setClassLoader(this.getClass().getClassLoader());
+
+ WebServiceAnnot webServiceAnnot = seiDBC.getWebServiceAnnot();
+ assertNotNull(webServiceAnnot);
+ webServiceAnnot.setWsdlLocation(wsdlLocation);
+ seiDBC.setWebServiceAnnot(webServiceAnnot);
+ dbcMap.put(EchoMessageServiceInterface.class.getName(), seiDBC);
+
+ List<ServiceDescription> serviceDescList =
+ DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
+ assertEquals(1, serviceDescList.size());
+ ServiceDescription sd = serviceDescList.get(0);
+ assertNotNull(sd);
+
+ // make sure the WSDL definition was read in from the appropriate location
+ assertNotNull(((ServiceDescriptionWSDL) sd).getWSDLDefinition());
+ }
+
+ private String getEchoMessageServiceWSDLLocation() {
+ String loc = null;
+ String sep = java.io.File.separator;
+ loc = sep + "test-resources" + sep + "wsdl" + sep + "EchoMessageService.wsdl";
+ try {
+ String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+ loc = baseDir + loc;
+ }
+ catch(IOException ioe) {
+ ioe.printStackTrace();
+ }
+ return loc;
+ }
+
+ @WebService(serviceName = "EchoMessageService", portName = "EchoMessagePort", targetNamespace = "http://nonanonymous.complextype.test.org", wsdlLocation = "test-resources/wsdl/EchoMessageService.wsdl")
+ public class EchoMessageService {
+ public String echoMessage(String arg) {
+ return arg;
+ }
+ }
+
+ @WebService(serviceName = "EchoMessageService", endpointInterface=
+ "org.apache.axis2.jaxws.description.AnnotationServiceImplWithDBCTests$EchoMessageServiceInterface")
+ public class EchoMessageServiceSEI {
+ public String echoMessage(String arg) {
+ return arg;
+ }
+ }
+
+ @WebService(portName = "EchoMessagePort", targetNamespace = "http://nonanonymous.complextype.test.org", wsdlLocation = "test-resources/wsdl/EchoMessageService.wsdl")
+ public interface EchoMessageServiceInterface {
+ public String echoMessage(String arg);
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java Tue Jan 15 08:21:22 2008
@@ -20,9 +20,14 @@
package org.apache.axis2.jaxws.description;
+import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
+
import javax.wsdl.Definition;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.net.URL;
/**
@@ -40,12 +45,17 @@
return getWSDLURL("WSDLTests.wsdl");
}
+
+ static public String getWSDLLocation(String wsdlFileName) {
+ String basedir = System.getProperty("basedir", ".");
+ String urlString = "file://localhost/" + basedir + "/test-resources/wsdl/" + wsdlFileName;
+ return urlString;
+ }
static public URL getWSDLURL(String wsdlFileName) {
URL wsdlURL = null;
+ String urlString = getWSDLLocation(wsdlFileName);
// Get the URL to the WSDL file. Note that 'basedir' is setup by Maven
- String basedir = System.getProperty("basedir", ".");
- String urlString = "file://localhost/" + basedir + "/test-resources/wsdl/" + wsdlFileName;
try {
wsdlURL = new URL(urlString);
} catch (Exception e) {
@@ -71,4 +81,32 @@
return wsdlDefinition;
}
+ static public DescriptionBuilderComposite getServiceDescriptionComposite(ServiceDescription svcDesc) {
+ DescriptionBuilderComposite returnComposite = null;
+ // Need to get the composite off the implementation using the getter method, but it is all
+ // packaged protected and not part of the interface.
+ try {
+ Method getComposite = svcDesc.getClass().getDeclaredMethod("getDescriptionBuilderComposite");
+ getComposite.setAccessible(true);
+ returnComposite = (DescriptionBuilderComposite) getComposite.invoke(svcDesc, null);
+ } catch (SecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return returnComposite;
+ }
+
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java Tue Jan 15 08:21:22 2008
@@ -70,7 +70,7 @@
descriptionBuilderComposite.setWebServiceAnnot(webServiceAnnotImpl2);
- WebServiceAnnot webServiceAnnotImpl3 =
+ WebService webServiceAnnotImpl3 =
descriptionBuilderComposite.getWebServiceAnnot();
assertNotNull("WebService name not set", webServiceAnnotImpl3.name());
@@ -105,7 +105,7 @@
descriptionBuilderComposite.setWebServiceProviderAnnot(webServiceProviderAnnot);
- WebServiceProviderAnnot webServiceProviderAnnot3 =
+ javax.xml.ws.WebServiceProvider webServiceProviderAnnot3 =
descriptionBuilderComposite.getWebServiceProviderAnnot();
assertEquals("WebServiceProvider port name not set properly",
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/builder/converter/ReflectiveConverterTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/builder/converter/ReflectiveConverterTests.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/builder/converter/ReflectiveConverterTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/builder/converter/ReflectiveConverterTests.java Tue Jan 15 08:21:22 2008
@@ -60,7 +60,7 @@
public static void testCreateImplDBC() {
assertNotNull(implDBC);
- WebServiceAnnot wsAnnot = implDBC.getWebServiceAnnot();
+ WebService wsAnnot = implDBC.getWebServiceAnnot();
assertNotNull(wsAnnot);
assertEquals("SimpleService", wsAnnot.serviceName());
}
@@ -114,7 +114,7 @@
public static void testCreateSEIDBC() {
assertNotNull(seiDBC);
- WebServiceAnnot wsAnnot = seiDBC.getWebServiceAnnot();
+ WebService wsAnnot = seiDBC.getWebServiceAnnot();
assertNotNull(wsAnnot);
assertEquals("SimpleServicePort", wsAnnot.name());
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java Tue Jan 15 08:21:22 2008
@@ -131,8 +131,10 @@
DescriptionFactoryImpl.clearServiceDescriptionCache(null);
} finally {
- // restore old factory
+ // restore old factory by updating the registry THEN clearing the cached factory
+ // so it is retrieved from the table again.
MetadataFactoryRegistry.setFactory(ClientConfigurationFactory.class, oldFactory);
+ resetClientConfigFactory();
}
}
@@ -147,7 +149,7 @@
SampleAnnotationProcessor saProcessor = new SampleAnnotationProcessor();
saProcessor.setAnnotationInstanceClassName(sampleAnnotation.getClass().getName());
dbc.addCustomAnnotationProcessor(saProcessor);
- WebServiceAnnot webService = dbc.getWebServiceAnnot();
+ WebService webService = dbc.getWebServiceAnnot();
assertNotNull(webService);
String pn = webService.portName();
String tns = webService.targetNamespace();
@@ -238,7 +240,7 @@
if (context == null) {
context = super.getClientConfigurationContext();
}
- System.out.println(context);
+ System.out.println("Test version of CachingClientContextFactory: " + context);
return context;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/metadata/registry/MetadataFactoryRegistryTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/metadata/registry/MetadataFactoryRegistryTests.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/metadata/registry/MetadataFactoryRegistryTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/test/org/apache/axis2/metadata/registry/MetadataFactoryRegistryTests.java Tue Jan 15 08:21:22 2008
@@ -2,6 +2,11 @@
import java.io.File;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.apache.axis2.jaxws.wsdl.WSDLReaderConfigurator;
+
import junit.framework.TestCase;
@@ -25,6 +30,32 @@
assertNotNull(obj);
assertEquals(obj.getClass().getName(), TestImplementation.class.getName());
}
+ }
+
+ public void testRegisterWSDLReaderConfigurator() {
+ Exception e = null;
+ WSDLReader reader = null;
+ try {
+ WSDLFactory factory = WSDLFactory.newInstance();
+ reader = factory.newWSDLReader();
+ }
+ catch(Exception e2) {
+ e.printStackTrace();
+ e = e2;
+ }
+ assertNull(e);
+ assertNotNull(reader);
+ WSDLReaderConfigurator configurator = (WSDLReaderConfigurator) MetadataFactoryRegistry.
+ getFactory(WSDLReaderConfigurator.class);
+ assertNotNull(configurator);
+ try {
+ configurator.configureReaderInstance(reader);
+ }
+ catch(Exception e2) {
+ e = e2;
+ }
+ assertNull(e);
+ assertEquals(reader.getFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE), false);
}
// This interface class will be used to test the file based registration
Modified: webservices/axis2/branches/java/jaxws21/modules/mex/src/org/apache/axis2/mex/MetadataExchangeModule.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/mex/src/org/apache/axis2/mex/MetadataExchangeModule.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/mex/src/org/apache/axis2/mex/MetadataExchangeModule.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/mex/src/org/apache/axis2/mex/MetadataExchangeModule.java Tue Jan 15 08:21:22 2008
@@ -38,7 +38,9 @@
private static final Log log = LogFactory.getLog(MetadataExchangeModule.class);
public void engageNotify(AxisDescription axisDescription) throws AxisFault {
- log.info("metadataExchange module has been engaged to Service." );
+ if(log.isDebugEnabled()){
+ log.debug("metadataExchange module has been engaged to Service." );
+ }
}
public void init(ConfigurationContext configContext, AxisModule module)
Modified: webservices/axis2/branches/java/jaxws21/modules/parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/parent/pom.xml?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/parent/pom.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/parent/pom.xml Tue Jan 15 08:21:22 2008
@@ -150,6 +150,9 @@
<unsubscribe>axis-dev-unsubscribe@ws.apache.org</unsubscribe>
<post>axis-dev@ws.apache.org</post>
<archive>http://marc.theaimsgroup.com/?l=axis-dev</archive>
+ <otherArchives>
+ <otherArchive>http://markmail.org/search/list:org.apache.ws.axis-dev</otherArchive>
+ </otherArchives>
</mailingList>
<mailingList>
<name>Axis User List</name>
@@ -157,6 +160,16 @@
<unsubscribe>axis-user-unsubscribe@ws.apache.org</unsubscribe>
<post>axis-user@ws.apache.org</post>
<archive>http://marc.theaimsgroup.com/?l=axis-user</archive>
+ <otherArchives>
+ <otherArchive>http://markmail.org/search/list:org.apache.ws.axis-user</otherArchive>
+ </otherArchives>
+ </mailingList>
+ <mailingList>
+ <name>CVS Commit Message List</name>
+ <subscribe>axis-cvs-subscribe@ws.apache.org</subscribe>
+ <unsubscribe>axis-cvs-unsubscribe@ws.apache.org</unsubscribe>
+ <post>axis-cvs@ws.apache.org</post>
+ <archive>http://markmail.org/search/list:org.apache.ws.axis-cvs</archive>
</mailingList>
</mailingLists>
<developers>
Modified: webservices/axis2/branches/java/jaxws21/modules/rmi/src/org/apache/axis2/rmi/custombeans/DomElementBean.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/rmi/src/org/apache/axis2/rmi/custombeans/DomElementBean.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/rmi/src/org/apache/axis2/rmi/custombeans/DomElementBean.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/rmi/src/org/apache/axis2/rmi/custombeans/DomElementBean.java Tue Jan 15 08:21:22 2008
@@ -181,7 +181,7 @@
serializeDomElement((Element) node, writer, namespacePrefix);
} else if (node instanceof Text) {
textNode = (Text) node;
- writer.writeCharacters(textNode.getWholeText());
+ writer.writeCharacters(textNode.getNodeValue());
} else {
throw new XmlSerializingException("Unknown dom element node found node type ==>"
+ node.getNodeType());
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org