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 2007/09/17 12:30:55 UTC
svn commit: r576353 - in /webservices/axis2/branches/java/jaxws21/modules:
jaxws/src/org/apache/axis2/jaxws/
jaxws/src/org/apache/axis2/jaxws/addressing/factory/
jaxws/src/org/apache/axis2/jaxws/addressing/util/
jaxws/src/org/apache/axis2/jaxws/context...
Author: pradine
Date: Mon Sep 17 03:30:45 2007
New Revision: 576353
URL: http://svn.apache.org/viewvc?rev=576353&view=rev
Log:
Get this endpoint reference creation stuff right.
Added:
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactory.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactoryImpl.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactory.java
- copied, changed from r572368, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactory.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java
- copied, changed from r572368, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactoryImpl.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java
- copied, changed from r572368, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverter.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java
- copied, changed from r572368, webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverterTests.java
Removed:
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactory.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactoryImpl.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceBuilder.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverter.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverterTests.java
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/context/WebServiceContextImpl.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.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/framework/JAXWSTest.java
webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.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=576353&r1=576352&r2=576353&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 Mon Sep 17 03:30:45 2007
@@ -30,12 +30,7 @@
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import org.apache.axis2.AxisFault;
-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.addressing.factory.EndpointReferenceFactory;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceBuilder;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceConverter;
+import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
import org.apache.axis2.jaxws.binding.BindingUtils;
import org.apache.axis2.jaxws.client.PropertyValidator;
import org.apache.axis2.jaxws.core.InvocationContext;
@@ -44,7 +39,6 @@
import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
import org.apache.axis2.jaxws.handler.HandlerResolverImpl;
import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.registry.FactoryRegistry;
import org.apache.axis2.jaxws.spi.ServiceDelegate;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.commons.logging.Log;
@@ -229,7 +223,7 @@
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
EndpointReference jaxwsEPR = null;
- String addressingNamespace = getAddressingNamespace(clazz);
+ String addressingNamespace = EndpointReferenceUtils.getAddressingNamespace(clazz);
if (!BindingUtils.isSOAPBinding(binding.getBindingID()))
throw new UnsupportedOperationException("This method is unsupported for the binding: " + binding.getBindingID());
@@ -237,7 +231,7 @@
try {
org.apache.axis2.addressing.EndpointReference epr =
getAxis2EndpointReference(addressingNamespace);
- jaxwsEPR = EndpointReferenceConverter.convertFromAxis2(epr, addressingNamespace);
+ jaxwsEPR = EndpointReferenceUtils.convertFromAxis2(epr, addressingNamespace);
}
catch (Exception e) {
//TODO NLS enable.
@@ -256,7 +250,7 @@
QName port = endpointDesc.getPortQName();
URL wsdlURL = ((ServiceDescriptionWSDL) endpointDesc.getServiceDescription()).getWSDLLocation();
- epr = EndpointReferenceBuilder.createEndpointReference(address, service, port, wsdlURL.toString(), addressingNamespace);
+ epr = EndpointReferenceUtils.createAxis2EndpointReference(address, service, port, wsdlURL.toString(), addressingNamespace);
}
return epr;
@@ -264,12 +258,6 @@
public String getAddressingNamespace() {
return addressingNamespace;
- }
-
- private String getAddressingNamespace(Class clazz) {
- EndpointReferenceFactory eprFactory =
- (EndpointReferenceFactory) FactoryRegistry.getFactory(EndpointReferenceFactory.class);
- return eprFactory.getAddressingNamespace(clazz);
}
/*
Added: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactory.java?rev=576353&view=auto
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactory.java (added)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactory.java Mon Sep 17 03:30:45 2007
@@ -0,0 +1,13 @@
+package org.apache.axis2.jaxws.addressing.factory;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.addressing.EndpointReference;
+
+public interface Axis2EndpointReferenceFactory {
+ public EndpointReference createEndpointReference(String address);
+
+ public EndpointReference createEndpointReference(QName serviceName, QName endpoint);
+
+ public EndpointReference createEndpointReference(String address, QName serviceName, QName portName, String wsdlDocumentLocation, String addressingNamespace);
+}
\ No newline at end of file
Added: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactoryImpl.java?rev=576353&view=auto
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactoryImpl.java (added)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/Axis2EndpointReferenceFactoryImpl.java Mon Sep 17 03:30:45 2007
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.addressing.factory;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.addressing.EndpointReference;
+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.EndpointKey;
+import org.apache.axis2.jaxws.addressing.util.EndpointMap;
+import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+import org.apache.axis2.jaxws.util.WSDLWrapper;
+
+public class Axis2EndpointReferenceFactoryImpl implements Axis2EndpointReferenceFactory {
+ private final EndpointMap map = new EndpointMap();
+
+ public Axis2EndpointReferenceFactoryImpl() {
+ super();
+ }
+
+ public void addAddress(QName serviceName, QName endpoint, String address) {
+ EndpointKey key = new EndpointKey(serviceName, endpoint);
+
+ if (address == null)
+ throw new IllegalStateException("The specified address is not a valid value: " + address);
+
+ map.put(key, address);
+ }
+
+ public EndpointReference createEndpointReference(String address) {
+ if (address == null)
+ throw new IllegalStateException("The specified address is not a valid value: " + address);
+
+ return new EndpointReference(address);
+ }
+
+ public EndpointReference createEndpointReference(QName serviceName, QName endpoint) {
+ EndpointKey key = new EndpointKey(serviceName, endpoint);
+ String address = map.get(key);
+
+ return createEndpointReference(address);
+ }
+
+ public EndpointReference createEndpointReference(String address, QName serviceName, QName portName, String wsdlDocumentLocation, String addressingNamespace) {
+ EndpointReference axis2EPR = null;
+
+ if (address != null) {
+ //TODO NLS enable.
+ if (serviceName == null && portName != null)
+ throw new IllegalStateException("Cannot create an endpoint reference because the service name is null, and the port name is not null.");
+
+ axis2EPR = createEndpointReference(address);
+ }
+ else if (serviceName != null && portName != null) {
+ axis2EPR = createEndpointReference(serviceName, portName);
+ }
+ else {
+ //TODO NLS enable.
+ throw new IllegalStateException("Cannot create an endpoint reference because the address, service name, and/or port name are null.");
+ }
+
+ try {
+ //TODO If no service name and port name are specified, but the wsdl location is
+ //specified, and the WSDL only contains one service and one port then maybe we
+ //should simply use those.
+ if (serviceName != null && portName != null) {
+ ServiceName service = new ServiceName(serviceName, portName.getLocalPart());
+ EndpointReferenceHelper.setServiceNameMetadata(axis2EPR, addressingNamespace, service);
+ }
+
+ if (wsdlDocumentLocation != null) {
+ URL wsdlURL = new URL(wsdlDocumentLocation);
+ WSDLWrapper wrapper = new WSDL4JWrapper(wsdlURL);
+
+ if (serviceName != null) {
+ //TODO NLS
+ if (wrapper.getService(serviceName) == null)
+ throw new IllegalStateException("The specified service name does not exist in the WSDL from the specified location.");
+
+ if (portName != null) {
+ String[] ports = wrapper.getPorts(serviceName);
+ String portLocalName = portName.getLocalPart();
+ boolean found = false;
+
+ if (ports != null) {
+ for (String port : ports) {
+ if (port.equals(portLocalName)) {
+ found = true;
+ break;
+ }
+ }
+ }
+
+ //TODO NLS
+ if (!found)
+ throw new IllegalStateException("The specified port name does not exist in the specified WSDL service.");
+ }
+ }
+
+ WSDLLocation wsdlLocation = new WSDLLocation(portName.getNamespaceURI(), wsdlDocumentLocation);
+ EndpointReferenceHelper.setWSDLLocationMetadata(axis2EPR, addressingNamespace, wsdlLocation);
+ }
+ }
+ catch (IllegalStateException ise) {
+ throw ise;
+ }
+ 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 axis2EPR;
+ }
+}
Copied: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactory.java (from r572368, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactory.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactory.java?p2=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactory.java&p1=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactory.java&r1=572368&r2=576353&rev=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactory.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactory.java Mon Sep 17 03:30:45 2007
@@ -21,7 +21,7 @@
import javax.xml.transform.Source;
import javax.xml.ws.EndpointReference;
-public interface EndpointReferenceFactory {
+public interface JAXWSEndpointReferenceFactory {
public EndpointReference createEndpointReference(Source eprInfoset, String addressingNamespace);
public String getAddressingNamespace(Class clazz);
Copied: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java (from r572368, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactoryImpl.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java?p2=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java&p1=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactoryImpl.java&r1=572368&r2=576353&rev=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/EndpointReferenceFactoryImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java Mon Sep 17 03:30:45 2007
@@ -27,8 +27,8 @@
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.addressing.SubmissionEndpointReference;
-public class EndpointReferenceFactoryImpl implements EndpointReferenceFactory {
- public EndpointReferenceFactoryImpl() {
+public class JAXWSEndpointReferenceFactoryImpl implements JAXWSEndpointReferenceFactory {
+ public JAXWSEndpointReferenceFactoryImpl() {
super();
}
Copied: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java (from r572368, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverter.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java?p2=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java&p1=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverter.java&r1=572368&r2=576353&rev=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java Mon Sep 17 03:30:45 2007
@@ -26,30 +26,33 @@
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import javax.xml.ws.EndpointReference;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.EndpointReferenceHelper;
-import org.apache.axis2.jaxws.addressing.factory.EndpointReferenceFactory;
+import org.apache.axis2.jaxws.addressing.factory.Axis2EndpointReferenceFactory;
+import org.apache.axis2.jaxws.addressing.factory.JAXWSEndpointReferenceFactory;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
import org.apache.axis2.util.XMLUtils;
import org.w3c.dom.Element;
-public final class EndpointReferenceConverter {
+public final class EndpointReferenceUtils {
private static OMFactory omFactory = OMAbstractFactory.getOMFactory();
- private static EndpointReferenceFactory eprFactory =
- (EndpointReferenceFactory) FactoryRegistry.getFactory(EndpointReferenceFactory.class);
-
- private EndpointReferenceConverter() {
+ private static JAXWSEndpointReferenceFactory jaxwsEPRFactory =
+ (JAXWSEndpointReferenceFactory) FactoryRegistry.getFactory(JAXWSEndpointReferenceFactory.class);
+ private static Axis2EndpointReferenceFactory axis2EPRFactory =
+ (Axis2EndpointReferenceFactory) FactoryRegistry.getFactory(Axis2EndpointReferenceFactory.class);
+
+ private EndpointReferenceUtils() {
}
/**
- * Convert from a {@link org.apache.axis2.addressing.EndpointReference} to a
- * subclass of {@link EndpointReference}.
+ * Convert from a {@link EndpointReference} to a
+ * subclass of {@link javax.xml.ws.EndpointReference}.
*
* @param <T>
* @param axis2EPR
@@ -57,7 +60,7 @@
* @return
* @throws AxisFault
*/
- public static EndpointReference convertFromAxis2(org.apache.axis2.addressing.EndpointReference axis2EPR, String addressingNamespace)
+ public static javax.xml.ws.EndpointReference convertFromAxis2(EndpointReference axis2EPR, String addressingNamespace)
throws AxisFault, Exception {
QName qname = new QName(addressingNamespace, "EndpointReference", "wsa");
OMElement omElement =
@@ -65,19 +68,19 @@
Element eprElement = XMLUtils.toDOM(omElement);
Source eprInfoset = new DOMSource(eprElement);
- return eprFactory.createEndpointReference(eprInfoset, addressingNamespace);
+ return jaxwsEPRFactory.createEndpointReference(eprInfoset, addressingNamespace);
}
/**
- * Convert from a {@link EndpointReference} to a an instance of
- * {@link org.apache.axis2.addressing.EndpointReference}.
+ * Convert from a {@link javax.xml.ws.EndpointReference} to a an instance of
+ * {@link EndpointReference}.
*
* @param jaxwsEPR
* @return
* @throws AxisFault
* @throws XMLStreamException
*/
- public static org.apache.axis2.addressing.EndpointReference convertToAxis2(EndpointReference jaxwsEPR)
+ public static EndpointReference convertToAxis2(javax.xml.ws.EndpointReference jaxwsEPR)
throws AxisFault, XMLStreamException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
jaxwsEPR.writeTo(new StreamResult(baos));
@@ -85,5 +88,37 @@
OMElement eprElement = (OMElement) XMLUtils.toOM(bais);
return EndpointReferenceHelper.fromOM(eprElement);
+ }
+
+ public static String getAddressingNamespace(Class clazz) {
+ return jaxwsEPRFactory.getAddressingNamespace(clazz);
+ }
+
+ public static EndpointReference createAxis2EndpointReference(String address, QName serviceName, QName portName, String wsdlDocumentLocation, String addressingNamespace) {
+ return axis2EPRFactory.createEndpointReference(address, serviceName, portName, wsdlDocumentLocation, addressingNamespace);
+ }
+
+ public static EndpointReference createAxis2EndpointReference(String address) {
+ return axis2EPRFactory.createEndpointReference(address);
+ }
+
+ public static void addReferenceParameters(EndpointReference axis2EPR, Element...referenceParameters)
+ throws Exception {
+ if (referenceParameters != null) {
+ for (Element element : referenceParameters) {
+ OMElement omElement = XMLUtils.toOM(element);
+ axis2EPR.addReferenceParameter(omElement);
+ }
+ }
+ }
+
+ public static void addMetadata(EndpointReference axis2EPR, Element...metadata)
+ throws Exception {
+ if (metadata != null) {
+ for (Element element : metadata) {
+ OMElement omElement = XMLUtils.toOM(element);
+ axis2EPR.addMetaData(omElement);
+ }
+ }
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/context/WebServiceContextImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/context/WebServiceContextImpl.java?rev=576353&r1=576352&r2=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/context/WebServiceContextImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/context/WebServiceContextImpl.java Mon Sep 17 03:30:45 2007
@@ -18,16 +18,8 @@
*/
package org.apache.axis2.jaxws.context;
-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.factory.EndpointReferenceFactory;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceBuilder;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceConverter;
-import org.apache.axis2.jaxws.registry.FactoryRegistry;
-import org.apache.axis2.util.XMLUtils;
+import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -110,9 +102,7 @@
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {
EndpointReference jaxwsEPR = null;
- String addressingNamespace = getAddressingNamespace(clazz);
-
- //TODO: Need to understand how the binding can influence the behaviour of this method.
+ String addressingNamespace = EndpointReferenceUtils.getAddressingNamespace(clazz);
if (soapMessageContext != null) {
QName service = (QName) soapMessageContext.get(MessageContext.WSDL_SERVICE);
@@ -120,17 +110,11 @@
URI wsdlURI = (URI) soapMessageContext.get(MessageContext.WSDL_DESCRIPTION);
org.apache.axis2.addressing.EndpointReference axis2EPR =
- EndpointReferenceBuilder.createEndpointReference(null, service, endpoint, wsdlURI.toString(), addressingNamespace);
+ EndpointReferenceUtils.createAxis2EndpointReference(null, service, endpoint, wsdlURI.toString(), addressingNamespace);
try {
- if (referenceParameters != null) {
- for (Element element : referenceParameters) {
- OMElement omElement = XMLUtils.toOM(element);
- axis2EPR.addReferenceParameter(omElement);
- }
- }
-
- jaxwsEPR = EndpointReferenceConverter.convertFromAxis2(axis2EPR, addressingNamespace);
+ EndpointReferenceUtils.addReferenceParameters(axis2EPR, referenceParameters);
+ jaxwsEPR = EndpointReferenceUtils.convertFromAxis2(axis2EPR, addressingNamespace);
}
catch (Exception e) {
//TODO NLS enable.
@@ -139,7 +123,7 @@
}
else {
//TODO NLS enable.
- throw ExceptionFactory.makeWebServiceException("Unable to create endpoint references.");
+ throw new IllegalStateException("Message context not available.");
}
return clazz.cast(jaxwsEPR);
@@ -147,11 +131,5 @@
public EndpointReference getEndpointReference(Element... referenceParameters) {
return getEndpointReference(W3CEndpointReference.class, referenceParameters);
- }
-
- private String getAddressingNamespace(Class clazz) {
- EndpointReferenceFactory eprFactory =
- (EndpointReferenceFactory) FactoryRegistry.getFactory(EndpointReferenceFactory.class);
- return eprFactory.getAddressingNamespace(clazz);
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java?rev=576353&r1=576352&r2=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java Mon Sep 17 03:30:45 2007
@@ -19,9 +19,10 @@
package org.apache.axis2.jaxws.registry;
-import org.apache.axis2.jaxws.addressing.factory.EndpointReferenceFactory;
-import org.apache.axis2.jaxws.addressing.factory.EndpointReferenceFactoryImpl;
-import org.apache.axis2.jaxws.addressing.util.EndpointMap;
+import org.apache.axis2.jaxws.addressing.factory.Axis2EndpointReferenceFactory;
+import org.apache.axis2.jaxws.addressing.factory.Axis2EndpointReferenceFactoryImpl;
+import org.apache.axis2.jaxws.addressing.factory.JAXWSEndpointReferenceFactory;
+import org.apache.axis2.jaxws.addressing.factory.JAXWSEndpointReferenceFactoryImpl;
import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManagerFactory;
import org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockFactoryImpl;
import org.apache.axis2.jaxws.message.databinding.impl.OMBlockFactoryImpl;
@@ -67,8 +68,8 @@
table.put(HandlerLifecycleManagerFactory.class, new HandlerLifecycleManagerFactory());
table.put(ClassFinderFactory.class, new ClassFinderFactory());
table.put(EndpointDispatcherFactory.class, new EndpointDispatcherFactory());
- table.put(EndpointReferenceFactory.class, new EndpointReferenceFactoryImpl());
- table.put(EndpointMap.class, new EndpointMap());
+ table.put(JAXWSEndpointReferenceFactory.class, new JAXWSEndpointReferenceFactoryImpl());
+ table.put(Axis2EndpointReferenceFactory.class, new Axis2EndpointReferenceFactoryImpl());
table.put(ExecutorFactory.class, new JAXWSExecutorFactory());
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java?rev=576353&r1=576352&r2=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java Mon Sep 17 03:30:45 2007
@@ -25,7 +25,8 @@
import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceBuilder;
+import org.apache.axis2.jaxws.addressing.factory.Axis2EndpointReferenceFactory;
+import org.apache.axis2.jaxws.addressing.factory.Axis2EndpointReferenceFactoryImpl;
import org.apache.axis2.jaxws.binding.SOAPBinding;
import org.apache.axis2.jaxws.core.InvocationContext;
import org.apache.axis2.jaxws.core.MessageContext;
@@ -36,7 +37,6 @@
import org.apache.axis2.jaxws.handler.HandlerChainProcessor;
import org.apache.axis2.jaxws.handler.HandlerInvokerUtils;
import org.apache.axis2.jaxws.handler.HandlerResolverImpl;
-import org.apache.axis2.jaxws.handler.MEPContext;
import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.Protocol;
@@ -319,7 +319,9 @@
axisSvc = ed.getAxisService();
try {
- EndpointReferenceBuilder.addAddress(service, endpoint, axisSvc.getEPRs()[0]);
+ Axis2EndpointReferenceFactoryImpl axis2EPRFactory =
+ (Axis2EndpointReferenceFactoryImpl) FactoryRegistry.getFactory(Axis2EndpointReferenceFactory.class);
+ axis2EPRFactory.addAddress(service, endpoint, axisSvc.getEPRs()[0]);
}
catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(e);
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java?rev=576353&r1=576352&r2=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java Mon Sep 17 03:30:45 2007
@@ -18,24 +18,19 @@
*/
package org.apache.axis2.jaxws.server.endpoint;
-import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.addressing.factory.EndpointReferenceFactory;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceBuilder;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceConverter;
+import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
import org.apache.axis2.jaxws.binding.BindingUtils;
import org.apache.axis2.jaxws.description.DescriptionFactory;
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
-import org.apache.axis2.jaxws.registry.FactoryRegistry;
import org.apache.axis2.transport.http.HTTPWorkerFactory;
import org.apache.axis2.transport.http.server.SimpleHttpServer;
import org.apache.axis2.transport.http.server.WorkerFactory;
-import org.apache.axis2.util.XMLUtils;
import org.w3c.dom.Element;
import javax.xml.namespace.QName;
@@ -217,26 +212,21 @@
@Override
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {
EndpointReference jaxwsEPR = null;
- String addressingNamespace = getAddressingNamespace(clazz);
+ String addressingNamespace = EndpointReferenceUtils.getAddressingNamespace(clazz);
String address = endpointDesc.getEndpointAddress();
QName serviceName = endpointDesc.getServiceQName();
QName portName = endpointDesc.getPortQName();
URL wsdlURL = ((ServiceDescriptionWSDL) endpointDesc.getServiceDescription()).getWSDLLocation();
- //TODO: Need to understand how the binding can influence the behaviour of this method.
+ if (!BindingUtils.isSOAPBinding(binding.getBindingID()))
+ throw new UnsupportedOperationException("This method is unsupported for the binding: " + binding.getBindingID());
org.apache.axis2.addressing.EndpointReference axis2EPR =
- EndpointReferenceBuilder.createEndpointReference(address, serviceName, portName, wsdlURL.toString(), addressingNamespace);
+ EndpointReferenceUtils.createAxis2EndpointReference(address, serviceName, portName, wsdlURL.toString(), addressingNamespace);
try {
- if (referenceParameters != null) {
- for (Element element : referenceParameters) {
- OMElement omElement = XMLUtils.toOM(element);
- axis2EPR.addReferenceParameter(omElement);
- }
- }
-
- jaxwsEPR = EndpointReferenceConverter.convertFromAxis2(axis2EPR, addressingNamespace);
+ EndpointReferenceUtils.addReferenceParameters(axis2EPR, referenceParameters);
+ jaxwsEPR = EndpointReferenceUtils.convertFromAxis2(axis2EPR, addressingNamespace);
}
catch (Exception e) {
//TODO NLS enable.
@@ -249,11 +239,5 @@
@Override
public EndpointReference getEndpointReference(Element... referenceParameters) {
return getEndpointReference(W3CEndpointReference.class, referenceParameters);
- }
-
- private String getAddressingNamespace(Class clazz) {
- EndpointReferenceFactory eprFactory =
- (EndpointReferenceFactory) FactoryRegistry.getFactory(EndpointReferenceFactory.class);
- return eprFactory.getAddressingNamespace(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=576353&r1=576352&r2=576353&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 Mon Sep 17 03:30:45 2007
@@ -35,11 +35,8 @@
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.factory.EndpointReferenceFactory;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceBuilder;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceConverter;
+import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.registry.FactoryRegistry;
import org.apache.axis2.jaxws.server.endpoint.EndpointImpl;
import org.apache.axis2.util.XMLUtils;
import org.w3c.dom.Element;
@@ -50,6 +47,7 @@
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) {
@@ -75,29 +73,19 @@
List<Element> metadata,
String wsdlDocumentLocation,
List<Element> referenceParameters) {
- String addressingNamespace = getAddressingNamespace(W3CEndpointReference.class);
+ String addressingNamespace =
+ EndpointReferenceUtils.getAddressingNamespace(W3CEndpointReference.class);
org.apache.axis2.addressing.EndpointReference axis2EPR =
- EndpointReferenceBuilder.createEndpointReference(address, serviceName, portName, wsdlDocumentLocation, addressingNamespace);
+ EndpointReferenceUtils.createAxis2EndpointReference(address, serviceName, portName, wsdlDocumentLocation, addressingNamespace);
W3CEndpointReference w3cEPR = null;
try {
- if (metadata != null) {
- for (Element element : metadata) {
- OMElement omElement = XMLUtils.toOM(element);
- axis2EPR.addMetaData(omElement);
- }
- }
-
- if (referenceParameters != null) {
- for (Element element : referenceParameters) {
- OMElement omElement = XMLUtils.toOM(element);
- axis2EPR.addReferenceParameter(omElement);
- }
- }
-
+ EndpointReferenceUtils.addMetadata(axis2EPR, metadata.toArray(ZERO_LENGTH_ARRAY));
+ EndpointReferenceUtils.addReferenceParameters(axis2EPR, referenceParameters.toArray(ZERO_LENGTH_ARRAY));
+
w3cEPR =
- (W3CEndpointReference) EndpointReferenceConverter.convertFromAxis2(axis2EPR, addressingNamespace);
+ (W3CEndpointReference) EndpointReferenceUtils.convertFromAxis2(axis2EPR, addressingNamespace);
}
catch (Exception e) {
//TODO NLS enable.
@@ -121,14 +109,14 @@
org.apache.axis2.addressing.EndpointReference axis2EPR = null;
try {
- axis2EPR = EndpointReferenceConverter.convertToAxis2(jaxwsEPR);
+ axis2EPR = EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
}
catch (Exception e) {
//TODO NLS enable.
throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
}
- String addressingNamespace = getAddressingNamespace(jaxwsEPR.getClass());
+ String addressingNamespace = EndpointReferenceUtils.getAddressingNamespace(jaxwsEPR.getClass());
org.apache.axis2.jaxws.spi.ServiceDelegate serviceDelegate = null;
try {
@@ -157,10 +145,10 @@
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
OMElement eprElement = (OMElement) XMLUtils.toOM(bais);
org.apache.axis2.addressing.EndpointReference axis2EPR =
- EndpointReferenceBuilder.createEndpointReference("");
+ EndpointReferenceUtils.createAxis2EndpointReference("");
String addressingNamespace = EndpointReferenceHelper.fromOM(axis2EPR, eprElement);
- jaxwsEPR = EndpointReferenceConverter.convertFromAxis2(axis2EPR, addressingNamespace);
+ jaxwsEPR = EndpointReferenceUtils.convertFromAxis2(axis2EPR, addressingNamespace);
}
catch (Exception e) {
//TODO NLS enable.
@@ -168,11 +156,5 @@
}
return jaxwsEPR;
- }
-
- private String getAddressingNamespace(Class clazz) {
- EndpointReferenceFactory eprFactory =
- (EndpointReferenceFactory) FactoryRegistry.getFactory(EndpointReferenceFactory.class);
- return eprFactory.getAddressingNamespace(clazz);
}
}
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=576353&r1=576352&r2=576353&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 Mon Sep 17 03:30:45 2007
@@ -24,8 +24,7 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.addressing.factory.EndpointReferenceFactory;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceConverter;
+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;
@@ -155,15 +154,15 @@
org.apache.axis2.addressing.EndpointReference axis2EPR = null;
try {
- axis2EPR = EndpointReferenceConverter.convertToAxis2(jaxwsEPR);
+ axis2EPR = EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
}
catch (Exception e) {
//TODO NLS enable.
throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
}
- String addressingNamespace = getAddressingNamespace(jaxwsEPR.getClass());
-
+ String addressingNamespace =
+ EndpointReferenceUtils.getAddressingNamespace(jaxwsEPR.getClass());
EndpointDescription endpointDesc =
DescriptionFactory.updateEndpoint(serviceDescription, null, axis2EPR,
addressingNamespace,
@@ -199,15 +198,15 @@
org.apache.axis2.addressing.EndpointReference axis2EPR = null;
try {
- axis2EPR = EndpointReferenceConverter.convertToAxis2(jaxwsEPR);
+ axis2EPR = EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
}
catch (Exception e) {
//TODO NLS enable.
throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
}
- String addressingNamespace = getAddressingNamespace(jaxwsEPR.getClass());
-
+ String addressingNamespace =
+ EndpointReferenceUtils.getAddressingNamespace(jaxwsEPR.getClass());
EndpointDescription endpointDesc =
DescriptionFactory.updateEndpoint(serviceDescription, null, axis2EPR,
addressingNamespace,
@@ -348,14 +347,15 @@
org.apache.axis2.addressing.EndpointReference axis2EPR = null;
try {
- axis2EPR = EndpointReferenceConverter.convertToAxis2(jaxwsEPR);
+ axis2EPR = EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
}
catch (Exception e) {
//TODO NLS enable.
throw ExceptionFactory.makeWebServiceException("Invalid endpoint reference.", e);
}
- String addressingNamespace = getAddressingNamespace(jaxwsEPR.getClass());
+ String addressingNamespace =
+ EndpointReferenceUtils.getAddressingNamespace(jaxwsEPR.getClass());
return getPort(axis2EPR, addressingNamespace, sei, features);
}
@@ -545,12 +545,6 @@
ExecutorFactory executorFactory = (ExecutorFactory) FactoryRegistry.getFactory(
ExecutorFactory.class);
return executorFactory.getExecutorInstance();
- }
-
- private String getAddressingNamespace(Class clazz) {
- EndpointReferenceFactory eprFactory =
- (EndpointReferenceFactory) FactoryRegistry.getFactory(EndpointReferenceFactory.class);
- return eprFactory.getAddressingNamespace(clazz);
}
private boolean isValidServiceName() {
Copied: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java (from r572368, webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverterTests.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java?p2=webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java&p1=webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverterTests.java&r1=572368&r2=576353&rev=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceConverterTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtilsTests.java Mon Sep 17 03:30:45 2007
@@ -37,7 +37,7 @@
import org.apache.axis2.addressing.AddressingConstants.Final;
import org.apache.axis2.addressing.AddressingConstants.Submission;
import org.apache.axis2.jaxws.addressing.SubmissionEndpointReference;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceConverter;
+import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
import org.custommonkey.xmlunit.XMLTestCase;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
@@ -46,7 +46,7 @@
* This class uses the JAX-WS Dispatch API to test sending and receiving
* messages using SOAP 1.2.
*/
-public class EndpointReferenceConverterTests extends XMLTestCase {
+public class EndpointReferenceUtilsTests extends XMLTestCase {
private static final OMFactory OMF = OMAbstractFactory.getOMFactory();
private static final QName ELEMENT200508 =
new QName(Final.WSA_NAMESPACE, "EndpointReference", "wsa");
@@ -78,7 +78,7 @@
"<axis2:EPRExt axis2:AttrExt=\"123456789\">123456789</axis2:EPRExt>"+
"</wsa:EndpointReference>";
- public EndpointReferenceConverterTests(String name) {
+ public EndpointReferenceUtilsTests(String name) {
super(name);
}
@@ -91,11 +91,11 @@
org.apache.axis2.addressing.EndpointReference axis2EPR =
EndpointReferenceHelper.fromOM(omElement);
W3CEndpointReference jaxwsEPR =
- (W3CEndpointReference) EndpointReferenceConverter.convertFromAxis2(axis2EPR, Final.WSA_NAMESPACE);
+ (W3CEndpointReference) EndpointReferenceUtils.convertFromAxis2(axis2EPR, Final.WSA_NAMESPACE);
assertXMLEqual(EPR200508, jaxwsEPR.toString());
org.apache.axis2.addressing.EndpointReference axis2Result =
- EndpointReferenceConverter.convertToAxis2(jaxwsEPR);
+ EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
OMElement eprElement =
EndpointReferenceHelper.toOM(OMF, axis2Result, ELEMENT200508, Final.WSA_NAMESPACE);
assertXMLEqual(EPR200508, eprElement.toString());
@@ -110,13 +110,13 @@
W3CEndpointReference jaxwsEPR = new W3CEndpointReference(source);
org.apache.axis2.addressing.EndpointReference axis2EPR =
- EndpointReferenceConverter.convertToAxis2(jaxwsEPR);
+ EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
OMElement eprElement =
EndpointReferenceHelper.toOM(OMF, axis2EPR, ELEMENT200508, Final.WSA_NAMESPACE);
assertXMLEqual(EPR200508, eprElement.toString());
W3CEndpointReference jaxwsResult =
- (W3CEndpointReference) EndpointReferenceConverter.convertFromAxis2(axis2EPR, Final.WSA_NAMESPACE);
+ (W3CEndpointReference) EndpointReferenceUtils.convertFromAxis2(axis2EPR, Final.WSA_NAMESPACE);
assertXMLEqual(EPR200508, jaxwsResult.toString());
}
@@ -129,11 +129,11 @@
org.apache.axis2.addressing.EndpointReference axis2EPR =
EndpointReferenceHelper.fromOM(omElement);
SubmissionEndpointReference jaxwsEPR =
- (SubmissionEndpointReference) EndpointReferenceConverter.convertFromAxis2(axis2EPR, Submission.WSA_NAMESPACE);
+ (SubmissionEndpointReference) EndpointReferenceUtils.convertFromAxis2(axis2EPR, Submission.WSA_NAMESPACE);
assertXMLEqual(EPR200408, jaxwsEPR.toString());
org.apache.axis2.addressing.EndpointReference axis2Result =
- EndpointReferenceConverter.convertToAxis2(jaxwsEPR);
+ EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
OMElement eprElement =
EndpointReferenceHelper.toOM(OMF, axis2Result, ELEMENT200408, Submission.WSA_NAMESPACE);
assertXMLEqual(EPR200408, eprElement.toString());
@@ -148,19 +148,19 @@
SubmissionEndpointReference jaxwsEPR = new SubmissionEndpointReference(source);
org.apache.axis2.addressing.EndpointReference axis2EPR =
- EndpointReferenceConverter.convertToAxis2(jaxwsEPR);
+ EndpointReferenceUtils.convertToAxis2(jaxwsEPR);
OMElement eprElement =
EndpointReferenceHelper.toOM(OMF, axis2EPR, ELEMENT200408, Submission.WSA_NAMESPACE);
assertXMLEqual(EPR200408, eprElement.toString());
SubmissionEndpointReference jaxwsResult =
- (SubmissionEndpointReference) EndpointReferenceConverter.convertFromAxis2(axis2EPR, Submission.WSA_NAMESPACE);
+ (SubmissionEndpointReference) EndpointReferenceUtils.convertFromAxis2(axis2EPR, Submission.WSA_NAMESPACE);
assertXMLEqual(EPR200408, jaxwsResult.toString());
}
public void testFailures() throws Exception {
try {
- EndpointReferenceConverter.convertFromAxis2(null, Final.WSA_NAMESPACE);
+ EndpointReferenceUtils.convertFromAxis2(null, Final.WSA_NAMESPACE);
fail("Expected a failure.");
}
catch (Exception e) {
@@ -168,7 +168,7 @@
}
try {
- EndpointReferenceConverter.convertFromAxis2(null, Submission.WSA_NAMESPACE);
+ EndpointReferenceUtils.convertFromAxis2(null, Submission.WSA_NAMESPACE);
fail("Expected a failure.");
}
catch (Exception e) {
@@ -176,7 +176,7 @@
}
try {
- EndpointReferenceConverter.convertFromAxis2(null, null);
+ EndpointReferenceUtils.convertFromAxis2(null, null);
fail("Expected a failure.");
}
catch (Exception e) {
@@ -184,7 +184,7 @@
}
try {
- EndpointReferenceConverter.convertToAxis2(null);
+ EndpointReferenceUtils.convertToAxis2(null);
fail("Expected a failure.");
}
catch (Exception e) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?rev=576353&r1=576352&r2=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Mon Sep 17 03:30:45 2007
@@ -23,7 +23,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.axis2.jaxws.addressing.util.EndpointReferenceConverterTests;
+import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtilsTests;
import org.apache.axis2.jaxws.anytype.tests.AnyTypeTests;
import org.apache.axis2.jaxws.attachments.MTOMSerializationTests;
import org.apache.axis2.jaxws.client.ClientConfigTests;
@@ -136,7 +136,7 @@
suite.addTestSuite(BindingToProtocolTests.class);
// ------ Addressing Tests ------
- suite.addTestSuite(EndpointReferenceConverterTests.class);
+ suite.addTestSuite(EndpointReferenceUtilsTests.class);
// ------ Metadata Tests ------
suite.addTestSuite(WSDLTests.class);
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java?rev=576353&r1=576352&r2=576353&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java Mon Sep 17 03:30:45 2007
@@ -49,8 +49,8 @@
SubmissionAddressing submissionAddressing =
(SubmissionAddressing) ((EndpointDescriptionJava) endpointDescription).getAnnoFeature(SubmissionAddressingFeature.ID);
AxisService service = endpointDescription.getAxisService();
- Parameter namespace = new Parameter("addressingNamespace", null);
- Parameter disable = new Parameter("disableAddressingHandlers", Boolean.FALSE);
+ Parameter namespace = new Parameter(AddressingConstants.WS_ADDRESSING_VERSION, null);
+ Parameter disable = new Parameter(AddressingConstants.DISABLE_ADDRESSING_HANDLERS, Boolean.FALSE);
String addressingRequired = AddressingConstants.ADDRESSING_UNSPECIFIED;
if (addressing != null && submissionAddressing != null) {
@@ -123,10 +123,12 @@
service.addParameter(disable);
service.setWSAddressingFlag(addressingRequired);
- ServiceDescription sd = endpointDescription.getServiceDescription();
- AxisConfiguration axisConfig = sd.getAxisConfigContext().getAxisConfiguration();
- if (!axisConfig.isEngaged(Constants.MODULE_ADDRESSING))
- axisConfig.engageModule(Constants.MODULE_ADDRESSING);
+ if (!(Boolean)disable.getValue()) {
+ ServiceDescription sd = endpointDescription.getServiceDescription();
+ AxisConfiguration axisConfig = sd.getAxisConfigContext().getAxisConfiguration();
+ if (!axisConfig.isEngaged(Constants.MODULE_ADDRESSING))
+ axisConfig.engageModule(Constants.MODULE_ADDRESSING);
+ }
}
catch (Exception e) {
//TODO NLS enable.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org