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/18 12:59:33 UTC
svn commit: r613137 - in /webservices/axis2/branches/java/jaxws21/modules:
jaxws/src/org/apache/axis2/jaxws/
jaxws/src/org/apache/axis2/jaxws/addressing/util/
jaxws/src/org/apache/axis2/jaxws/spi/
jaxws/test/org/apache/axis2/jaxws/addressing/util/ meta...
Author: pradine
Date: Fri Jan 18 03:59:31 2008
New Revision: 613137
URL: http://svn.apache.org/viewvc?rev=613137&view=rev
Log:
Update the new JAX-WS 2.1 apis in ServiceDelegate to make use of the client-side DescriptionBuilderComposite. Also, refactored some of the EndpointReference conversion code.
Modified:
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java
webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java
webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java?rev=613137&r1=613136&r2=613137&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java Fri Jan 18 03:59:31 2008
@@ -26,13 +26,13 @@
import javax.xml.ws.Binding;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.WebServiceFeature;
-import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.handler.HandlerResolver;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import org.apache.axis2.AxisFault;
import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
import org.apache.axis2.jaxws.binding.BindingUtils;
+import org.apache.axis2.jaxws.binding.SOAPBinding;
import org.apache.axis2.jaxws.client.PropertyValidator;
import org.apache.axis2.jaxws.core.InvocationContext;
import org.apache.axis2.jaxws.core.MessageContext;
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java?rev=613137&r1=613136&r2=613137&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java Fri Jan 18 03:59:31 2008
@@ -76,19 +76,20 @@
* Convert from a {@link javax.xml.ws.EndpointReference} to a an instance of
* {@link EndpointReference}.
*
+ * @param axis2EPR
* @param jaxwsEPR
* @return
* @throws AxisFault
* @throws XMLStreamException
*/
- public static EndpointReference convertToAxis2(javax.xml.ws.EndpointReference jaxwsEPR)
+ public static String convertToAxis2(EndpointReference axis2EPR, javax.xml.ws.EndpointReference jaxwsEPR)
throws AxisFault, XMLStreamException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
jaxwsEPR.writeTo(new StreamResult(baos));
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
OMElement eprElement = (OMElement) XMLUtils.toOM(bais);
- return EndpointReferenceHelper.fromOM(eprElement);
+ return EndpointReferenceHelper.fromOM(axis2EPR, eprElement);
}
public static String getAddressingNamespace(Class clazz) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java?rev=613137&r1=613136&r2=613137&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java Fri Jan 18 03:59:31 2008
@@ -106,17 +106,19 @@
throw ExceptionFactory.makeWebServiceException(
Messages.getMessage("getPortInvalidSEI", jaxwsEPR.toString(), "null"));
}
-
- org.apache.axis2.addressing.EndpointReference axis2EPR = null;
+
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = null;
+
try {
- axis2EPR = EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
+ addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
}
catch (Exception e) {
//TODO NLS enable.
throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
}
- String addressingNamespace = EndpointReferenceUtils.getAddressingNamespace(jaxwsEPR.getClass());
org.apache.axis2.jaxws.spi.ServiceDelegate serviceDelegate = null;
try {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?rev=613137&r1=613136&r2=613137&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Fri Jan 18 03:59:31 2008
@@ -23,8 +23,6 @@
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;
@@ -56,7 +54,6 @@
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;
@@ -278,17 +275,18 @@
.makeWebServiceException(Messages.getMessage("dispatchInvalidType"));
}
- org.apache.axis2.addressing.EndpointReference axis2EPR = null;
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = null;
+
try {
- axis2EPR = EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
+ addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
}
catch (Exception e) {
//TODO NLS enable.
throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
}
- String addressingNamespace =
- EndpointReferenceUtils.getAddressingNamespace(jaxwsEPR.getClass());
EndpointDescription endpointDesc =
DescriptionFactory.updateEndpoint(serviceDescription, null, axis2EPR,
addressingNamespace,
@@ -321,18 +319,19 @@
throw ExceptionFactory
.makeWebServiceException("The endpoint reference cannot be null.");
}
-
- org.apache.axis2.addressing.EndpointReference axis2EPR = null;
+
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = null;
+
try {
- axis2EPR = EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
+ addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
}
catch (Exception e) {
//TODO NLS enable.
throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
}
- String addressingNamespace =
- EndpointReferenceUtils.getAddressingNamespace(jaxwsEPR.getClass());
EndpointDescription endpointDesc =
DescriptionFactory.updateEndpoint(serviceDescription, null, axis2EPR,
addressingNamespace,
@@ -470,19 +469,19 @@
throw ExceptionFactory.makeWebServiceException(
Messages.getMessage("getPortInvalidSEI", jaxwsEPR.toString(), "null"));
}
-
- org.apache.axis2.addressing.EndpointReference axis2EPR = null;
+
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = null;
+
try {
- axis2EPR = EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
+ addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
}
catch (Exception e) {
//TODO NLS enable.
throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
}
- String addressingNamespace =
- EndpointReferenceUtils.getAddressingNamespace(jaxwsEPR.getClass());
-
return getPort(axis2EPR, addressingNamespace, sei, features);
}
@@ -637,10 +636,26 @@
}
public <T> T getPort(org.apache.axis2.addressing.EndpointReference axis2EPR, String addressingNamespace, Class<T> sei, WebServiceFeature... features) {
- EndpointDescription endpointDesc =
+ DescriptionBuilderComposite sparseComposite = getPortMetadata();
+ resetPortMetadata();
+ EndpointDescription endpointDesc = null;
+
+ if (sparseComposite != null) {
+ endpointDesc =
DescriptionFactory.updateEndpoint(serviceDescription, sei, axis2EPR,
addressingNamespace,
- DescriptionFactory.UpdateType.GET_PORT);
+ 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(
@@ -700,23 +715,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/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java?rev=613137&r1=613136&r2=613137&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java Fri Jan 18 03:59:31 2008
@@ -43,8 +43,7 @@
import org.xml.sax.InputSource;
/**
- * This class uses the JAX-WS Dispatch API to test sending and receiving
- * messages using SOAP 1.2.
+ * This class tests the enpoint reference classes used in the JAX-WS 2.1 API.
*/
public class EndpointReferenceUtilsTests extends XMLTestCase {
private static final OMFactory OMF = OMAbstractFactory.getOMFactory();
@@ -95,9 +94,10 @@
assertXMLEqual(EPR200508, jaxwsEPR.toString());
org.apache.axis2.addressing.EndpointReference axis2Result =
- EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2Result, jaxwsEPR);
OMElement eprElement =
- EndpointReferenceHelper.toOM(OMF, axis2Result, ELEMENT200508, Final.WSA_NAMESPACE);
+ EndpointReferenceHelper.toOM(OMF, axis2Result, ELEMENT200508, addressingNamespace);
assertXMLEqual(EPR200508, eprElement.toString());
}
@@ -110,9 +110,10 @@
W3CEndpointReference jaxwsEPR = new W3CEndpointReference(source);
org.apache.axis2.addressing.EndpointReference axis2EPR =
- EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
OMElement eprElement =
- EndpointReferenceHelper.toOM(OMF, axis2EPR, ELEMENT200508, Final.WSA_NAMESPACE);
+ EndpointReferenceHelper.toOM(OMF, axis2EPR, ELEMENT200508, addressingNamespace);
assertXMLEqual(EPR200508, eprElement.toString());
W3CEndpointReference jaxwsResult =
@@ -133,9 +134,10 @@
assertXMLEqual(EPR200408, jaxwsEPR.toString());
org.apache.axis2.addressing.EndpointReference axis2Result =
- EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2Result, jaxwsEPR);
OMElement eprElement =
- EndpointReferenceHelper.toOM(OMF, axis2Result, ELEMENT200408, Submission.WSA_NAMESPACE);
+ EndpointReferenceHelper.toOM(OMF, axis2Result, ELEMENT200408, addressingNamespace);
assertXMLEqual(EPR200408, eprElement.toString());
}
@@ -148,9 +150,10 @@
SubmissionEndpointReference jaxwsEPR = new SubmissionEndpointReference(source);
org.apache.axis2.addressing.EndpointReference axis2EPR =
- EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ String addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2EPR, jaxwsEPR);
OMElement eprElement =
- EndpointReferenceHelper.toOM(OMF, axis2EPR, ELEMENT200408, Submission.WSA_NAMESPACE);
+ EndpointReferenceHelper.toOM(OMF, axis2EPR, ELEMENT200408, addressingNamespace);
assertXMLEqual(EPR200408, eprElement.toString());
SubmissionEndpointReference jaxwsResult =
@@ -184,7 +187,9 @@
}
try {
- EndpointReferenceUtils.convertToAxis2(null);
+ org.apache.axis2.addressing.EndpointReference axis2EPR =
+ EndpointReferenceUtils.createAxis2EndpointReference("");
+ EndpointReferenceUtils.convertToAxis2(axis2EPR, null);
fail("Expected a failure.");
}
catch (Exception e) {
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java?rev=613137&r1=613136&r2=613137&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/DescriptionFactory.java Fri Jan 18 03:59:31 2008
@@ -142,7 +142,7 @@
Object sparseCompositeKey) {
return DescriptionFactoryImpl
.updateEndpoint(serviceDescription, sei, portQName, updateType, composite, sparseCompositeKey);
-}
+ }
/**
* Retrieve or create the EndpointDescription hierachy associated with an existing CLIENT side
@@ -173,6 +173,31 @@
.updateEndpoint(serviceDescription, sei, epr, addressingNamespace, updateType);
}
+ /**
+ * 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 hierachy on the SERVER side for EACH service implementation
* entry in the DescriptionBuilderComposite (DBC) map. Note that the associated SERVER side
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java?rev=613137&r1=613136&r2=613137&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java Fri Jan 18 03:59:31 2008
@@ -323,23 +323,40 @@
/**
* @see org.apache.axis2.jaxws.description.DescriptionFactory#updateEndpoint(ServiceDescription,
- * Class, EndpointReference, String, DescriptionFactory.UpdateType)
+ * 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, 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.");
- //An assumption is made here that the namespace associated with the ServiceName also
- //applies to the PortName.
+ //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) {
@@ -347,7 +364,7 @@
throw ExceptionFactory.makeWebServiceException("An error occured updating the endpoint", e);
}
- return updateEndpoint(serviceDescription, sei, portQName, updateType);
+ return updateEndpoint(serviceDescription, sei, portQName, updateType, composite, sparseCompositeKey);
}
public static ClientConfigurationFactory getClientConfigurationFactory() {
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org