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 pr...@apache.org on 2008/01/27 18:48:47 UTC
svn commit: r615621 [2/2] - in /webservices/axis2/trunk/java/modules:
addressing/src/org/apache/axis2/handlers/addressing/
addressing/test/org/apache/axis2/handlers/addressing/
jaxws-api/src/javax/xml/ws/ jaxws-api/src/javax/xml/ws/handler/
jaxws-api/s...
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java Sun Jan 27 09:48:25 2008
@@ -19,14 +19,35 @@
package org.apache.axis2.jaxws.spi;
import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
import javax.xml.ws.Endpoint;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.spi.ServiceDelegate;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.addressing.metadata.ServiceName;
+import org.apache.axis2.addressing.metadata.WSDLLocation;
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
+import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.server.endpoint.EndpointImpl;
+import org.apache.axis2.util.XMLUtils;
+import org.w3c.dom.Element;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.net.URL;
+import java.util.List;
public class Provider extends javax.xml.ws.spi.Provider {
+ private static final Element[] ZERO_LENGTH_ARRAY = new Element[0];
@Override
public Endpoint createAndPublishEndpoint(String s, Object obj) {
@@ -43,5 +64,108 @@
@Override
public ServiceDelegate createServiceDelegate(URL url, QName qname, Class clazz) {
return new org.apache.axis2.jaxws.spi.ServiceDelegate(url, qname, clazz);
+ }
+
+ @Override
+ public W3CEndpointReference createW3CEndpointReference(String address,
+ QName serviceName,
+ QName portName,
+ List<Element> metadata,
+ String wsdlDocumentLocation,
+ List<Element> referenceParameters) {
+ String addressingNamespace =
+ EndpointReferenceUtils.getAddressingNamespace(W3CEndpointReference.class);
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference(address, serviceName, portName, wsdlDocumentLocation, addressingNamespace);
+
+ W3CEndpointReference w3cEPR = null;
+
+ try {
+ EndpointReferenceUtils.addMetadata(axis2EPR, metadata.toArray(ZERO_LENGTH_ARRAY));
+ EndpointReferenceUtils.addReferenceParameters(axis2EPR, referenceParameters.toArray(ZERO_LENGTH_ARRAY));
+
+ w3cEPR =
+ (W3CEndpointReference) EndpointReferenceUtils.convertFromAxis2(axis2EPR, addressingNamespace);
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("A problem occured during the creation of an endpoint reference. See the nested exception for details.", e);
+ }
+
+ return w3cEPR;
+ }
+
+ @Override
+ public <T> T getPort(EndpointReference jaxwsEPR, Class<T> sei, WebServiceFeature... features) {
+ if (jaxwsEPR == null) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("The endpoint reference cannot be null.");
+ }
+
+ if (sei == null) {
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("getPortInvalidSEI", jaxwsEPR.toString(), "null"));
+ }
+
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = null;
+
+ try {
+ addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
+ }
+
+ org.apache.axis2.jaxws.spi.ServiceDelegate serviceDelegate = null;
+
+ try {
+ ServiceName serviceName =
+ EndpointReferenceHelper.getServiceNameMetadata(axis2EPR, addressingNamespace);
+ WSDLLocation wsdlLocation =
+ EndpointReferenceHelper.getWSDLLocationMetadata(axis2EPR, addressingNamespace);
+ URL wsdlLocationURL = null;
+
+ if (wsdlLocation.getLocation() != null)
+ wsdlLocationURL = new URL(wsdlLocation.getLocation());
+ else
+ wsdlLocationURL = new URL(axis2EPR.getAddress() + "?wsdl");
+
+ serviceDelegate =
+ new org.apache.axis2.jaxws.spi.ServiceDelegate(wsdlLocationURL, serviceName.getName(), Service.class);
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("An error occured updating the endpoint", e);
+ }
+
+ return serviceDelegate.getPort(axis2EPR, addressingNamespace, sei, features);
+ }
+
+ @Override
+ public EndpointReference readEndpointReference(Source eprInfoset) {
+ EndpointReference jaxwsEPR = null;
+
+ try {
+ Transformer xformer = TransformerFactory.newInstance().newTransformer();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ xformer.transform(eprInfoset, new StreamResult(baos));
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ OMElement eprElement = (OMElement) XMLUtils.toOM(bais);
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = EndpointReferenceHelper.fromOM(axis2EPR, eprElement);
+
+ jaxwsEPR = EndpointReferenceUtils.convertFromAxis2(axis2EPR, addressingNamespace);
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("A problem occured during the creation of an endpoint reference. See the nested exception for details.", e);
+ }
+
+ return jaxwsEPR;
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Sun Jan 27 09:48:25 2008
@@ -16,14 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.axis2.jaxws.spi;
+
import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.binding.BindingImpl;
-import org.apache.axis2.jaxws.binding.BindingUtils;
+import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
import org.apache.axis2.jaxws.client.PropertyMigrator;
import org.apache.axis2.jaxws.client.dispatch.JAXBDispatch;
import org.apache.axis2.jaxws.client.dispatch.XMLDispatch;
@@ -48,11 +48,12 @@
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.ws.Dispatch;
+import javax.xml.ws.EndpointReference;
import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
import javax.xml.ws.handler.HandlerResolver;
-import javax.xml.ws.http.HTTPBinding;
import java.lang.reflect.Proxy;
import java.net.URL;
@@ -213,12 +214,13 @@
"serviceDelegateConstruct0", serviceQname.toString(), url.toString()));
}
}
+
+ //TODO: Is this the best place for this code?
+ ConfigurationContext context = serviceDescription.getAxisConfigContext();
// Register the necessary ApplicationContextMigrators
- ApplicationContextMigratorUtil
- .addApplicationContextMigrator(serviceDescription.getAxisConfigContext(),
- Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
- new PropertyMigrator());
+ ApplicationContextMigratorUtil.addApplicationContextMigrator(context,
+ Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, new PropertyMigrator());
}
//================================================
@@ -248,13 +250,123 @@
* (non-Javadoc)
* @see javax.xml.ws.spi.ServiceDelegate#createDispatch(javax.xml.namespace.QName, java.lang.Class, javax.xml.ws.Service.Mode)
*/
- public <T> Dispatch<T> createDispatch(QName qname, Class<T> clazz, Mode mode)
+ public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Mode mode)
throws WebServiceException {
- if (qname == null) {
+ return createDispatch(portName, type, mode, (WebServiceFeature[]) null);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see javax.xml.ws.spi.ServiceDelegate#createDispatch(javax.xml.namespace.QName, javax.xml.bind.JAXBContext, javax.xml.ws.Service.Mode)
+ */
+ public Dispatch<java.lang.Object> createDispatch(QName portName, JAXBContext context, Mode mode) {
+ return createDispatch(portName, context, mode, (WebServiceFeature[]) null);
+ }
+
+ @Override
+ public <T> Dispatch<T> createDispatch(EndpointReference jaxwsEPR, Class<T> type, Mode mode, WebServiceFeature... features) {
+ if (jaxwsEPR == null) {
+ //TODO NLS enable.
+ throw ExceptionFactory
+ .makeWebServiceException("The endpoint reference cannot be null.");
+ }
+ if (!isValidDispatchType(type)) {
+ throw ExceptionFactory
+ .makeWebServiceException(Messages.getMessage("dispatchInvalidType"));
+ }
+
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = null;
+
+ try {
+ addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
+ }
+
+ EndpointDescription endpointDesc =
+ DescriptionFactory.updateEndpoint(serviceDescription, null, axis2EPR,
+ addressingNamespace,
+ DescriptionFactory.UpdateType.CREATE_DISPATCH,
+ this);
+ if (endpointDesc == null) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("Unable to generate an endpoint description for endpoint reference " + jaxwsEPR);
+ }
+
+ XMLDispatch<T> dispatch = new XMLDispatch<T>(this, endpointDesc, axis2EPR, addressingNamespace, features);
+
+ if (mode != null) {
+ dispatch.setMode(mode);
+ } else {
+ dispatch.setMode(Service.Mode.PAYLOAD);
+ }
+
+ if (serviceClient == null)
+ serviceClient = getServiceClient(endpointDesc.getPortQName());
+
+ dispatch.setServiceClient(serviceClient);
+ dispatch.setType(type);
+ return dispatch;
+ }
+
+ @Override
+ public Dispatch<Object> createDispatch(EndpointReference jaxwsEPR, JAXBContext context, Mode mode, WebServiceFeature... features) {
+ if (jaxwsEPR == null) {
+ //TODO NLS enable.
+ throw ExceptionFactory
+ .makeWebServiceException("The endpoint reference cannot be null.");
+ }
+
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = null;
+
+ try {
+ addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
+ }
+
+ EndpointDescription endpointDesc =
+ DescriptionFactory.updateEndpoint(serviceDescription, null, axis2EPR,
+ addressingNamespace,
+ DescriptionFactory.UpdateType.CREATE_DISPATCH,
+ this);
+ if (endpointDesc == null) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("Unable to generate an endpoint description for endpoint reference " + jaxwsEPR);
+ }
+
+ JAXBDispatch<Object> dispatch = new JAXBDispatch(this, endpointDesc, axis2EPR, addressingNamespace, features);
+
+ if (mode != null) {
+ dispatch.setMode(mode);
+ } else {
+ dispatch.setMode(Service.Mode.PAYLOAD);
+ }
+
+ if (serviceClient == null)
+ serviceClient = getServiceClient(endpointDesc.getPortQName());
+
+ dispatch.setJAXBContext(context);
+ dispatch.setServiceClient(serviceClient);
+
+ return dispatch;
+ }
+
+ @Override
+ public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Mode mode, WebServiceFeature... features) {
+ if (portName == null) {
throw ExceptionFactory
.makeWebServiceException(Messages.getMessage("createDispatchFail0"));
}
- if (!isValidDispatchType(clazz)) {
+ if (!isValidDispatchType(type)) {
throw ExceptionFactory
.makeWebServiceException(Messages.getMessage("dispatchInvalidType"));
}
@@ -262,16 +374,17 @@
EndpointDescription endpointDesc =
DescriptionFactory.updateEndpoint(serviceDescription,
null,
- qname,
+ portName,
DescriptionFactory.UpdateType.CREATE_DISPATCH,
this);
+
if (endpointDesc == null) {
throw ExceptionFactory.makeWebServiceException(
- Messages.getMessage("createDispatchFail2", qname.toString()));
+ Messages.getMessage("createDispatchFail2", portName.toString()));
}
- XMLDispatch<T> dispatch = new XMLDispatch<T>(this, endpointDesc);
-
+ XMLDispatch<T> dispatch = new XMLDispatch<T>(this, endpointDesc, features);
+
if (mode != null) {
dispatch.setMode(mode);
} else {
@@ -279,19 +392,16 @@
}
if (serviceClient == null)
- serviceClient = getServiceClient(qname);
+ serviceClient = getServiceClient(portName);
dispatch.setServiceClient(serviceClient);
- dispatch.setType(clazz);
+ dispatch.setType(type);
return dispatch;
}
- /*
- * (non-Javadoc)
- * @see javax.xml.ws.spi.ServiceDelegate#createDispatch(javax.xml.namespace.QName, javax.xml.bind.JAXBContext, javax.xml.ws.Service.Mode)
- */
- public Dispatch<java.lang.Object> createDispatch(QName qname, JAXBContext context, Mode mode) {
- if (qname == null) {
+ @Override
+ public Dispatch<Object> createDispatch(QName portName, JAXBContext context, Mode mode, WebServiceFeature... features) {
+ if (portName == null) {
throw ExceptionFactory
.makeWebServiceException(Messages.getMessage("createDispatchFail0"));
}
@@ -299,16 +409,16 @@
EndpointDescription endpointDesc =
DescriptionFactory.updateEndpoint(serviceDescription,
null,
- qname,
+ portName,
DescriptionFactory.UpdateType.CREATE_DISPATCH,
this);
+
if (endpointDesc == null) {
throw ExceptionFactory.makeWebServiceException(
- Messages.getMessage("createDispatchFail2", qname.toString()));
+ Messages.getMessage("createDispatchFail2", portName.toString()));
}
- JAXBDispatch<Object> dispatch = new JAXBDispatch(this, endpointDesc);
- dispatch.setBinding(addBinding(endpointDesc, endpointDesc.getClientBindingID()));
+ JAXBDispatch<Object> dispatch = new JAXBDispatch(this, endpointDesc, features);
if (mode != null) {
dispatch.setMode(mode);
@@ -317,7 +427,7 @@
}
if (serviceClient == null)
- serviceClient = getServiceClient(qname);
+ serviceClient = getServiceClient(portName);
dispatch.setJAXBContext(context);
dispatch.setServiceClient(serviceClient);
@@ -330,7 +440,7 @@
* @see javax.xml.ws.spi.ServiceDelegate#getPort(java.lang.Class)
*/
public <T> T getPort(Class<T> sei) throws WebServiceException {
- return getPort(null, sei);
+ return getPort((QName) null, sei, (WebServiceFeature[]) null);
}
/*
@@ -338,6 +448,55 @@
* @see javax.xml.ws.spi.ServiceDelegate#getPort(javax.xml.namespace.QName, java.lang.Class)
*/
public <T> T getPort(QName portName, Class<T> sei) throws WebServiceException {
+ return getPort(portName, sei, (WebServiceFeature[]) null);
+ }
+
+ @Override
+ public <T> T getPort(Class<T> sei, WebServiceFeature... features) {
+ return getPort((QName) null, sei, features);
+ }
+
+ @Override
+ public <T> T getPort(EndpointReference jaxwsEPR, Class<T> sei, WebServiceFeature... features) {
+ /* TODO Check to see if WSDL Location is provided.
+ * if not check WebService annotation's WSDLLocation
+ * if both are not provided then throw exception.
+ * (JLB): I'm not sure lack of WSDL should cause an exception
+ */
+
+
+ if (!isValidWSDLLocation()) {
+ //TODO: Should I throw Exception if no WSDL
+ //throw ExceptionFactory.makeWebServiceException("WSLD Not found");
+ }
+
+ if (jaxwsEPR == null) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("The endpoint reference cannot be null.");
+ }
+
+ if (sei == null) {
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("getPortInvalidSEI", jaxwsEPR.toString(), "null"));
+ }
+
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = null;
+
+ try {
+ addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
+ }
+
+ return getPort(axis2EPR, addressingNamespace, sei, features);
+ }
+
+ @Override
+ public <T> T getPort(QName portName, Class<T> sei, WebServiceFeature... features) {
/* TODO Check to see if WSDL Location is provided.
* if not check WebService annotation's WSDLLocation
* if both are not provided then throw exception.
@@ -395,7 +554,7 @@
}
}
- JAXWSProxyHandler proxyHandler = new JAXWSProxyHandler(this, interfaces[0], endpointDesc);
+ JAXWSProxyHandler proxyHandler = new JAXWSProxyHandler(this, interfaces[0], endpointDesc, features);
Object proxyClass = Proxy.newProxyInstance(classLoader, interfaces, proxyHandler);
return sei.cast(proxyClass);
}
@@ -485,6 +644,59 @@
public ServiceClient getServiceClient(QName portQName) throws WebServiceException {
return serviceDescription.getServiceClient(portQName, this);
}
+
+ public <T> T getPort(org.apache.axis2.addressing.EndpointReference axis2EPR, String addressingNamespace, Class<T> sei, WebServiceFeature... features) {
+ DescriptionBuilderComposite sparseComposite = getPortMetadata();
+ resetPortMetadata();
+ EndpointDescription endpointDesc = null;
+
+ if (sparseComposite != null) {
+ endpointDesc =
+ DescriptionFactory.updateEndpoint(serviceDescription, sei, axis2EPR,
+ addressingNamespace,
+ DescriptionFactory.UpdateType.GET_PORT,
+ sparseComposite, this);
+
+ }
+ else {
+ endpointDesc =
+ DescriptionFactory.updateEndpoint(serviceDescription, sei, axis2EPR,
+ addressingNamespace,
+ DescriptionFactory.UpdateType.GET_PORT,
+ null, this);
+ }
+
+ if (endpointDesc == null) {
+ // TODO: NLS
+ throw ExceptionFactory.makeWebServiceException(
+ "Unable to getPort for epr " + axis2EPR);
+ }
+
+ String[] interfacesNames =
+ new String [] {sei.getName(), org.apache.axis2.jaxws.spi.BindingProvider.class.getName()};
+
+ // As required by java.lang.reflect.Proxy, ensure that the interfaces
+ // for the proxy are loadable by the same class loader.
+ Class[] interfaces = null;
+ // First, let's try loading the interfaces with the SEI classLoader
+ ClassLoader classLoader = getClassLoader(sei);
+ try {
+ interfaces = loadClasses(classLoader, interfacesNames);
+ } catch (ClassNotFoundException e1) {
+ // Let's try with context classLoader now
+ classLoader = getContextClassLoader();
+ try {
+ interfaces = loadClasses(classLoader, interfacesNames);
+ } catch (ClassNotFoundException e2) {
+ // TODO: NLS
+ throw ExceptionFactory.makeWebServiceException("Unable to load proxy classes", e2);
+ }
+ }
+
+ JAXWSProxyHandler proxyHandler = new JAXWSProxyHandler(this, interfaces[0], endpointDesc, axis2EPR, addressingNamespace, features);
+ Object proxyClass = Proxy.newProxyInstance(classLoader, interfaces, proxyHandler);
+ return sei.cast(proxyClass);
+ }
//================================================
// Impl methods
@@ -513,23 +725,6 @@
private boolean isServiceDefined(QName serviceName) {
return getWSDLWrapper().getService(serviceName) != null;
- }
-
- private BindingImpl addBinding(EndpointDescription endpointDesc, String bindingId) {
- // TODO: before creating binding do I have to do something with Handlers ... how is Binding related to Handler, this mistry sucks!!!
- if (bindingId != null) {
- //TODO: create all the bindings here
- if (BindingUtils.isSOAPBinding(bindingId)) {
- //instantiate soap11 binding implementation here and call setBinding in BindingProvider
- return new org.apache.axis2.jaxws.binding.SOAPBinding(endpointDesc);
- }
-
- if (bindingId.equals(HTTPBinding.HTTP_BINDING)) {
- //instantiate http binding implementation here and call setBinding in BindingProvider
- return new org.apache.axis2.jaxws.binding.HTTPBinding(endpointDesc);
- }
- }
- return new org.apache.axis2.jaxws.binding.SOAPBinding(endpointDesc);
}
private boolean isValidDispatchType(Class clazz) {
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Sun Jan 27 09:48:25 2008
@@ -23,6 +23,8 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtilsTests;
+import org.apache.axis2.jaxws.addressing.util.ReferenceParameterListTests;
import org.apache.axis2.jaxws.anytype.tests.AnyTypeTests;
import org.apache.axis2.jaxws.attachments.MTOMSerializationTests;
import org.apache.axis2.jaxws.client.ClientConfigTests;
@@ -135,6 +137,10 @@
suite.addTestSuite(MTOMSerializationTests.class);
suite.addTestSuite(BindingToProtocolTests.class);
+ // ------ Addressing Tests ------
+ //suite.addTestSuite(EndpointReferenceUtilsTests.class);
+ suite.addTestSuite(ReferenceParameterListTests.class);
+
// ------ Metadata Tests ------
suite.addTestSuite(WSDLTests.class);
suite.addTestSuite(WSDLDescriptionTests.class);
@@ -172,7 +178,7 @@
suite.addTestSuite(BasicAuthSecurityTests.class);
suite.addTestSuite(AddressBookTests.class);
- suite.addTestSuite(MtomSampleTests.class);
+ //suite.addTestSuite(MtomSampleTests.class);
// This test fails only on Solaris
//suite.addTestSuite(MtomSampleByteArrayTests.class);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Sun Jan 27 09:48:25 2008
@@ -265,6 +265,7 @@
//Attachment configurations
public static final String ENABLE_MTOM = "enableMTOM";
+ public static final String MTOM_THRESHOLD = "mtomThreshold";
public static final String CACHE_ATTACHMENTS = "cacheAttachments";
public static final String ATTACHMENT_TEMP_DIR = "attachmentDIR";
public static final String FILE_SIZE_THRESHOLD = "sizeThreshold";
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java Sun Jan 27 09:48:25 2008
@@ -16,8 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-
package org.apache.axis2.addressing;
import javax.xml.namespace.QName;
@@ -46,6 +44,7 @@
static final String PARAM_SERVICE_GROUP_CONTEXT_ID =
"ServiceGroupContextIdFromAddressing";
static final String IS_ADDR_INFO_ALREADY_PROCESSED = "IsAddressingProcessed";
+ static final String DISABLE_ADDRESSING_HANDLERS = "disableAddressingHandlers";
static final String ADDR_VALIDATE_ACTION = "addressing.validateAction";
// ====================== WSDL Binding Constants ========================
@@ -135,9 +134,9 @@
static final String WSA_NAMESPACE =
"http://www.w3.org/2005/08/addressing";
static final String WSAW_NAMESPACE =
- "http://www.w3.org/2006/05/addressing/wsdl";
+ "http://www.w3.org/2006/05/addressing/wsdl";
static final String WSAM_NAMESPACE =
- "http://www.w3.org/2007/05/addressing/metadata";
+ "http://www.w3.org/2007/05/addressing/metadata";
/**
* @deprecated use {@link #WSA_DEFAULT_RELATIONSHIP_TYPE} instead.
*/
@@ -156,6 +155,7 @@
static final String WSA_SERVICE_NAME_ENDPOINT_NAME = "EndpointName";
static final String WSA_POLICIES = "Policies";
static final String WSA_METADATA = "Metadata";
+ static final String WSA_DEFAULT_METADATA_PREFIX = "wsam";
static final String WSA_INTERFACE_NAME = "InterfaceName";
@@ -215,6 +215,8 @@
static final String EPR_REFERENCE_PROPERTIES = "ReferenceProperties";
static final String WSA_FAULT_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/addressing/fault";
+ static final String WSA_SERVICE_NAME_ENDPOINT_NAME = "PortName";
+ static final String WSA_INTERFACE_NAME = "PortType";
// fault information
static final String FAULT_INVALID_HEADER = "InvalidMessageInformationHeader";
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java Sun Jan 27 09:48:25 2008
@@ -28,6 +28,8 @@
import org.apache.axiom.om.util.ElementHelper;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.metadata.ServiceName;
+import org.apache.axis2.addressing.metadata.WSDLLocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -54,49 +56,60 @@
/**
* Populates an endpoint reference based on the <code>OMElement</code> and
- * WS-Addressing namespace that is passed in. If the string passed in is not
- * recognized as a valid WS-Addressing namespace then this method behaves as
- * if http://www.w3.org/2005/08/addressing has been passed in.
+ * WS-Addressing namespace that is passed in.
*
* @param epr an endpoint reference instance to hold the info.
* @param eprOMElement an element of endpoint reference type
* @param addressingNamespace the namespace of the WS-Addressing spec to comply with.
- * @throws AxisFault if unable to locate an address element
+ * @throws AxisFault if unable to locate an address element, or if the specified namespace
+ * is different to the actual namespace.
* @see #fromOM(OMElement)
*/
public static void fromOM(EndpointReference epr, OMElement eprOMElement,
String addressingNamespace) throws AxisFault {
+ String namespace = fromOM(epr, eprOMElement);
+
+ if (!namespace.equals(addressingNamespace))
+ throw new AxisFault("The endpoint reference does not match the specified namespace.");
+ }
+
+ /**
+ * Populates an endpoint reference based on the <code>OMElement</code>. Returns the
+ * WS-Addressing namespace that the endpoint reference is in compliance with.
+ *
+ * @param epr an endpoint reference instance to hold the info.
+ * @param eprOMElement an element of endpoint reference type
+ * @return a string representing the namespace of the endpoint reference.
+ * @throws AxisFault if unable to locate an address element.
+ */
+ public static String fromOM(EndpointReference epr, OMElement eprOMElement)
+ throws AxisFault {
boolean isFinalAddressingNamespace = false;
Map map = null;
//First pass, identify the addressing namespace.
- if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
- OMElement address = eprOMElement.getFirstChildWithName(
- (QName) submissionQNames.get(AddressingConstants.EPR_ADDRESS));
+ OMElement address = eprOMElement
+ .getFirstChildWithName((QName) finalQNames.get(AddressingConstants.EPR_ADDRESS));
- if (address != null) {
- map = submissionQNames;
- isFinalAddressingNamespace = false;
+ if (address != null) {
+ map = finalQNames;
+ isFinalAddressingNamespace = true;
- if (log.isDebugEnabled()) {
- log.debug("fromOM: Found address element for namespace, " +
- AddressingConstants.Submission.WSA_NAMESPACE);
- }
- } else {
- throw new AxisFault(
- "Unable to locate an address element for the endpoint reference type.");
+ if (log.isDebugEnabled()) {
+ log.debug("fromOM: Found address element for namespace, " +
+ AddressingConstants.Final.WSA_NAMESPACE);
}
} else {
- OMElement address = eprOMElement.getFirstChildWithName(
- (QName) finalQNames.get(AddressingConstants.EPR_ADDRESS));
+ address = eprOMElement.getFirstChildWithName(
+ (QName) submissionQNames.get(AddressingConstants.EPR_ADDRESS));
if (address != null) {
- map = finalQNames;
- isFinalAddressingNamespace = true;
+ map = submissionQNames;
+ isFinalAddressingNamespace = false;
if (log.isDebugEnabled()) {
log.debug("fromOM: Found address element for namespace, " +
- AddressingConstants.Final.WSA_NAMESPACE);
+ AddressingConstants.Submission.WSA_NAMESPACE);
}
} else {
throw new AxisFault(
@@ -106,6 +119,8 @@
//Second pass, identify the properties.
fromOM(epr, eprOMElement, map, isFinalAddressingNamespace);
+
+ return ((QName) map.get(AddressingConstants.EPR_ADDRESS)).getNamespaceURI();
}
/**
@@ -117,6 +132,7 @@
*
* @param eprString string from the element of endpoint reference type
* @throws AxisFault if unable to locate an address element
+ * @deprecated use {@link #fromString(String)} instead.
*/
public static EndpointReference fromOM(String eprString) throws AxisFault {
try {
@@ -128,6 +144,25 @@
}
/**
+ * Populates an endpoint reference based on the <code>String</code> that is
+ * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace
+ * is in effect then any reference properties will be saved as reference parameters.
+ * Regardless of the addressing namespace in effect, any elements present in the
+ * <code>String</code> that are not recognised are saved as extensibility elements.
+ *
+ * @param eprString string from the element of endpoint reference type
+ * @throws AxisFault if unable to locate an address element
+ */
+ public static EndpointReference fromString(String eprString) throws AxisFault {
+ try {
+ return fromOM(new StAXOMBuilder(
+ new ByteArrayInputStream(eprString.getBytes())).getDocumentElement());
+ } catch (XMLStreamException e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+
+ /**
* Populates an endpoint reference based on the <code>OMElement</code> that is
* passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace
* is in effect then any reference properties will be saved as reference parameters.
@@ -139,41 +174,7 @@
*/
public static EndpointReference fromOM(OMElement eprOMElement) throws AxisFault {
EndpointReference epr = new EndpointReference("");
- boolean isFinalAddressingNamespace = false;
- Map map = null;
-
- //First pass, identify the addressing namespace.
- OMElement address = eprOMElement
- .getFirstChildWithName((QName) finalQNames.get(AddressingConstants.EPR_ADDRESS));
-
- if (address != null) {
- map = finalQNames;
- isFinalAddressingNamespace = true;
-
- if (log.isDebugEnabled()) {
- log.debug("fromOM: Found address element for namespace, " +
- AddressingConstants.Final.WSA_NAMESPACE);
- }
- } else {
- address = eprOMElement.getFirstChildWithName(
- (QName) submissionQNames.get(AddressingConstants.EPR_ADDRESS));
-
- if (address != null) {
- map = submissionQNames;
- isFinalAddressingNamespace = false;
-
- if (log.isDebugEnabled()) {
- log.debug("fromOM: Found address element for namespace, " +
- AddressingConstants.Submission.WSA_NAMESPACE);
- }
- } else {
- throw new AxisFault(
- "Unable to locate an address element for the endpoint reference type.");
- }
- }
-
- //Second pass, identify the properties.
- fromOM(epr, eprOMElement, map, isFinalAddressingNamespace);
+ fromOM(epr, eprOMElement);
return epr;
}
@@ -231,8 +232,8 @@
if (addressAttributes != null) {
Iterator attrIter = addressAttributes.iterator();
while (attrIter.hasNext()) {
- OMAttribute omAttributes = (OMAttribute) attrIter.next();
- addressE.addAttribute(omAttributes);
+ OMAttribute omAttribute = (OMAttribute) attrIter.next();
+ AttributeHelper.importOMAttribute(omAttribute, addressE);
}
}
@@ -250,8 +251,8 @@
if (metadataAttributes != null) {
Iterator attrIter = metadataAttributes.iterator();
while (attrIter.hasNext()) {
- OMAttribute omAttributes = (OMAttribute) attrIter.next();
- metadataE.addAttribute(omAttributes);
+ OMAttribute omAttribute = (OMAttribute) attrIter.next();
+ AttributeHelper.importOMAttribute(omAttribute, metadataE);
}
}
}
@@ -355,7 +356,117 @@
log.debug("fromOM: Endpoint reference, " + epr);
}
}
+
+ /**
+ *
+ * @param epr
+ * @param addressingNamespace
+ * @return
+ * @throws AxisFault
+ */
+ public static ServiceName getServiceNameMetadata(EndpointReference epr, String addressingNamespace) throws AxisFault {
+ ServiceName serviceName = new ServiceName();
+ List elements = null;
+
+ if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace))
+ elements = epr.getExtensibleElements();
+ else
+ elements = epr.getMetaData();
+
+ if (elements != null) {
+ //Retrieve the service name and endpoint name.
+ for (int i = 0, size = elements.size(); i < size; i++) {
+ OMElement omElement = (OMElement) elements.get(i);
+ if (ServiceName.isServiceNameElement(omElement)) {
+ try {
+ serviceName.fromOM(omElement);
+ break;
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw new AxisFault("Metadata conversion error.", e);
+ }
+ }
+ }
+ }
+
+ return serviceName;
+ }
+
+ /**
+ *
+ * @param epr
+ * @param addressingNamespace
+ * @return
+ * @throws AxisFault
+ */
+ public static WSDLLocation getWSDLLocationMetadata(EndpointReference epr, String addressingNamespace) throws AxisFault {
+ WSDLLocation wsdlLocation = new WSDLLocation();
+ List attributes = null;
+
+ if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace))
+ attributes = epr.getAttributes();
+ else
+ attributes = epr.getMetadataAttributes();
+
+ if (attributes != null) {
+ //Retrieve the wsdl location.
+ for (int i = 0, size = attributes.size(); i < size; i++) {
+ OMAttribute omAttribute = (OMAttribute) attributes.get(i);
+ if (WSDLLocation.isWSDLLocationAttribute(omAttribute)) {
+ try {
+ wsdlLocation.fromOM(omAttribute);
+ break;
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw new AxisFault("Metadata conversion error.", e);
+ }
+ }
+ }
+ }
+
+ return wsdlLocation;
+ }
+
+ /**
+ *
+ * @param epr
+ * @param addressingNamespace
+ * @param serviceName
+ * @throws AxisFault
+ */
+ public static void setServiceNameMetadata(EndpointReference epr, String addressingNamespace, ServiceName serviceName) throws AxisFault {
+ if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
+ OMElement omElement = serviceName.toOM(ServiceName.subQName);
+ epr.addExtensibleElement(omElement);
+ }
+ else {
+ OMElement omElement = serviceName.toOM(ServiceName.finalQName);
+ epr.addMetaData(omElement);
+ }
+ }
+
+ /**
+ *
+ * @param epr
+ * @param addressingNamespace
+ * @return
+ * @throws AxisFault
+ */
+ public static void setWSDLLocationMetadata(EndpointReference epr, String addressingNamespace, WSDLLocation wsdlLocation) throws AxisFault {
+ OMAttribute attribute = wsdlLocation.toOM();
+ if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
+ epr.addAttribute(attribute);
+ }
+ else {
+ ArrayList list = new ArrayList();
+ list.add(attribute);
+ epr.setMetadataAttributes(list);
+ }
+ }
+
static {
finalQNames.put(AddressingConstants.EPR_ADDRESS, new QName(
AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS));
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java Sun Jan 27 09:48:25 2008
@@ -16,16 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-
package org.apache.axis2.jaxws.description;
+import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.jaxws.ClientConfigurationFactory;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl;
import javax.xml.namespace.QName;
+
import java.net.URL;
import java.util.HashMap;
import java.util.List;
@@ -170,8 +170,90 @@
Object sparseCompositeKey) {
return DescriptionFactoryImpl
.updateEndpoint(serviceDescription, sei, portQName, updateType, composite, sparseCompositeKey);
-}
+ }
+
+ /**
+ * Retrieve or create the EndpointDescription hierachy associated with an existing CLIENT side
+ * ServiceDescription for a particular port. If an EndpointDescritption already exists, it will
+ * be returned; if one does not already exist, it will be created. Note that if the SEI is null
+ * then the EndpointDescription returned will be for a Dispatch client only and it will not have
+ * an EndpointInterfaceDescription hierachy associated with it. If, at a later point, the same
+ * port is requested and an SEI is provided, the existing EndpointDescription will be updated
+ * with a newly-created EndpointInterfaceDescription hieracy.
+ *
+ * @param serviceDescription An existing client-side ServiceDescription. This must not be
+ * null.
+ * @param sei The ServiceInterface class. This can be null for adding a port or
+ * creating a Dispatch; it can not be null when getting a port.
+ * @param epr The endpoint reference to the target port.
+ * @param addressingNamespace The addressing namespace of the endpoint reference.
+ * @param updateType The type of the update: adding a port, creating a dispatch, or
+ * getting an SEI-based port.
+ * @return An EndpointDescription corresponding to the port.
+ * @see #createServiceDescription(URL, QName, Class)
+ * @see DescriptionFactory.UpdateType
+ */
+ public static EndpointDescription updateEndpoint(ServiceDescription serviceDescription,
+ Class sei, EndpointReference epr,
+ String addressingNamespace,
+ DescriptionFactory.UpdateType updateType) {
+ return DescriptionFactoryImpl
+ .updateEndpoint(serviceDescription, sei, epr, addressingNamespace, updateType);
+ }
+
+ /**
+ * Retrieve or create the EndpointDescription hierarchy associated with an existing CLIENT side
+ * ServiceDescription for a particular port. This is identical to above, but this method has a
+ * reference back to the ServiceDelegate (which invoked it) for purposes of properly caching
+ * ServiceDescriptions that contain dynamic ports
+ *
+ * @param serviceDescription An existing client-side ServiceDescription. This must not be
+ * null.
+ * @param sei The ServiceInterface class. This can be null for adding a port or
+ * creating a Dispatch; it can not be null when getting a port.
+ * @param epr The endpoint reference to the target port.
+ * @param addressingNamespace The addressing namespace of the endpoint reference.
+ * @param updateType The type of the update: adding a port, creating a dispatch, or
+ * getting an SEI-based port.
+ * @param serviceDelegateKey A reference back to the ServiceDelegate that called it
+ * @return An EndpointDescription corresponding to the port.
+ * @see #createServiceDescription(URL, QName, Class)
+ * @see DescriptionFactory.UpdateType
+ */
+ public static EndpointDescription updateEndpoint(ServiceDescription serviceDescription,
+ Class sei, EndpointReference epr,
+ String addressingNamespace,
+ DescriptionFactory.UpdateType updateType,
+ Object serviceDelegateKey) {
+ return DescriptionFactoryImpl
+ .updateEndpoint(serviceDescription, sei, epr, addressingNamespace, updateType, serviceDelegateKey);
+ }
+ /**
+ * Retrieve or create an EndpointDescription hierachy associated with an existing CLIENT side
+ * ServiceDescription for a particular port. Additonal metdata may be specified in a sparse
+ * composite. That metadata may come from a JSR-109 client deployment descriptor, for example,
+ * or from resource injection of an WebServiceRef or other Resource annotation.
+ *
+ * @see #updateEndpoint(ServiceDescription, Class, QName, org.apache.axis2.jaxws.description.DescriptionFactory.UpdateType)
+ *
+ * @param serviceDescription
+ * @param sei
+ * @param portQName
+ * @param updateType
+ * @param composite
+ * @return
+ */
+ public static EndpointDescription updateEndpoint(ServiceDescription serviceDescription,
+ Class sei, EndpointReference epr,
+ String addressingNamespace,
+ DescriptionFactory.UpdateType updateType,
+ DescriptionBuilderComposite composite,
+ Object sparseCompositeKey) {
+ return DescriptionFactoryImpl
+ .updateEndpoint(serviceDescription, sei, epr, addressingNamespace, updateType, composite, sparseCompositeKey);
+ }
+
/**
* Create a full ServiceDescription hierarchy on the SERVER side for EACH service implementation
* entry in the DescriptionBuilderComposite (DBC) map. Note that the associated SERVER side
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java Sun Jan 27 09:48:25 2008
@@ -136,11 +136,27 @@
public abstract QName getServiceQName();
public abstract Service.Mode getServiceMode();
-
+
+ /**
+ * Signals whether or not MTOM has been turned on for the endpoint
+ * based on the annotation configuration.
+ *
+ * @return a boolean value
+ */
+ public boolean isMTOMEnabled();
+
+ /**
+ * If MTOM is enabled, returns the threshold value.
+ *
+ * @return -1 if MTOM is not enabled, a positive integer value if
+ * one was configured.
+ */
+ public int getMTOMThreshold();
+
+
/**
* Return the DescriptionBuilderComposite, if any, used to build this service description.
* @return
*/
public DescriptionBuilderComposite getDescriptionBuilderComposite();
-
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescriptionJava.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescriptionJava.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescriptionJava.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescriptionJava.java Sun Jan 27 09:48:25 2008
@@ -18,6 +18,8 @@
*/
package org.apache.axis2.jaxws.description;
+import java.lang.annotation.Annotation;
+
import javax.jws.WebService;
import javax.xml.ws.BindingType;
import javax.xml.ws.Service;
@@ -52,4 +54,6 @@
public ServiceMode getAnnoServiceMode();
public Service.Mode getAnnoServiceModeValue();
+
+ public Annotation getAnnoFeature(String id);
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java Sun Jan 27 09:48:25 2008
@@ -31,6 +31,7 @@
import javax.wsdl.Definition;
import javax.xml.namespace.QName;
+import javax.xml.ws.spi.WebServiceFeatureAnnotation;
import java.io.InputStream;
import java.lang.annotation.Annotation;
@@ -82,7 +83,9 @@
private List<WebServiceRefAnnot> webServiceRefAnnotList;
private BindingTypeAnnot bindingTypeAnnot;
private WebServiceContextAnnot webServiceContextAnnot;
-
+
+ private List<Annotation> features;
+
// Class information
private String className;
private String[] classModifiers; //public, abstract, final, strictfp...
@@ -91,7 +94,7 @@
private boolean isInterface = false;
private QName preferredPort; // Port to use if no port QName given. May be null
private boolean isMTOMEnabled = false;
-
+
private List<MethodDescriptionComposite> methodDescriptions;
private List<FieldDescriptionComposite> fieldDescriptions;
@@ -369,7 +372,15 @@
public WebServiceContextAnnot getWebServiceContextAnnot() {
return (WebServiceContextAnnot) webServiceContextAnnot;
}
-
+
+ public List<Annotation> getWebServiceFeatures() {
+ return features;
+ }
+
+ public void setWebServiceFeatures(List<Annotation> list) {
+ features = list;
+ }
+
/** @return Returns the wsdlDefinition */
public Definition getWsdlDefinition() {
if (wsdlDefinition != null) {
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceContextAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceContextAnnot.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceContextAnnot.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceContextAnnot.java Sun Jan 27 09:48:25 2008
@@ -16,10 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.axis2.jaxws.description.builder;
+import javax.xml.ws.EndpointReference;
import javax.xml.ws.handler.MessageContext;
+
+import org.w3c.dom.Element;
+
import java.lang.annotation.Annotation;
import java.security.Principal;
@@ -90,10 +93,20 @@
this.userPrincipal = userPrincipal;
}
+ public <T extends EndpointReference> T getEndpointReference(Class<T> arg0, Element... arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public EndpointReference getEndpointReference(Element... arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
//hmm, should we really do this
public Class<Annotation> annotationType() {
return Annotation.class;
- }
+ }
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/ConverterUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/ConverterUtils.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/ConverterUtils.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/ConverterUtils.java Sun Jan 27 09:48:25 2008
@@ -33,6 +33,8 @@
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlList;
import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.spi.WebServiceFeatureAnnotation;
+
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.GenericArrayType;
@@ -41,6 +43,7 @@
import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
import java.security.PrivilegedAction;
+import java.util.ArrayList;
import java.util.List;
public class ConverterUtils {
@@ -60,6 +63,40 @@
}
});
}
+
+ /**
+ * Helper method to retrieve a list of all annotations that match the following
+ * conditions:
+ *
+ * - Annotations that extend the parameterized type T
+ * - Annotations that themselves are annotated with type T
+ *
+ * @param annotationClass
+ * @param element
+ * @return
+ */
+ public static <T extends Annotation> List<Annotation> getAnnotations(final Class<T> annotationClass, final AnnotatedElement element) {
+ List<Annotation> matches = new ArrayList<Annotation>();
+ Annotation[] annotations = null;
+
+ // Get the complete list of annotations from the class that was provided.
+ annotations = (Annotation[]) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return element.getAnnotations();
+ }
+ });
+
+ for (Annotation a: annotations) {
+ // If the annotation matches the parameter type we're looking
+ // for, add it to the list.
+ if (a.annotationType().isAnnotationPresent(annotationClass) ||
+ annotationClass.isAssignableFrom(a.annotationType())) {
+ matches.add(a);
+ }
+ }
+
+ return matches;
+ }
/**
* This is a helper method to create a <code>HandlerChainAnnot</code> since the
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java Sun Jan 27 09:48:25 2008
@@ -18,12 +18,14 @@
*/
package org.apache.axis2.jaxws.description.builder.converter;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.jws.WebService;
import javax.xml.ws.BindingType;
@@ -33,6 +35,7 @@
import javax.xml.ws.WebServiceProvider;
import javax.xml.ws.WebServiceRef;
import javax.xml.ws.WebServiceRefs;
+import javax.xml.ws.spi.WebServiceFeatureAnnotation;
import org.apache.axis2.jaxws.description.builder.BindingTypeAnnot;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
@@ -54,7 +57,15 @@
private String seiClassName;
private List<Class> classes;
-
+
+ private static final Map<Class, Object> annotationProcessors;
+
+ static {
+ annotationProcessors = new HashMap<Class, Object>();
+
+
+ }
+
public JavaClassToDBCConverter(Class serviceClass) {
this.serviceClass = serviceClass;
classes = new ArrayList<Class>();
@@ -185,6 +196,7 @@
attachWebServiceProviderAnnotation(composite);
attachWebServiceRefsAnnotation(composite);
attachWebServiceRefAnnotation(composite);
+ attachWebServiceFeatureAnnotations(composite);
}
/**
@@ -347,6 +359,24 @@
private void attachWebServiceRefAnnotation(DescriptionBuilderComposite composite) {
ConverterUtils.attachWebServiceRefAnnotation(composite, serviceClass);
+ }
+
+ /**
+ * Finds the list of WebServiceFeatureAnnotation instances, and set them on the composite.
+ *
+ * @param composite
+ */
+ private void attachWebServiceFeatureAnnotations(DescriptionBuilderComposite composite) {
+ List<Annotation> features = ConverterUtils.getAnnotations(
+ WebServiceFeatureAnnotation.class, serviceClass);
+
+ if (features.size() > 0) {
+ if (log.isDebugEnabled()) {
+ log.debug("There were [" + features.size() + "] WebServiceFeature annotations found.");
+ }
+
+ composite.setWebServiceFeatures(features);
+ }
}
private void establishClassHierarchy(Class rootClass) {
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java?rev=615621&r1=615620&r2=615621&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java Sun Jan 27 09:48:25 2008
@@ -22,6 +22,9 @@
*
*/
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.addressing.metadata.ServiceName;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.jaxws.ClientConfigurationFactory;
@@ -326,6 +329,64 @@
log.debug("EndpointDescription updated: " + endpointDesc);
}
return endpointDesc;
+ }
+
+ /**
+ * @see org.apache.axis2.jaxws.description.DescriptionFactory#updateEndpoint(ServiceDescription,
+ * Class, EndpointReference, String, DescriptionFactory.UpdateType)
+ */
+ public static EndpointDescription updateEndpoint(
+ ServiceDescription serviceDescription, Class sei, EndpointReference epr,
+ String addressingNamespace,
+ DescriptionFactory.UpdateType updateType) {
+ return updateEndpoint(serviceDescription, sei, epr, addressingNamespace, updateType, null, null);
+ }
+
+ /**
+ * @see org.apache.axis2.jaxws.description.DescriptionFactory#updateEndpoint(ServiceDescription,
+ * Class, EndpointReference, String, DescriptionFactory.UpdateType, Object)
+ */
+ public static EndpointDescription updateEndpoint(
+ ServiceDescription serviceDescription, Class sei, EndpointReference epr,
+ String addressingNamespace,
+ DescriptionFactory.UpdateType updateType,
+ Object sparseCompositeKey) {
+ return updateEndpoint(serviceDescription, sei, epr, addressingNamespace, updateType, null, sparseCompositeKey);
+ }
+
+ /**
+ * @see org.apache.axis2.jaxws.description.DescriptionFactory#updateEndpoint(ServiceDescription,
+ * Class, EndpointReference, String, DescriptionFactory.UpdateType, DescriptionBuilderComposite, Object)
+ */
+ public static EndpointDescription updateEndpoint(
+ ServiceDescription serviceDescription, Class sei, EndpointReference epr,
+ String addressingNamespace,
+ DescriptionFactory.UpdateType updateType,
+ DescriptionBuilderComposite composite,
+ Object sparseCompositeKey) {
+ QName portQName = null;
+
+ try {
+ ServiceName serviceName = EndpointReferenceHelper.getServiceNameMetadata(epr, addressingNamespace);
+ QName serviceQName = serviceDescription.getServiceQName();
+
+ //The javadoc says that a WebServiceException should be thrown if the service name
+ //in the EPR metadata does not match the service name in the WSDL of the JAX-WS
+ //service instance.
+ if (!serviceQName.equals(serviceName.getName()))
+ throw ExceptionFactory.makeWebServiceException("The service name of the endpoint reference does not match the service name of the service client.");
+
+ //TODO The javadoc seems to suggest, inconsistently, that the port name can be
+ //resolved by looking in the following places: 1) the EPR metadata, 2) the SEI, and
+ //3) the WSDL. At the moment only 1) is implemented. May need to revisit the others.
+ portQName = new QName(serviceQName.getNamespaceURI(), serviceName.getEndpointName());
+ }
+ catch (Exception e) {
+ //TODO NLS enable.
+ throw ExceptionFactory.makeWebServiceException("An error occured updating the endpoint", e);
+ }
+
+ return updateEndpoint(serviceDescription, sei, portQName, updateType, composite, sparseCompositeKey);
}
public static ClientConfigurationFactory getClientConfigurationFactory() {
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=615621&r1=615620&r2=615621&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 Sun Jan 27 09:48:25 2008
@@ -19,6 +19,7 @@
package org.apache.axis2.jaxws.description.impl;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants.Configuration;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
@@ -30,6 +31,7 @@
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
import org.apache.axis2.jaxws.description.EndpointDescriptionWSDL;
@@ -42,7 +44,12 @@
import org.apache.axis2.jaxws.description.builder.MDQConstants;
import org.apache.axis2.jaxws.description.builder.WsdlComposite;
import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
+import org.apache.axis2.jaxws.feature.ServerConfigurator;
+import org.apache.axis2.jaxws.feature.ServerFramework;
import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.server.config.AddressingConfigurator;
+import org.apache.axis2.jaxws.server.config.MTOMConfigurator;
+import org.apache.axis2.jaxws.server.config.RespectBindingConfigurator;
import org.apache.axis2.jaxws.util.ClassLoaderUtils;
import org.apache.axis2.jaxws.util.WSDL4JWrapper;
import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper;
@@ -57,16 +64,17 @@
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.http.HTTPBinding;
import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPBody;
import javax.wsdl.extensions.soap12.SOAP12Address;
import javax.wsdl.extensions.soap12.SOAP12Binding;
-import javax.wsdl.extensions.soap12.SOAP12Body;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingType;
+import javax.xml.ws.RespectBindingFeature;
import javax.xml.ws.Service;
import javax.xml.ws.ServiceMode;
import javax.xml.ws.WebServiceProvider;
import javax.xml.ws.handler.PortInfo;
+import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.MTOMFeature;
import javax.xml.ws.soap.SOAPBinding;
import java.io.InputStream;
@@ -89,6 +97,12 @@
*/
class EndpointDescriptionImpl
implements EndpointDescription, EndpointDescriptionJava, EndpointDescriptionWSDL {
+ private static final ServerConfigurator RESPECT_BINDING_CONFIGURATOR =
+ new RespectBindingConfigurator();
+ private static final ServerConfigurator ADDRESSING_CONFIGURATOR =
+ new AddressingConfigurator();
+ private static final ServerConfigurator MTOM_CONFIGURATOR =
+ new MTOMConfigurator();
private ServiceDescriptionImpl parentServiceDescription;
private AxisService axisService;
@@ -173,6 +187,10 @@
private Map<String, CustomAnnotationProcessor> customAnnotationProcessors;
+ // Supports WebServiceFeatureAnnotations
+ private ServerFramework framework = new ServerFramework();
+
+
/**
* Create a service-requester side EndpointDescription based on the WSDL port.
* Note that per the JAX-WS Spec (Final
@@ -473,6 +491,9 @@
processor.processTypeLevelAnnotation(this, annotation);
}
}
+
+ // Configure any available WebServiceFeatures on the endpoint.
+ configureWebServiceFeatures();
}
/**
@@ -499,6 +520,8 @@
addToAxisService();
buildEndpointDescriptionFromAnnotations();
+
+ configureWebServiceFeatures();
// The anonymous AxisOperations are currently NOT added here. The reason
// is that (for now) this is a SERVER-SIDE code path, and the anonymous operations
@@ -569,14 +592,18 @@
if (composite.isDeprecatedServiceProviderConstruction()
|| !composite.isServiceProvider()) {
+// if (!getServiceDescriptionImpl().isDBCMap()) {
Class seiClass = null;
if (DescriptionUtils.isEmpty(seiClassName)) {
- // This is the client code path; the @WebServce will not have an endpointInterface member
- // so just build the EndpointInterfaceDesc based on the class itself.
+ // TODO: (JLB) This is the client code path; the @WebServce will not have an endpointInterface member
+ // For now, just build the EndpointInterfaceDesc based on the class itself.
+ // TODO: The EID ctor doesn't correctly handle anything but an SEI at this
+ // point; e.g. it doesn't publish the correct methods of just an impl.
seiClass = composite.getCorrespondingClass();
} else {
- // This is the deprecated server-side introspection code for an impl that references an SEI
+ // TODO: (JLB) This is the deprecated server-side introspection code for an impl that references an SEI
try {
+ // TODO: Using Class forName() is probably not the best long-term way to get the SEI class from the annotation
seiClass = ClassLoaderUtils.forName(seiClassName, false,
ClassLoaderUtils.getContextClassLoader(this.axisService != null ? this.axisService.getClassLoader() : null));
// Catch Throwable as ClassLoader can throw an NoClassDefFoundError that
@@ -589,14 +616,17 @@
}
endpointInterfaceDescription = new EndpointInterfaceDescriptionImpl(seiClass, this);
} else {
+ //TODO: Determine if we need logic here to determine implied SEI or not. This logic
+ // may be handled by EndpointInterfaceDescription
+
if (DescriptionUtils.isEmpty(getAnnoWebServiceEndpointInterface())) {
- // Build the EndpointInterfaceDesc based on the class itself
+ //TODO: Build the EndpointInterfaceDesc based on the class itself
endpointInterfaceDescription =
new EndpointInterfaceDescriptionImpl(composite, true, this);
} else {
- // Otherwise, build the EID based on the SEI composite
+ //Otherwise, build the EID based on the SEI composite
endpointInterfaceDescription = new EndpointInterfaceDescriptionImpl(
getServiceDescriptionImpl().getDBCMap().get(seiClassName),
false,
@@ -1343,6 +1373,85 @@
return handlerChainAnnotation;
}
+
+ // ===========================================
+ // ANNOTATION: MTOM
+ // ===========================================
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.axis2.jaxws.description.EndpointDescription#isMTOMEnabled()
+ */
+ public boolean isMTOMEnabled() {
+ if (axisService != null) {
+ // We should cache this call here so we don't have to make
+ // it on every pass through.
+ Parameter enableMTOM = axisService.getParameter(Configuration.ENABLE_MTOM);
+ if (enableMTOM != null) {
+ return (Boolean) enableMTOM.getValue();
+ }
+ }
+
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.axis2.jaxws.description.EndpointDescription#getMTOMThreshold()
+ */
+ public int getMTOMThreshold() {
+ if (axisService != null) {
+ // We should cache this call here so we don't have to make
+ // it on every pass through.
+ Parameter mtomThreshold = axisService.getParameter(Configuration.MTOM_THRESHOLD);
+ if (mtomThreshold != null) {
+ return (Integer) mtomThreshold.getValue();
+ }
+ }
+
+ return -1;
+ }
+
+ // Get the specified WebServiceFeatureAnnotation
+ public Annotation getAnnoFeature(String id) {
+ return framework.getAnnotation(id);
+ }
+
+ //The WebServiceFeatures should be configued last so that any other
+ //configuration can be overridden. Should only be called on the
+ //server side.
+ private void configureWebServiceFeatures() {
+ framework.addConfigurator(RespectBindingFeature.ID, RESPECT_BINDING_CONFIGURATOR);
+
+ String binding = getBindingType();
+
+ if (isSOAPBinding(binding)) {
+ framework.addConfigurator(AddressingFeature.ID, ADDRESSING_CONFIGURATOR);
+ framework.addConfigurator(SubmissionAddressingFeature.ID, ADDRESSING_CONFIGURATOR);
+ framework.addConfigurator(MTOMFeature.ID, MTOM_CONFIGURATOR);
+ }
+
+ // The feature instances are stored on the composite from either the
+ // Java class or from something else building the list and setting it there.
+ List<Annotation> features = composite.getWebServiceFeatures();
+
+ if (features != null && features.size() > 0) {
+ // Add each of the annotation instances to the WebServiceFeature framework
+ Iterator<Annotation> itr = features.iterator();
+ while (itr.hasNext()) {
+ Annotation feature = (Annotation) itr.next();
+ framework.addAnnotation(feature);
+ }
+
+ // Kick off the configuration of the WebServiceFeature instances.
+ framework.configure(this);
+ }
+ else {
+ if (log.isDebugEnabled()) {
+ log.debug("No WebServiceFeatureAnnotation instances were found on the composite.");
+ }
+ }
+ }
private Definition getWSDLDefinition() {
return ((ServiceDescriptionWSDL)getServiceDescription()).getWSDLDefinition();
@@ -1467,6 +1576,16 @@
Messages.getMessage("addPortErr0", getPortQName().toString()));
}
}
+
+ public static boolean isSOAPBinding(String url) {
+ if (url != null && (url.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
+ url.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
+ url.equals(SOAPBinding.SOAP12HTTP_BINDING)||
+ url.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))) {
+ return true;
+ }
+ return false;
+ }
private boolean validateClientBindingID(String bindingId) {
boolean isValid = true;
@@ -1757,6 +1876,20 @@
return string.toString();
}
return string.toString();
+ }
+
+ /**
+ * Get an annotation. This is wrappered to avoid a Java2Security violation.
+ * @param cls Class that contains annotation
+ * @param annotation Class of requrested Annotation
+ * @return annotation or null
+ */
+ private static Annotation getAnnotation(final Class cls, final Class annotation) {
+ return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return cls.getAnnotation(annotation);
+ }
+ });
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org