You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ba...@apache.org on 2006/11/20 20:48:26 UTC
svn commit: r477307 [1/2] - in /webservices/axis2/trunk/java/modules/jaxws:
src/org/apache/axis2/jaxws/ src/org/apache/axis2/jaxws/client/
src/org/apache/axis2/jaxws/client/proxy/
src/org/apache/axis2/jaxws/description/ src/org/apache/axis2/jaxws/descr...
Author: barrettj
Date: Mon Nov 20 11:48:21 2006
New Revision: 477307
URL: http://svn.apache.org/viewvc?view=rev&rev=477307
Log:
AXIS2-1753
Added SPI to navigate to EndpointDescription and ServiceDelegate; refactored PortData and PortInfoImpl into EndpointDescription and added a method to return a PortInfo from it; added and expanded tests.
Added:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/PortInfoImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/GetDescFromBindingProvider.java
Removed:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/PortData.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/PortInfoImpl.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/JAXWSClientContext.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/JAXBDispatch.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionFactory.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ParameterDescription.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ParameterDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDLWrapper.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java Mon Nov 20 11:48:21 2006
@@ -23,17 +23,22 @@
import javax.xml.ws.Binding;
+
import org.apache.axis2.jaxws.binding.SOAPBinding;
+import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.spi.ServiceDelegate;
import org.apache.axis2.transport.http.HTTPConstants;
-public class BindingProvider implements javax.xml.ws.BindingProvider {
+public class BindingProvider implements org.apache.axis2.jaxws.spi.BindingProvider {
protected Map<String, Object> requestContext;
protected Map<String, Object> responseContext;
protected Binding binding;
+ protected EndpointDescription endpointDesc;
+ protected ServiceDelegate serviceDelegate;
- public BindingProvider() {
+ private BindingProvider() {
requestContext = new Hashtable<String,Object>();
responseContext = new Hashtable<String,Object>();
@@ -44,6 +49,19 @@
//The default Binding is the SOAPBinding
binding = new SOAPBinding();
+ }
+
+ public BindingProvider(ServiceDelegate svcDelegate, EndpointDescription epDesc) {
+ this();
+ endpointDesc = epDesc;
+ serviceDelegate = svcDelegate;
+ }
+
+ public ServiceDelegate getServiceDelegate() {
+ return serviceDelegate;
+ }
+ public EndpointDescription getEndpointDescription() {
+ return endpointDesc;
}
public Binding getBinding() {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/JAXWSClientContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/JAXWSClientContext.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/JAXWSClientContext.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/JAXWSClientContext.java Mon Nov 20 11:48:21 2006
@@ -24,15 +24,15 @@
import javax.xml.bind.JAXBContext;
import javax.xml.ws.Service.Mode;
+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.handler.PortData;
import org.apache.axis2.jaxws.util.WSDLWrapper;
public class JAXWSClientContext<T> {
- private PortData port = null;
- private Mode serviceMode = null;
+ private EndpointDescription endpointDesc = null;
+ private Mode serviceMode = null;
private ExecutorService executor = null;
private ServiceDescription serviceDescription;
private Class<T> clazz = null; //SEI class for Proxy or Implementation type for Dispatch
@@ -44,12 +44,13 @@
public void setExecutor(Executor executor) {
this.executor = (ExecutorService)executor;
}
- public PortData getPort() {
- return port;
- }
- public void setPort(PortData port) {
- this.port = port;
- }
+
+ public EndpointDescription getEndpointDescription() {
+ return endpointDesc;
+ }
+ public void setEndpointDescription(EndpointDescription epDesc) {
+ this.endpointDesc = epDesc;
+ }
public Mode getServiceMode() {
return serviceMode;
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java Mon Nov 20 11:48:21 2006
@@ -16,7 +16,6 @@
*/
package org.apache.axis2.jaxws.client;
-import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
@@ -36,14 +35,11 @@
import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.core.controller.AxisInvocationController;
import org.apache.axis2.jaxws.core.controller.InvocationController;
-import org.apache.axis2.jaxws.handler.PortData;
-import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.impl.AsyncListener;
+import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.MessageException;
import org.apache.axis2.jaxws.message.XMLFault;
import org.apache.axis2.jaxws.spi.ServiceDelegate;
-import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -53,15 +49,12 @@
private Log log = LogFactory.getLog(BaseDispatch.class);
protected InvocationController ic;
- protected ServiceDelegate serviceDelegate;
protected ServiceClient serviceClient;
protected Mode mode;
- protected PortData port;
- protected BaseDispatch(PortData p) {
- super();
+ protected BaseDispatch(ServiceDelegate svcDelgate, EndpointDescription epDesc) {
+ super(svcDelgate, epDesc);
- port = p;
ic = new AxisInvocationController();
setRequestContext();
}
@@ -312,7 +305,7 @@
//FIXME: This needs to be moved up to the BindingProvider and should actually
//be called "initRequestContext()" or something like that.
protected void setRequestContext(){
- String endPointAddress = port.getEndpointAddress();
+ String endPointAddress = endpointDesc.getEndpointAddress();
//WSDLWrapper wsdl = axisController.getWSDLContext();
//QName serviceName = axisController.getServiceName();
//QName portName = axisController.getPortName();
@@ -331,15 +324,6 @@
// getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, soapAction);
//}
}
-
- public ServiceDelegate getServiceDelegate() {
- return serviceDelegate;
- }
-
- public void setServiceDelegate(ServiceDelegate sd) {
- serviceDelegate = sd;
- }
-
public void setServiceClient(ServiceClient sc) {
serviceClient = sc;
}
@@ -352,10 +336,6 @@
mode = m;
}
- public PortData getPort() {
- return port;
- }
-
/*
* Configure any properties that will be needed on the Message
*/
@@ -370,7 +350,7 @@
// Check if the user enabled MTOM using the SOAP binding
// properties for MTOM
- String bindingID = this.port.getBindingID();
+ String bindingID = endpointDesc.getClientBindingID();
if((bindingID.equalsIgnoreCase(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
bindingID.equalsIgnoreCase(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) &&
!msg.isMTOMEnabled()){
@@ -384,7 +364,7 @@
* a violation.
*/
private boolean isValidInvocationParam(Object object){
- String bindingId = port.getBindingID();
+ String bindingId = endpointDesc.getClientBindingID();
// If no bindingId was found, use the default.
if (bindingId == null) {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/JAXBDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/JAXBDispatch.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/JAXBDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/JAXBDispatch.java Mon Nov 20 11:48:21 2006
@@ -20,23 +20,22 @@
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.client.async.AsyncResponse;
-import org.apache.axis2.jaxws.handler.PortData;
-import org.apache.axis2.jaxws.impl.AsyncListener;
+import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.message.Block;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.Protocol;
import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
-import org.apache.axis2.jaxws.message.databinding.JAXBUtils;
import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
import org.apache.axis2.jaxws.message.factory.MessageFactory;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.spi.ServiceDelegate;
public class JAXBDispatch<T> extends BaseDispatch<T> {
private JAXBContext jaxbContext;
- public JAXBDispatch(PortData pd) {
- super(pd);
+ public JAXBDispatch(ServiceDelegate svcDelegate, EndpointDescription epDesc) {
+ super(svcDelegate, epDesc);
}
public JAXBContext getJAXBContext() {
@@ -70,7 +69,7 @@
// The protocol of the Message that is created should be based
// on the binding information available.
- Protocol proto = Protocol.getProtocolForBinding(port.getBindingID());
+ Protocol proto = Protocol.getProtocolForBinding(endpointDesc.getClientBindingID());
MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
message = mf.create(proto);
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java Mon Nov 20 11:48:21 2006
@@ -26,7 +26,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.client.async.AsyncResponse;
-import org.apache.axis2.jaxws.handler.PortData;
+import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.message.Block;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.MessageException;
@@ -37,6 +37,7 @@
import org.apache.axis2.jaxws.message.factory.SourceBlockFactory;
import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.spi.ServiceDelegate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -46,8 +47,8 @@
private Class type;
private Class blockFactoryType;
- public XMLDispatch(PortData pd) {
- super(pd);
+ public XMLDispatch(ServiceDelegate svcDelegate, EndpointDescription enpdointDesc) {
+ super(svcDelegate, enpdointDesc);
}
public Class getType() {
@@ -83,7 +84,7 @@
}
try{
blockFactoryType = getBlockFactory();
- return createEmptyMessage(Protocol.getProtocolForBinding(port.getBindingID()));
+ return createEmptyMessage(Protocol.getProtocolForBinding(endpointDesc.getClientBindingID()));
}catch(MessageException e){
throw ExceptionFactory.makeWebServiceException(e);
@@ -107,7 +108,7 @@
// The protocol of the Message that is created should be based
// on the binding information available.
- Protocol proto = Protocol.getProtocolForBinding(port.getBindingID());
+ Protocol proto = Protocol.getProtocolForBinding(endpointDesc.getClientBindingID());
message = mf.create(proto);
message.setBodyBlock(0, block);
} catch (Exception e) {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java Mon Nov 20 11:48:21 2006
@@ -39,10 +39,10 @@
import org.apache.axis2.jaxws.core.controller.AxisInvocationController;
import org.apache.axis2.jaxws.core.controller.InvocationController;
import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.EndpointDescriptionWSDL;
import org.apache.axis2.jaxws.description.OperationDescription;
import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
-import org.apache.axis2.jaxws.handler.PortData;
import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
@@ -92,23 +92,16 @@
private static Log log = LogFactory.getLog(JAXWSProxyHandler.class);
//Reference to ServiceDelegate instance that was used to create the Proxy
- private ServiceDelegate delegate = null;
protected ServiceDescription serviceDesc = null;
- protected EndpointDescription endpointDesc = null;
protected OperationDescription operationDesc = null;
protected MethodMarshaller methodMarshaller = null;
- private PortData port = null;
private Class seiClazz = null;
private Method method = null;
- public JAXWSProxyHandler(ServiceDelegate delegate, Class seiClazz, PortData port) {
- super();
- this.delegate = delegate;
+ public JAXWSProxyHandler(ServiceDelegate delegate, Class seiClazz, EndpointDescription epDesc) {
+ super(delegate, epDesc);
this.seiClazz = seiClazz;
- this.port = port;
this.serviceDesc=delegate.getServiceDescription();
-// FIXME: This probably needs to be more robust; can there be > 1 endpoints; if so, how choose which one?
- this.endpointDesc = serviceDesc.getEndpointDescription(seiClazz)[0];
initRequestContext();
}
@@ -180,7 +173,7 @@
requestContext.setOperationDescription(operationDesc);
requestIC.setRequestMessageContext(requestContext);
InvocationController controller = new AxisInvocationController();
- requestIC.setServiceClient(delegate.getServiceClient(port.getPortName()));
+ requestIC.setServiceClient(serviceDelegate.getServiceClient(endpointDesc.getPortQName()));
//check if the call is OneWay, Async or Sync
//if(operationDesc.isOneWay() || method.getReturnType().getName().equals("void")){
@@ -215,7 +208,7 @@
}
AsyncResponse listener = createProxyListener(args);
requestIC.setAsyncResponseListener(listener);
- requestIC.setExecutor(delegate.getExecutor());
+ requestIC.setExecutor(serviceDelegate.getExecutor());
Future<?> future = controller.invokeAsync(requestIC, asyncHandler);
@@ -235,7 +228,7 @@
}
AsyncResponse listener = createProxyListener(args);
requestIC.setAsyncResponseListener(listener);
- requestIC.setExecutor(delegate.getExecutor());
+ requestIC.setExecutor(serviceDelegate.getExecutor());
Response response = controller.invokeAsync(requestIC);
@@ -342,42 +335,27 @@
return false;
}
- public void setDelegate(ServiceDelegate delegate) {
- this.delegate = delegate;
- }
-
protected void initRequestContext() {
String soapAddress = null;
String soapAction = null;
- String endPointAddress = port.getEndpointAddress();
- WSDLWrapper wsdl = ((ServiceDescriptionWSDL) delegate.getServiceDescription()).getWSDLWrapper();
- QName serviceName = delegate.getServiceName();
- QName portName = port.getPortName();
+ String endPointAddress = endpointDesc.getEndpointAddress();
+ WSDLWrapper wsdl = ((ServiceDescriptionWSDL) serviceDelegate.getServiceDescription()).getWSDLWrapper();
+ QName serviceName = serviceDelegate.getServiceName();
+ QName portName = endpointDesc.getPortQName();
+ soapAddress = ((EndpointDescriptionWSDL) endpointDesc).getWSDLSOAPAddress();
if (wsdl != null) {
- soapAddress = wsdl.getSOAPAddress(serviceName, portName);
+ // FIXME: This is getting the Action from the FIRST operation; that seems wrong!
soapAction = wsdl.getSOAPAction(serviceName, portName);
}
super.initRequestContext(endPointAddress, soapAddress, soapAction);
}
- protected ServiceDelegate getDelegate() {
- return delegate;
- }
-
private boolean isPublic(Method method){
return Modifier.isPublic(method.getModifiers());
}
private boolean isMethodExcluded(){
return operationDesc.isExcluded();
- }
-
- public PortData getPort() {
- return port;
- }
-
- public void setPort(PortData port) {
- this.port = port;
}
public Class getSeiClazz() {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionFactory.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionFactory.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionFactory.java Mon Nov 20 11:48:21 2006
@@ -62,7 +62,7 @@
* @param portName Can be null
* @return
*/
- public static ServiceDescription updateEndpoint(ServiceDescription serviceDescription, Class sei, QName portQName, ServiceDescription.UpdateType updateType ) {
+ public static EndpointDescription updateEndpoint(ServiceDescription serviceDescription, Class sei, QName portQName, ServiceDescription.UpdateType updateType ) {
return DescriptionFactoryImpl.updateEndpoint(serviceDescription, sei, portQName, updateType);
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java Mon Nov 20 11:48:21 2006
@@ -23,9 +23,12 @@
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
+import javax.xml.ws.handler.PortInfo;
+import javax.xml.ws.soap.SOAPBinding;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.jaxws.util.Constants;
/**
* An EndpointDescription corresponds to a particular Service Implementation. It
* can correspond to either either a client to that impl or the actual service
@@ -61,18 +64,48 @@
public interface EndpointDescription {
public static final String AXIS_SERVICE_PARAMETER = "org.apache.axis2.jaxws.description.EndpointDescription";
+ public static final String DEFAULT_CLIENT_BINDING_ID = SOAPBinding.SOAP11HTTP_BINDING;
+ public static final QName SOAP_11_ADDRESS_ELEMENT = new QName(Constants.URI_WSDL_SOAP11, "address");
+
public abstract AxisService getAxisService();
public abstract ServiceClient getServiceClient();
public abstract ServiceDescription getServiceDescription();
public abstract EndpointInterfaceDescription getEndpointInterfaceDescription();
+ /**
+ * Returns the JAX-WS handler PortInfo object for this endpoint.
+ * @return PortInfo
+ */
+ public abstract PortInfo getPortInfo();
+
public abstract boolean isProviderBased();
public abstract boolean isEndpointBased();
public abstract String getName();
public abstract String getTargetNamespace();
+ /**
+ * Returns the binding type FOR A SERVER. This is based on the BindingType annotation and/or the WSDL.
+ * This will return NULL if called on a client.
+ * @return
+ */
public abstract String getBindingType();
+ /**
+ * Set the binding type FOR A CLIENT. The BindingType annotation is not valid on the client per
+ * the JAX-WS spec. The value can be set via addPort(...) for a Dispatch client or via TBD for
+ * a Proxy client.
+ */
+ public abstract void setClientBindingID(String clientBindingID);
+ /**
+ * Return the binding type FOR A CLIENT. This will return NULL if called on the server.
+ * @see setClientBindingID();
+ * @return String representing the client binding type
+ */
+ public abstract String getClientBindingID();
+
+ public void setEndpointAddress(String endpointAddress);
+ public abstract String getEndpointAddress();
+
public abstract List<String> getHandlerList();
public abstract QName getPortQName();
public abstract QName getServiceQName();
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java Mon Nov 20 11:48:21 2006
@@ -32,6 +32,7 @@
public Port getWSDLPort();
public Binding getWSDLBinding();
public String getWSDLBindingType();
+ public String getWSDLSOAPAddress();
/**
* Is the WSDL definition fully specified for the endpoint (WSDL 1.1 port)
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java Mon Nov 20 11:48:21 2006
@@ -61,7 +61,7 @@
public abstract Class getSEIClass();
- // TODO: (JLB) These should return a locally defined Enums
+ // TODO: These should return a locally defined Enums
public abstract javax.jws.soap.SOAPBinding.ParameterStyle getSoapBindingParameterStyle();
public abstract javax.jws.soap.SOAPBinding.Style getSoapBindingStyle();
public abstract javax.jws.soap.SOAPBinding.Use getSoapBindingUse();
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java Mon Nov 20 11:48:21 2006
@@ -91,7 +91,7 @@
public String[] getParamNames();
- // TODO: (JLB) These should return Enums defined on this interface, not from the Annotation
+ // TODO: These should return Enums defined on this interface, not from the Annotation
public javax.jws.soap.SOAPBinding.ParameterStyle getSoapBindingParameterStyle();
public javax.jws.soap.SOAPBinding.Style getSoapBindingStyle();
public javax.jws.soap.SOAPBinding.Use getSoapBindingUse();
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ParameterDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ParameterDescription.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ParameterDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ParameterDescription.java Mon Nov 20 11:48:21 2006
@@ -49,7 +49,7 @@
*
*/
public interface ParameterDescription {
-// TODO: (JLB) Fix this to not be the WebParam mode
+// TODO: Fix this to not be the WebParam mode
// public enum Mode{IN, OUT, INOUT};
public OperationDescription getOperationDescription();
@@ -62,7 +62,7 @@
public Class getParameterActualType();
public boolean isHeader();
-// TODO: (JLB) Fix this to not be the WebParam mode
+// TODO: Fix this to not be the WebParam mode
public WebParam.Mode getMode();
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java Mon Nov 20 11:48:21 2006
@@ -21,21 +21,19 @@
/**
*
*/
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import javax.jws.WebService;
import javax.xml.namespace.QName;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.validator.ServiceDescriptionValidator;
+import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.ServiceDescription;
/**
@@ -106,12 +104,12 @@
* Can be null
* @return
*/
- public static ServiceDescription updateEndpoint(
+ public static EndpointDescription updateEndpoint(
ServiceDescription serviceDescription, Class sei, QName portQName,
ServiceDescription.UpdateType updateType) {
- ((ServiceDescriptionImpl) serviceDescription)
- .updateEndpointDescription(sei, portQName, updateType);
- return serviceDescription;
+ EndpointDescription endpointDesc =
+ ((ServiceDescriptionImpl) serviceDescription).updateEndpointDescription(sei, portQName, updateType);
+ return endpointDesc;
}
/**
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Mon Nov 20 11:48:21 2006
@@ -30,11 +30,15 @@
import javax.wsdl.Definition;
import javax.wsdl.Port;
import javax.wsdl.PortType;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingType;
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.SOAPBinding;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.ServiceClient;
@@ -58,6 +62,7 @@
import org.apache.axis2.jaxws.description.builder.WsdlComposite;
import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+import org.apache.axis2.jaxws.util.WSDLWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
@@ -76,6 +81,7 @@
private AxisService axisService;
private QName portQName;
+ private QName serviceQName;
// Corresponds to a port that was added dynamically via addPort and is not declared (either in WSDL or annotations)
private boolean isDynamicPort;
@@ -104,6 +110,15 @@
// Set of packages that are needed to marshal/unmashal data (used to set JAXBContext)
Set<Package> packages = null;
+ // The JAX-WS Handler port information corresponding to this endpoint
+ private PortInfo portInfo;
+
+ private String clientBindingID = DEFAULT_CLIENT_BINDING_ID;
+ // The effective endpoint address. It could be set by the client or come from the WSDL SOAP address
+ private String endpointAddress;
+ // The endpoint address from the WSDL soap:address extensibility element if present.
+ private String wsdlSOAPAddress;
+
private static final Log log = LogFactory.getLog(EndpointDescriptionImpl.class);
@@ -226,7 +241,10 @@
webServiceProviderAnnotation = composite.getWebServiceProviderAnnot();
// REVIEW: Maybe this should be an error if the name has already been set and it doesn't match
- getServiceDescriptionImpl().setServiceQName(getServiceQName());
+ // Note that on the client side, the service QN should be set; on the server side it will not be.
+ if (DescriptionUtils.isEmpty(getServiceDescription().getServiceQName())) {
+ getServiceDescriptionImpl().setServiceQName(getServiceQName());
+ }
//Call the getter to insure the qualified port name is set.
getPortQName();
@@ -449,7 +467,7 @@
}
public QName getPortQName() {
- // TODO: (JLB) Implement WSDL/Annotation merge? May be OK as is; not sure how would know WHICH port Qname to get out of the WSDL if
+ // REVIEW: Implement WSDL/Annotation merge? May be OK as is; not sure how would know WHICH port Qname to get out of the WSDL if
// we didn't use annotations.
if (portQName == null) {
// The name was not set by the constructors, so get it from the
@@ -464,10 +482,20 @@
}
public QName getServiceQName() {
- // REVIEW: Does this need to be cached in an instance variable like the others?
- String localPart = getAnnoWebServiceServiceName();
- String tns = getAnnoWebServiceTargetNamespace();
- return new QName(tns, localPart);
+ if (serviceQName == null) {
+ // If the service name has been set on the Service, use that. Otherwise
+ // get the name off the annotations
+ QName serviceDescQName = getServiceDescription().getServiceQName();
+ if (!DescriptionUtils.isEmpty(serviceDescQName)) {
+ serviceQName = serviceDescQName;
+ }
+ else {
+ String localPart = getAnnoWebServiceServiceName();
+ String tns = getAnnoWebServiceTargetNamespace();
+ serviceQName = new QName(tns, localPart);
+ }
+ }
+ return serviceQName;
}
public ServiceDescription getServiceDescription() {
@@ -1104,7 +1132,7 @@
}
public Service.Mode getServiceMode() {
- // TODO: (JLB) WSDL/Anno Merge
+ // REVIEW: WSDL/Anno Merge
return getAnnoServiceModeValue();
}
@@ -1139,7 +1167,7 @@
}
public String getBindingType() {
- // TODO: (JLB) Implement WSDL/Anno merge
+ // REVIEW: Implement WSDL/Anno merge?
return getAnnoBindingTypeValue();
}
@@ -1244,6 +1272,88 @@
}
return packages;
}
+ public PortInfo getPortInfo() {
+ if (portInfo == null) {
+ portInfo = new PortInfoImpl(getServiceQName(), getPortQName(), getBindingType());
+ }
+ return portInfo;
+ }
+ public void setClientBindingID(String clientBindingID) {
+
+ if (clientBindingID == null) {
+ this.clientBindingID = DEFAULT_CLIENT_BINDING_ID;
+ }
+ else if (validateClientBindingID(clientBindingID)) {
+ this.clientBindingID = clientBindingID;
+ }
+ else {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("addPortErr0", getPortQName().toString()));
+ }
+ }
+ private boolean validateClientBindingID(String bindingId) {
+ boolean isValid = true;
+ if (bindingId != null && !(bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
+ bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
+ bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
+ bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("addPortErr0", getPortQName().toString()));
+ }
+ return isValid;
+ }
+ public String getClientBindingID() {
+ return clientBindingID;
+ }
+ public void setEndpointAddress(String endpointAddress) {
+ // REVIEW: Should this be called whenever BindingProvider.ENDPOINT_ADDRESS_PROPERTY is set by the client?
+ if (!DescriptionUtils.isEmpty(endpointAddress)) {
+ this.endpointAddress = endpointAddress;
+ }
+ else {
+ // Since a port can be added without setting an endpoint address, this is not an error.
+ if (log.isDebugEnabled())
+ log.debug("A null or empty endpoint address was attempted to be set", new Throwable("Stack Traceback"));
+ }
+ }
+
+ public String getEndpointAddress() {
+ if (endpointAddress == null) {
+ // If the endpointAddress has not been set explicitly by a call to setEndpointAddress()
+ // then try to get it from the WSDL
+ endpointAddress = getWSDLSOAPAddress();
+ }
+ return endpointAddress;
+ }
+
+ public String getWSDLSOAPAddress() {
+ if (wsdlSOAPAddress == null) {
+ Port wsdlPort = getWSDLPort();
+ if (wsdlPort != null) {
+ // The port is in the WSDL, so see if it has a SOAP address extensibility element specified.
+ List extElementList = wsdlPort.getExtensibilityElements();
+ for (Object listElement : extElementList) {
+ ExtensibilityElement extElement = (ExtensibilityElement) listElement;
+ if (isSOAPAddressElement(extElement)) {
+ String soapAddress = ((SOAPAddress) extElement).getLocationURI();
+ if (!DescriptionUtils.isEmpty(soapAddress)) {
+ wsdlSOAPAddress = soapAddress;
+ }
+ }
+ }
+ }
+ }
+ return wsdlSOAPAddress;
+ }
+
+ private static boolean isSOAPAddressElement(ExtensibilityElement exElement){
+ boolean isAddress = false;
+ // TODO: Add soap12 support later
+ // || WSDLWrapper.SOAP_12_ADDRESS.equals(exElement.getElementType());
+ if (exElement != null) {
+ isAddress = (SOAP_11_ADDRESS_ELEMENT.equals(exElement.getElementType()));
+ }
+ return isAddress;
+ }
+
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Mon Nov 20 11:48:21 2006
@@ -428,7 +428,7 @@
}
public javax.jws.soap.SOAPBinding.Style getSoapBindingStyle() {
- // TODO: (JLB) Implement WSDL/Anno merge
+ // REVIEW: Implement WSDL/Anno merge
return getAnnoSoapBindingStyle();
}
@@ -445,7 +445,7 @@
}
public javax.jws.soap.SOAPBinding.Use getSoapBindingUse() {
- // TODO: (JLB) Implement WSDL/Anno merge
+ // REVIEW: Implement WSDL/Anno merge
return getAnnoSoapBindingUse();
}
@@ -462,7 +462,7 @@
}
public javax.jws.soap.SOAPBinding.ParameterStyle getSoapBindingParameterStyle(){
- // TODO: (JLB) Implement WSDL/Anno merge
+ // REVIEW: Implement WSDL/Anno merge
return getAnnoSoapBindingParameterStyle();
}
public javax.jws.soap.SOAPBinding.ParameterStyle getAnnoSoapBindingParameterStyle() {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Mon Nov 20 11:48:21 2006
@@ -461,7 +461,7 @@
}
public String getOperationName() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebMethodOperationName();
}
public String getAnnoWebMethodOperationName() {
@@ -475,7 +475,7 @@
}
public String getAction() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebMethodAction();
}
@@ -492,7 +492,7 @@
}
public boolean isExcluded() {
- // TODO: (JLB) WSDL/Annotation merge
+ // REVIEW: WSDL/Annotation merge
return getAnnoWebMethodExclude();
}
public boolean getAnnoWebMethodExclude() {
@@ -527,7 +527,7 @@
}
public String getRequestWrapperLocalName() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoRequestWrapperLocalName();
}
@@ -554,7 +554,7 @@
return requestWrapperLocalName;
}
public String getRequestWrapperTargetNamespace() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoRequestWrapperTargetNamespace();
}
/**
@@ -581,7 +581,7 @@
}
public String getRequestWrapperClassName() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoRequestWrapperClassName();
}
/**
@@ -656,7 +656,7 @@
}
public String getResponseWrapperTargetNamespace() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoResponseWrapperTargetNamespace();
}
/**
@@ -684,7 +684,7 @@
}
public String getResponseWrapperClassName() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoResponseWrapperClassName();
}
/**
@@ -787,7 +787,7 @@
}
public String[] getParamNames() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebParamNames();
}
public String[] getAnnoWebParamNames() {
@@ -829,7 +829,7 @@
ArrayList<Mode> buildModes = new ArrayList<Mode>();
ParameterDescription[] paramDescs = getParameterDescriptions();
for (ParameterDescription currentParamDesc:paramDescs) {
- // TODO: (JLB) Consider new ParamDesc.Mode vs WebParam.Mode
+ // TODO: Consider new ParamDesc.Mode vs WebParam.Mode
buildModes.add(((ParameterDescriptionJava) currentParamDesc).getAnnoWebParamMode());
}
webParamMode = buildModes.toArray(new Mode[0]);
@@ -880,7 +880,7 @@
}
public String getResultName() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebResultName();
}
@@ -907,7 +907,7 @@
}
public String getResultPartName() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebResultPartName();
}
public String getAnnoWebResultPartName() {
@@ -927,7 +927,7 @@
}
public String getResultTargetNamespace() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebResultTargetNamespace();
}
public String getAnnoWebResultTargetNamespace() {
@@ -955,7 +955,7 @@
}
public boolean isResultHeader() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebResultHeader();
}
public boolean getAnnoWebResultHeader() {
@@ -991,7 +991,7 @@
return soapBindingAnnotation;
}
public javax.jws.soap.SOAPBinding.Style getSoapBindingStyle() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoSoapBindingStyle();
}
public javax.jws.soap.SOAPBinding.Style getAnnoSoapBindingStyle() {
@@ -1008,7 +1008,7 @@
}
public javax.jws.soap.SOAPBinding.Use getSoapBindingUse() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoSoapBindingUse();
}
public javax.jws.soap.SOAPBinding.Use getAnnoSoapBindingUse() {
@@ -1025,7 +1025,7 @@
}
public javax.jws.soap.SOAPBinding.ParameterStyle getSoapBindingParameterStyle() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoSoapBindingParameterStyle();
}
public javax.jws.soap.SOAPBinding.ParameterStyle getAnnoSoapBindingParameterStyle() {
@@ -1061,7 +1061,7 @@
}
public boolean isOneWay() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return isAnnoOneWay();
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ParameterDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ParameterDescriptionImpl.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ParameterDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ParameterDescriptionImpl.java Mon Nov 20 11:48:21 2006
@@ -143,7 +143,7 @@
}
public String getParameterName() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebParamName();
}
@@ -168,7 +168,7 @@
return webParamName;
}
public String getPartName() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebParamPartName();
}
public String getAnnoWebParamPartName() {
@@ -185,7 +185,7 @@
}
public String getTargetNamespace() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebParamTargetNamespace();
}
public String getAnnoWebParamTargetNamespace() {
@@ -209,7 +209,7 @@
// public Mode getMode() {
public WebParam.Mode getMode() {
- // TODO: (JLB) WSDL/Anno merge. Problem is that OpDesc is expecting WebParam.Mode
+ // REVIEW: WSDL/Anno merge. Problem is that OpDesc is expecting WebParam.Mode
return getAnnoWebParamMode();
}
@@ -245,7 +245,7 @@
}
public boolean isHeader() {
- // TODO: (JLB) WSDL/Anno merge
+ // REVIEW: WSDL/Anno merge
return getAnnoWebParamHeader();
}
public boolean getAnnoWebParamHeader() {
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/PortInfoImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/PortInfoImpl.java?view=auto&rev=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/PortInfoImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/PortInfoImpl.java Mon Nov 20 11:48:21 2006
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed 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.description.impl;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.PortInfo;
+
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.i18n.Messages;
+
+public class PortInfoImpl implements PortInfo {
+ private QName serviceName = null;
+ private QName portName = null;
+ private String bindingId = null;
+
+ /**
+ * @param serviceName
+ * @param portName
+ * @param bindingId
+ */
+ PortInfoImpl(QName serviceName, QName portName, String bindingId) {
+ super();
+ if (serviceName == null) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("portInfoErr0", "<null>"));
+ }
+ if (portName == null) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("portInfoErr1", "<null>"));
+ }
+ if (bindingId == null) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("portInfoErr2", "<null>"));
+ }
+ this.serviceName = serviceName;
+ this.portName = portName;
+ this.bindingId = bindingId;
+ }
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ public QName getPortName() {
+ return portName;
+ }
+
+ public String getBindingID() {
+ return bindingId;
+ }
+}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Mon Nov 20 11:48:21 2006
@@ -32,7 +32,6 @@
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
import org.apache.axis2.jaxws.ClientConfigurationFactory;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.EndpointDescription;
@@ -191,12 +190,7 @@
* port or a pre-existing dynamic port.
*/
- void updateEndpointDescription(Class sei, QName portQName, UpdateType updateType) {
-
- // TODO: Add support: portQName can be null when called from Service.getPort(Class)
- if (portQName == null) {
- throw new UnsupportedOperationException("ServiceDescription.updateEndpointDescription null PortQName not supported");
- }
+ EndpointDescription updateEndpointDescription(Class sei, QName portQName, UpdateType updateType) {
EndpointDescriptionImpl endpointDescription = getEndpointDescriptionImpl(portQName);
boolean isPortDeclared = isPortDeclared(portQName);
@@ -207,9 +201,12 @@
// Port must NOT be declared (e.g. can not already exist in WSDL)
// If an EndpointDesc doesn't exist; create it as long as it doesn't exist in the WSDL
// TODO: This test can be simplified once isPortDeclared(QName) understands annotations and WSDL as ways to declare a port.
+ if (DescriptionUtils.isEmpty(portQName)) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("addPortErr2"));
+ }
if (getWSDLWrapper() != null && isPortDeclared) {
// TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException("ServiceDescription.updateEndpointDescription: Can not do an addPort with a PortQN that exists in the WSDL. PortQN: " + portQName.toString());
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("addPortDup", portQName.toString()));
}
else if (endpointDescription == null) {
// Use the SEI Class and its annotations to finish creating the Description hierachy. Note that EndpointInterface, Operations, Parameters, etc.
@@ -223,6 +220,11 @@
break;
case GET_PORT:
+ // TODO: Add support: portQName can be null when called from Service.getPort(Class)
+ // TODO: I think this is the only place we need to handle a null portQName (not for create Dispatch or addPort)
+ if (DescriptionUtils.isEmpty(portQName)) {
+ throw new UnsupportedOperationException("ServiceDescription.updateEndpointDescription null PortQName not supported");
+ }
// If an endpointDesc doesn't exist, and the port exists in the WSDL, create it
// If an endpointDesc already exists and has an associated SEI already, make sure they match
// If an endpointDesc already exists and was created for Dispatch (no SEI), update that with the SEI provided on the getPort
@@ -230,7 +232,7 @@
// Port must be declared (e.g. in WSDL or via annotations)
// TODO: Once isPortDeclared understands annotations and not just WSDL, the 2nd part of this check can possibly be removed.
// Although consider the check below that updates an existing EndpointDescritpion with an SEI.
- if (!isPortDeclared || (endpointDescription != null && endpointDescription.isDynamicPort())) {
+ else if (!isPortDeclared || (endpointDescription != null && endpointDescription.isDynamicPort())) {
// This guards against the case where an addPort was done previously and now a getPort is done on it.
// TODO: RAS & NLS
throw ExceptionFactory.makeWebServiceException("ServiceDescription.updateEndpointDescription: Can not do a getPort on a port added via addPort(). PortQN: " + portQName.toString());
@@ -264,7 +266,10 @@
// Port may or may not exist in WSDL.
// If an endpointDesc doesn't exist and it is in the WSDL, it can be created
// Otherwise, it is an error.
- if (endpointDescription != null) {
+ if (DescriptionUtils.isEmpty(portQName)) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail0"));
+ }
+ else if (endpointDescription != null) {
// The EndpoingDescription already exists; nothing needs to be done
}
else if (sei != null) {
@@ -283,11 +288,11 @@
else {
// The port is not a declared port and it does not have an EndpointDescription, meaning an addPort has not been done for it
// This is an error.
- // TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException("ServiceDescription.updateEndpointDescription: Attempt to create a Dispatch for a non-existant Dynamic por PortQN: " + portQName);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail1", portQName.toString()));
}
break;
}
+ return endpointDescription;
}
private Class getEndpointSEI(QName portQName) {
@@ -303,16 +308,18 @@
// TODO: This needs to account for declaration of the port via annotations in addition to just WSDL
// TODO: Add logic to check the portQN namespace against the WSDL Definition NS
boolean portIsDeclared = false;
- if (getWSDLWrapper() != null) {
- Definition wsdlDefn = getWSDLWrapper().getDefinition();
- Service wsdlService = wsdlDefn.getService(serviceQName);
- Port wsdlPort = wsdlService.getPort(portQName.getLocalPart());
- portIsDeclared = (wsdlPort != null);
- }
- else {
- // TODO: Add logic to determine if port is declared via annotations when no WSDL is present. For now, we have to assume it is declared
- // so getPort(...) and createDispatch(...) calls work when there is no WSDL.
- portIsDeclared = true;
+ if (!DescriptionUtils.isEmpty(portQName)) {
+ if (getWSDLWrapper() != null) {
+ Definition wsdlDefn = getWSDLWrapper().getDefinition();
+ Service wsdlService = wsdlDefn.getService(serviceQName);
+ Port wsdlPort = wsdlService.getPort(portQName.getLocalPart());
+ portIsDeclared = (wsdlPort != null);
+ }
+ else {
+ // TODO: Add logic to determine if port is declared via annotations when no WSDL is present. For now, we have to assume it is declared
+ // so getPort(...) and createDispatch(...) calls work when there is no WSDL.
+ portIsDeclared = true;
+ }
}
return portIsDeclared;
}
@@ -328,7 +335,11 @@
* @see org.apache.axis2.jaxws.description.ServiceDescription#getEndpointDescription(javax.xml.namespace.QName)
*/
public EndpointDescription getEndpointDescription(QName portQName) {
- return endpointDescriptions.get(portQName);
+ EndpointDescription returnDesc = null;
+ if (!DescriptionUtils.isEmpty(portQName)) {
+ returnDesc = endpointDescriptions.get(portQName);
+ }
+ return returnDesc;
}
EndpointDescriptionImpl getEndpointDescriptionImpl(QName portQName) {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties Mon Nov 20 11:48:21 2006
@@ -30,7 +30,7 @@
getPortInvalidSEI=An attempt was made to call getPort with the {0} port and {1} service endpoint interface (SEI). However, this call is not allowed.
createDispatchFail0=Dispatch creation failed. The QName port cannot be null.
createDispatchFail1=Dispatch creation failed. The {0} port cannot be found. Verify that the port has been added to the service.
-createDispatchFail2=Dispatch creation failed. The service cannot find PortData for the {0} port.
+createDispatchFail2=Dispatch creation failed. The service cannot find Port data for the {0} port.
addPortDup=An attempt was made to add the {0} port to the ServiceDelegate. The port already exists.
addPortErr0=Only the SOAP11HTTP_BINDING and SOAP12HTTP_BINDING ports are supported at this time. The {0} port cannot be added to the ServiceDelegate.
# The key addPortErr1 is not currently used
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java?view=auto&rev=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java Mon Nov 20 11:48:21 2006
@@ -0,0 +1,30 @@
+/*
+ * 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.spi;
+
+import org.apache.axis2.jaxws.description.EndpointDescription;
+
+/**
+ *
+ */
+public interface BindingProvider extends javax.xml.ws.BindingProvider {
+ public EndpointDescription getEndpointDescription();
+ public ServiceDelegate getServiceDelegate();
+
+}
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?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- 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 Mon Nov 20 11:48:21 2006
@@ -47,10 +47,10 @@
import org.apache.axis2.jaxws.client.XMLDispatch;
import org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler;
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.handler.PortData;
-import org.apache.axis2.jaxws.handler.PortInfoImpl;
+import org.apache.axis2.jaxws.description.impl.PortInfoImpl;
import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.util.WSDLWrapper;
@@ -61,18 +61,14 @@
*/
public class ServiceDelegate extends javax.xml.ws.spi.ServiceDelegate {
private Executor executor;
- private Map<QName, org.apache.axis2.jaxws.handler.PortData> ports;
private ServiceDescription serviceDescription;
private QName serviceQname;
private ServiceClient serviceClient = null;
- // If no binding ID is available, use this one
- private static String DEFAULT_BINDING_ID = SOAPBinding.SOAP11HTTP_BINDING;
public ServiceDelegate(URL url, QName qname, Class clazz) throws WebServiceException{
super();
this.serviceQname = qname;
- ports = new Hashtable<QName, PortData>();
if(!isValidServiceName()){
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDelegateConstruct0", ""));
@@ -82,7 +78,6 @@
if(!isServiceDefined(serviceQname)){
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDelegateConstruct0", serviceQname.toString(), url.toString()));
}
- readPorts();
}
}
@@ -99,46 +94,12 @@
public void addPort(QName portName, String bindingId, String endpointAddress)
throws WebServiceException {
- addPortData(portName, bindingId, endpointAddress);
- DescriptionFactory.updateEndpoint(serviceDescription, null, portName, ServiceDescription.UpdateType.ADD_PORT);
+ EndpointDescription endpointDesc =
+ DescriptionFactory.updateEndpoint(serviceDescription, null, portName, ServiceDescription.UpdateType.ADD_PORT);
+ // TODO: Need to set endpointAddress and set or check bindingId on the EndpointDesc
+ endpointDesc.setEndpointAddress(endpointAddress);
+ endpointDesc.setClientBindingID(bindingId);
}
- /**
- * Add a new port (either endpoint based or dispatch based) to the portData table.
- * @param portName
- * @param bindingId
- * @param endpointAddress
- */
- private void addPortData(QName portName, String bindingId, String endpointAddress) {
- if(portName == null ){
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage("addPortErr2"));
- }
-
- if(bindingId != null && !(bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
- bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
- bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
- bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))) {
- // TODO Is this the correct exception. Shouldn't this be a WebServiceException ?
- throw new UnsupportedOperationException(Messages.getMessage("addPortErr0", portName.toString()));
- }
-
- if (bindingId == null) {
- bindingId = DEFAULT_BINDING_ID;
- }
-
- if(!ports.containsKey(portName)){
- PortData port = new PortInfoImpl(serviceQname, portName, bindingId, endpointAddress);
- ports.put(portName, port);
- }
- else{
- //TODO: Can same port have two different set of SOAPAddress
- /*PortInfoImpl port =(PortInfoImpl) ports.get(portName);
- port.setBindingID(bindingId);
- port.setEndPointAddress(endpointAddress);
- */
- throw new WebServiceException(Messages.getMessage("addPortDup", portName.toString()));
- }
- }
-
/*
* (non-Javadoc)
* @see javax.xml.ws.spi.ServiceDelegate#createDispatch(javax.xml.namespace.QName, java.lang.Class, javax.xml.ws.Service.Mode)
@@ -150,21 +111,17 @@
if(!isValidDispatchType(clazz)){
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("dispatchInvalidType"));
}
- if(!isPortValid(qname)){
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail1", qname.toString()));
- }
- PortData portData = (PortData) ports.get(qname);
- if(portData == null){
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail2", qname.toString()));
- }
-
- DescriptionFactory.updateEndpoint(serviceDescription, null, qname, ServiceDescription.UpdateType.CREATE_DISPATCH);
+ EndpointDescription endpointDesc =
+ DescriptionFactory.updateEndpoint(serviceDescription, null, qname, ServiceDescription.UpdateType.CREATE_DISPATCH);
+ if (endpointDesc == null) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail2", qname.toString()));
+ }
// FIXME: This call needs to be revisited. Not really sure what we're trying to do here.
- addBinding(portData.getBindingID());
+ addBinding(endpointDesc.getClientBindingID());
- XMLDispatch<T> dispatch = new XMLDispatch<T>(portData);
+ XMLDispatch<T> dispatch = new XMLDispatch<T>(this, endpointDesc);
if (mode != null) {
dispatch.setMode(mode);
}
@@ -176,7 +133,6 @@
serviceClient = getServiceClient(qname);
dispatch.setServiceClient(serviceClient);
- dispatch.setServiceDelegate(this);
dispatch.setType(clazz);
return dispatch;
}
@@ -190,19 +146,18 @@
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail0"));
}
- if (!isPortValid(qname)) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail1", qname.toString()));
+ EndpointDescription endpointDesc =
+ DescriptionFactory.updateEndpoint(serviceDescription, null, qname, ServiceDescription.UpdateType.CREATE_DISPATCH);
+ if (endpointDesc == null) {
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail2", qname.toString()));
}
-
- DescriptionFactory.updateEndpoint(serviceDescription, null, qname, ServiceDescription.UpdateType.CREATE_DISPATCH);
- PortData portData = (PortData) ports.get(qname);
- addBinding(portData.getBindingID());
+ addBinding(endpointDesc.getClientBindingID());
- JAXWSClientContext clientCtx = createClientContext(portData, Object.class, mode);
+ JAXWSClientContext clientCtx = createClientContext(endpointDesc, Object.class, mode);
clientCtx.setJAXBContext(context);
- JAXBDispatch<Object> dispatch = new JAXBDispatch(portData);
+ JAXBDispatch<Object> dispatch = new JAXBDispatch(this, endpointDesc);
if (mode != null) {
dispatch.setMode(mode);
@@ -216,7 +171,6 @@
dispatch.setJAXBContext(context);
dispatch.setServiceClient(serviceClient);
- dispatch.setServiceDelegate(this);
return dispatch;
}
@@ -248,23 +202,15 @@
if(sei == null){
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("getPortInvalidSEI", portName.toString(), "null"));
}
- /*TODO: if portQname is null then fetch it from annotation.
- * if portQname is provided then add that to the ports table.
- */
- // TODO: Move the annotation processing to the DescriptionFactory
- DescriptionFactory.updateEndpoint(serviceDescription, sei, portName, ServiceDescription.UpdateType.GET_PORT);
+ EndpointDescription endpointDesc =
+ DescriptionFactory.updateEndpoint(serviceDescription, sei, portName, ServiceDescription.UpdateType.GET_PORT);
+ if (endpointDesc == null) {
+ // TODO: NLS
+ throw ExceptionFactory.makeWebServiceException("Unable to getPort for port QName " + portName.toString());
+ }
- if(portName!=null){
- String address = "";
- if(isValidWSDLLocation()){
- address = getWSDLWrapper().getSOAPAddress(serviceQname, portName);
- }
- if(ports.get(portName)==null){
- addPortData(portName, null, address);
- }
- }
- JAXWSProxyHandler proxyHandler = new JAXWSProxyHandler(this, sei, ports.get(portName));
+ JAXWSProxyHandler proxyHandler = new JAXWSProxyHandler(this, sei, endpointDesc);
Class[] seiClazz = new Class[]{sei, BindingProvider.class};
Object proxyClass = Proxy.newProxyInstance(sei.getClassLoader(), seiClazz, proxyHandler);
@@ -361,20 +307,16 @@
return Executors.newFixedThreadPool(3);
}
- private <T> JAXWSClientContext<T> createClientContext(PortData portData, Class<T> clazz, Mode mode){
+ private <T> JAXWSClientContext<T> createClientContext(EndpointDescription epDesc, Class<T> clazz, Mode mode){
JAXWSClientContext<T> clientContext = new JAXWSClientContext<T>();
clientContext.setServiceDescription(serviceDescription);
- clientContext.setPort(portData);
+ clientContext.setEndpointDescription(epDesc);
clientContext.setClazz(clazz);
clientContext.setServiceMode(mode);
clientContext.setExecutor(this.getExecutor());
return clientContext;
}
- private boolean isPortValid(QName portName){
- return ports!=null && ports.size() >0 && ports.containsKey(portName);
- }
-
private boolean isValidServiceName(){
return serviceQname != null && !"".equals(serviceQname.toString().trim());
}
@@ -382,18 +324,6 @@
private boolean isValidWSDLLocation(){
URL wsdlLocation = getWSDLDocumentLocation();
return wsdlLocation != null && !"".equals(wsdlLocation.toString().trim());
- }
-
- private void readPorts(){
- String[] portNames = getWSDLWrapper().getPorts(serviceQname);
- String targetNamespace = getWSDLWrapper().getTargetNamespace();
- for(String portName: portNames){
- QName portQname = new QName(targetNamespace, portName);
- String address = getWSDLWrapper().getSOAPAddress(serviceQname, portQname);
- //TODO: get Binding ID from WSDL and add it here.
- PortData portInfo = new PortInfoImpl(serviceQname, portQname, DEFAULT_BINDING_ID, address);
- ports.put(portQname, portInfo);
- }
}
// TODO: Remove this method and put the WSDLWrapper methods on the ServiceDescriptor directly
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java Mon Nov 20 11:48:21 2006
@@ -243,30 +243,10 @@
return null;
}
- public String getSOAPAddress(QName serviceQname, QName eprQname) {
- // TODO Auto-generated method stub
- List list =getPort(serviceQname, eprQname).getExtensibilityElements();
- for(Object obj : list){
- ExtensibilityElement element = (ExtensibilityElement)obj;
- if(isSoapAddress(element)){
- SOAPAddress address = (SOAPAddress)element;
- return address.getLocationURI();
- }
- }
-
- return null;
- }
-
-
public URL getWSDLLocation() {
// TODO Auto-generated method stub
return this.wsdlURL;
- }
- private boolean isSoapAddress(ExtensibilityElement exElement){
- return WSDLWrapper.SOAP_11_ADDRESS.equals(exElement.getElementType());
- //TODO: Add soap12 support later
- //|| WSDLWrapper.SOAP_12_ADDRESS.equals(exElement.getElementType());
}
private boolean isSoapOperation(ExtensibilityElement exElement){
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDLWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDLWrapper.java?view=diff&rev=477307&r1=477306&r2=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDLWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDLWrapper.java Mon Nov 20 11:48:21 2006
@@ -28,7 +28,6 @@
public static final QName POLICY = new QName(Constants.POLICY, "Policy");
public static final QName POLICY_REFERENCE = new QName(Constants.POLICY_REFERENCE, "PolicyReference");
public static final QName SCHEMA = new QName(Constants.SCHEMA, "schema");
- public static final QName SOAP_11_ADDRESS = new QName(Constants.URI_WSDL_SOAP11, "address");
public static final QName SOAP_11_BINDING = new QName(Constants.URI_WSDL_SOAP11_BINDING, "binding");
public static final QName SOAP_11_BODY = new QName(Constants.URI_WSDL_SOAP11_BODY, "body");
public static final QName SOAP_11_HEADER = new QName(Constants.URI_WSDL_SOAP11_HEADER, "header");
@@ -48,7 +47,6 @@
public String getSOAPAction(QName serviceQname);
public String getSOAPAction(QName serviceQname, QName portQname);
public String getSOAPAction(QName serviceQname, QName portQName, QName operationQname);
- public String getSOAPAddress(QName serviceQname, QName portQname);
public URL getWSDLLocation();
public String getTargetNamespace();
public Definition getDefinition();
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/GetDescFromBindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/GetDescFromBindingProvider.java?view=auto&rev=477307
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/GetDescFromBindingProvider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/GetDescFromBindingProvider.java Mon Nov 20 11:48:21 2006
@@ -0,0 +1,199 @@
+/*
+ * 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.description;
+
+import java.lang.reflect.Proxy;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.jaxws.spi.BindingProvider;
+import org.apache.axis2.jaxws.spi.ServiceDelegate;
+import org.apache.ws.axis2.tests.EchoPort;
+
+import junit.framework.TestCase;
+
+/**
+ * Test that the EndpointDescription can be gotten from
+ * the Binding Provider impl class and that the AxisService can be
+ * gotten from the EndpointDesc. Note that the BindingProvider class is NOT
+ * the jaxws API one; it is the internal implementation BindingProvider class.
+ */
+public class GetDescFromBindingProvider extends TestCase {
+
+ private static final String wsdlSOAPAddress = "http://localhost:8080/axis2/services/EchoService";
+
+ public void testForProxy() {
+ String namespaceURI = "http://ws.apache.org/axis2/tests";
+ String localPart = "EchoService";
+
+ URL wsdlURL = DescriptionTestUtils.getWSDLURL();
+ assertNotNull(wsdlURL);
+
+ Service service = Service.create(wsdlURL, new QName(namespaceURI, localPart));
+ assertNotNull(service);
+
+ QName validPortQName = new QName(namespaceURI, "EchoPort");
+ EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
+ assertNotNull(echoPort);
+
+ BindingProvider bindingProvider = (BindingProvider)Proxy.getInvocationHandler(echoPort);
+ ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
+ assertNotNull(serviceDelegate);
+ EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
+ assertNotNull(endpointDesc);
+ AxisService axisService = endpointDesc.getAxisService();
+ assertNotNull(axisService);
+
+ // The endpoint address should match what is in the WSDL
+ String endpointAddress = endpointDesc.getEndpointAddress();
+ assertEquals(wsdlSOAPAddress, endpointAddress);
+ }
+
+ public void testForDispatch() {
+ String namespaceURI = "http://ws.apache.org/axis2/tests";
+ String localPart = "EchoService";
+
+ URL wsdlURL = DescriptionTestUtils.getWSDLURL();
+ assertNotNull(wsdlURL);
+
+ Service service = Service.create(wsdlURL, new QName(namespaceURI, localPart));
+ assertNotNull(service);
+
+ QName validPortQName = new QName(namespaceURI, "EchoPort");
+ Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
+ assertNotNull(dispatch);
+
+ BindingProvider bindingProvider = (BindingProvider) dispatch;
+ ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
+ assertNotNull(serviceDelegate);
+ EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
+ assertNotNull(endpointDesc);
+ AxisService axisService = endpointDesc.getAxisService();
+ assertNotNull(axisService);
+
+ // The endpoint address should match what is in the WSDL
+ String endpointAddress = endpointDesc.getEndpointAddress();
+ assertEquals(wsdlSOAPAddress, endpointAddress);
+ }
+
+ public void testForAddPort() {
+ String namespaceURI = "http://ws.apache.org/axis2/tests";
+ String localPart = "EchoService";
+
+ URL wsdlURL = DescriptionTestUtils.getWSDLURL();
+ assertNotNull(wsdlURL);
+
+ Service service = Service.create(wsdlURL, new QName(namespaceURI, localPart));
+ assertNotNull(service);
+
+ QName validPortQName = new QName(namespaceURI, "EchoPortAdded");
+ service.addPort(validPortQName, null, null);
+ Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
+ assertNotNull(dispatch);
+
+ BindingProvider bindingProvider = (BindingProvider) dispatch;
+ ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
+ assertNotNull(serviceDelegate);
+ EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
+ assertNotNull(endpointDesc);
+ AxisService axisService = endpointDesc.getAxisService();
+ assertNotNull(axisService);
+ // The endpoint address should be null since it wasn't specified on the addPort
+ String endpointAddress = endpointDesc.getEndpointAddress();
+ assertNull(endpointAddress);
+
+ QName validPortQName2 = new QName(namespaceURI, "EchoPortAdded2");
+ final String port2EndpointAddress = "http://testAddress:8080/my/test/address";
+ service.addPort(validPortQName2, null, port2EndpointAddress);
+ dispatch = service.createDispatch(validPortQName2, String.class, null);
+ assertNotNull(dispatch);
+ bindingProvider = (BindingProvider) dispatch;
+ endpointDesc = bindingProvider.getEndpointDescription();
+ assertNotNull(endpointDesc);
+ // The endpoint address should be as set on the addPort above.
+ endpointAddress = endpointDesc.getEndpointAddress();
+ assertEquals(port2EndpointAddress, endpointAddress);
+ }
+
+ public void testForProxyNoWSDL() {
+ String namespaceURI = "http://ws.apache.org/axis2/tests";
+ String localPart = "EchoService";
+
+ Service service = Service.create(null, new QName(namespaceURI, localPart));
+ assertNotNull(service);
+
+ QName validPortQName = new QName(namespaceURI, "EchoPort");
+ Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
+ assertNotNull(dispatch);
+
+ BindingProvider bindingProvider = (BindingProvider) dispatch;
+ ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
+ assertNotNull(serviceDelegate);
+ EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
+ assertNotNull(endpointDesc);
+ AxisService axisService = endpointDesc.getAxisService();
+ assertNotNull(axisService);
+ // The endpoint address should be null since there was no WSDL and it hasn't been set yet
+ String endpointAddress = endpointDesc.getEndpointAddress();
+ assertNull(endpointAddress);
+ }
+ public void testForDispatchNoWSDL() {
+ String namespaceURI = "http://ws.apache.org/axis2/tests";
+ String localPart = "EchoService";
+
+ Service service = Service.create(null, new QName(namespaceURI, localPart));
+ assertNotNull(service);
+
+ QName validPortQName = new QName(namespaceURI, "EchoPort");
+ Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
+ assertNotNull(dispatch);
+
+ BindingProvider bindingProvider = (BindingProvider) dispatch;
+ ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
+ assertNotNull(serviceDelegate);
+ EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
+ assertNotNull(endpointDesc);
+ AxisService axisService = endpointDesc.getAxisService();
+ assertNotNull(axisService);
+ }
+ public void testForAddPortNoWSDL() {
+ String namespaceURI = "http://ws.apache.org/axis2/tests";
+ String localPart = "EchoService";
+
+ Service service = Service.create(null, new QName(namespaceURI, localPart));
+ assertNotNull(service);
+
+ QName validPortQName = new QName(namespaceURI, "EchoPortAdded");
+ service.addPort(validPortQName, null, null);
+ Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
+ assertNotNull(dispatch);
+
+ BindingProvider bindingProvider = (BindingProvider) dispatch;
+ ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
+ assertNotNull(serviceDelegate);
+ EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
+ assertNotNull(endpointDesc);
+ AxisService axisService = endpointDesc.getAxisService();
+ assertNotNull(axisService);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org