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 ba...@apache.org on 2006/10/04 15:40:02 UTC
svn commit: r452886 - in /webservices/axis2/trunk/java/modules/jaxws:
src/org/apache/axis2/jaxws/description/ src/org/apache/axis2/jaxws/spi/
test/org/apache/axis2/jaxws/description/
Author: barrettj
Date: Wed Oct 4 06:40:01 2006
New Revision: 452886
URL: http://svn.apache.org/viewvc?view=rev&rev=452886
Log:
Allow createDispatch on declared ports, such as those defined in WSDL.
Improved error messages in exceptions for some invalid calls such as addPort(name);getPort(name);
Additional tests related to the above.
Modified:
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/ServiceDescription.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java
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=452886&r1=452885&r2=452886
==============================================================================
--- 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 Wed Oct 4 06:40:01 2006
@@ -55,8 +55,8 @@
* @param portName Can be null
* @return
*/
- public static ServiceDescription updateEndpoint(ServiceDescription serviceDescription, Class sei, QName portQName) {
- serviceDescription.updateEndpointDescription(sei, portQName);
+ public static ServiceDescription updateEndpoint(ServiceDescription serviceDescription, Class sei, QName portQName, ServiceDescription.UpdateType updateType ) {
+ serviceDescription.updateEndpointDescription(sei, portQName, updateType);
return serviceDescription;
}
}
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=452886&r1=452885&r2=452886
==============================================================================
--- 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 Wed Oct 4 06:40:01 2006
@@ -91,12 +91,16 @@
private AxisService axisService;
private QName portQName;
+ // Corresponds to a port that was added dynamically via addPort and is not declared (either in WSDL or annotations)
+ private boolean isDynamicPort;
// Note that an EndpointInterfaceDescription will ONLY be set for an Endpoint-based implementation;
// it will NOT be set for a Provider-based implementation
private EndpointInterfaceDescription endpointInterfaceDescription;
- // This is only set on the service-side, not the client side. It could
- // be either an SEI class or a service implementation class.
+ // This can be an SEI (on the client or server) or a Service implentation (server only)
+ // Note that for clients that are Dispatch, this will be null. Also note that a client that was initially
+ // dispatch (sei = null) could later do a getPort(sei), at which time the original EndpointDescription will be
+ // updated with the SEI information.
private Class implOrSEIClass;
//On Client side, there should be One ServiceClient instance per AxisSerivce
@@ -152,11 +156,15 @@
* since they don't use an SEI
*/
public EndpointDescription(Class theClass, QName portName, ServiceDescription parent) {
+ this(theClass, portName, false, parent);
+ }
+ public EndpointDescription(Class theClass, QName portName, boolean dynamicPort, ServiceDescription parent) {
// TODO: This and the other constructor will (eventually) take the same args, so the logic needs to be combined
// TODO: If there is WSDL, could compare the namespace of the defn against the portQName.namespace
this.parentServiceDescription = parent;
this.portQName = portName;
this.implOrSEIClass = theClass;
+ this.isDynamicPort = dynamicPort;
// TODO: Refactor this with the consideration of no WSDL/Generic Service/Annotated SEI
setupAxisService();
@@ -313,6 +321,37 @@
public AxisService getAxisService() {
return axisService;
}
+
+ public boolean isDynamicPort() {
+ return isDynamicPort;
+ }
+
+ public void updateWithSEI(Class sei) {
+ // Updating with an SEI is only valid for declared ports; it is not valid for dynamic ports.
+ if (isDynamicPort()) {
+ // TODO: RAS and NLS
+ throw ExceptionFactory.makeWebServiceException("Can not update an SEI on a dynamic port. PortQName:" + portQName);
+ }
+ if (sei == null) {
+ // TODO: RAS and NLS
+ throw ExceptionFactory.makeWebServiceException("EndpointDescription.updateWithSEI was passed a null SEI. PortQName:" + portQName);
+ }
+
+ if (endpointInterfaceDescription != null) {
+ // The EndpointInterfaceDescription was created previously based on the port declaration (i.e. WSDL)
+ // so update that with information from the SEI annotations
+ endpointInterfaceDescription.updateWithSEI(sei);
+ }
+ else {
+ // An EndpointInterfaceDescription does not exist yet. This currently happens in the case where there is
+ // NO WSDL provided and a Dispatch client is created for prior to a getPort being done for that port.
+ // There was no WSDL to create the EndpointInterfaceDescription from and there was no annotated SEI to
+ // use at that time. Now we have an annotated SEI, so create the EndpointInterfaceDescription now.
+ endpointInterfaceDescription = new EndpointInterfaceDescription(sei, this);
+ }
+ return;
+ }
+
// ==========================================
// Annotation-related methods
@@ -474,11 +513,11 @@
private void setupAxisService() {
// TODO: Need to use MetaDataQuery validator to merge WSDL (if any) and annotations (if any)
- // Build up the AxisService. Note that if this is a dispatch client, then we don't use the
+ // Build up the AxisService. Note that if this is a dynamic port, then we don't use the
// WSDL to build up the AxisService since the port added to the Service by the client is not
// one that will be present in the WSDL. A null class passed in as the SEI indicates this
// is a dispatch client.
- if (implOrSEIClass != null && getServiceDescription().getWSDLWrapper() != null) {
+ if (!isDynamicPort && getServiceDescription().getWSDLWrapper() != null) {
buildAxisServiceFromWSDL();
}
else {
@@ -544,11 +583,10 @@
}
private void buildDescriptionHierachy() {
- // Build up the Description Hierachy. Note that if this is a dispatch client, then we don't use the
+ // Build up the Description Hierachy. Note that if this is a dynamic port, then we don't use the
// WSDL to build up the hierachy since the port added to the Service by the client is not
- // one that will be present in the WSDL. A null class passed in as the SEI indicates this
- // is a dispatch client.
- if (implOrSEIClass != null && getServiceDescription().getWSDLWrapper() != null) {
+ // one that will be present in the WSDL.
+ if (!isDynamicPort && getServiceDescription().getWSDLWrapper() != null) {
buildEndpointDescriptionFromWSDL();
}
else if (implOrSEIClass != null){
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java?view=diff&rev=452886&r1=452885&r2=452886
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java Wed Oct 4 06:40:01 2006
@@ -170,56 +170,157 @@
// START of public accessor methods
/**
- * Updates the ServiceDescription based on the SEI class and its annotations.
+ * Update or create an EndpointDescription. Updates to existing
+ * EndpointDescriptons will be based on the SEI class and its annotations. Both declared
+ * ports and dynamic ports can be updated. A declared port is one that is defined (e.g. in WSDL or
+ * via annotations); a dyamic port is one that is not defined (e.g. not via WSDL or annotations) and
+ * has been added via Serivce.addPort.
+ *
+ * Notes on how an EndpointDescription can be updated or created:
+ * 1) Service.createDispatch can create a Dispatch client for either a declared or dynamic port
+ * 2) Note that creating a Dispatch does not associate an SEI with an endpoint
+ * 3) Service.getPort will associate an SEI with a port
+ * 4) A getPort on an endpoint which was originally created for a Distpatch will update that
+ * EndpointDescription with the SEI provided on the getPort
+ * 5) Service.getPort can not be called on a dynamic port (per the JAX-WS spec)
+ * 6) Service.addPort can not be called for a declared port
+ *
* @param sei
+ * This will be non-null if the update is of type GET_PORT; it
+ * will be null if the update is ADD_PORT or CREATE_DISPATCH
* @param portQName
+ * @param updateType
+ * Indicates what is causing the update GET_PORT is an attempt to
+ * get a declared SEI-based port ADD_PORT is an attempt to add a
+ * previously non-existent dynamic port CREATE_DISPATCH is an
+ * attempt to create a Dispatch-based client to either a declared
+ * port or a pre-existing dynamic port.
*/
- public void updateEndpointDescription(Class sei, QName portQName) {
+ public enum UpdateType {GET_PORT, ADD_PORT, CREATE_DISPATCH}
+ public 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");
}
- // If a Dispatch client is created on a service for which WSDL was supplied, it is an error
- // to attempt to add a port with the same name as a port that exists in the WSDL.
- // REVIEW: Is this a correct check to be making?
- // TODO: Add logic to check the portQN namespace against the WSDL Definition NS
- if (sei == null && getWSDLWrapper() != null) {
- Definition wsdlDefn = getWSDLWrapper().getDefinition();
- Service wsdlService = wsdlDefn.getService(serviceQName);
- Port wsdlPort = wsdlService.getPort(portQName.getLocalPart());
- if (wsdlPort != null) {
+ EndpointDescription endpointDescription = getEndpointDescription(portQName);
+ boolean isPortDeclared = isPortDeclared(portQName);
+
+ switch (updateType) {
+
+ case ADD_PORT:
+ // 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 (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());
}
- }
-
+ else if (endpointDescription == null) {
+ // Use the SEI Class and its annotations to finish creating the Description hierachy. Note that EndpointInterface, Operations, Parameters, etc.
+ // are not created for dynamic ports. It would be an error to later do a getPort against a dynamic port (per the JAX-WS spec)
+ endpointDescription = new EndpointDescription(sei, portQName, true, this);
+ addEndpointDescription(endpointDescription);
+ }
+ else {
+ // All error check above passed, the EndpointDescription already exists and needs no updating
+ }
+ break;
+
+ case GET_PORT:
+ // 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
- if (getEndpointDescription(portQName) != null) {
- // The port has already been created, so the SEI settings must match. Either
- // this port was created as an SEI-based one via a getPort() call or
- // a Dispatch-based one via an addPort() call. Those two calls can not be
- // done for the same portQName. Additionally, if this is an SEI-based
- // endpoint, the SEIs for each subsequent getPort() must match.
- // REVIEW: It is probably OK of the SEIs are functionally equivilent
- // they probably don't need to be the same class, so this check needs
- // to be expanded in that case.
- Class endpointSEI = null;
- EndpointInterfaceDescription endpointInterfaceDesc = getEndpointDescription(portQName).getEndpointInterfaceDescription();
- if (endpointInterfaceDesc != null )
- endpointSEI = endpointInterfaceDesc.getSEIClass();
-
- if (sei != endpointSEI)
+ // 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())) {
+ // 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());
+ }
+ else if (sei == null) {
+ // TODO: RAS & NLS
+ throw ExceptionFactory.makeWebServiceException("ServiceDescription.updateEndpointDescription: Can not do a getPort with a null SEI. PortQN: " + portQName.toString());
+ }
+ else if (endpointDescription == null) {
+ // Use the SEI Class and its annotations to finish creating the Description hierachy: Endpoint, EndpointInterface, Operations, Parameters, etc.
+ // TODO: Need to create the Axis Description objects after we have all the config info (i.e. from this SEI)
+ endpointDescription = new EndpointDescription(sei, portQName, this);
+ addEndpointDescription(endpointDescription);
+ }
+ else if (getEndpointSEI(portQName) == null && !endpointDescription.isDynamicPort()) {
+ // Existing endpointDesc from a declared port needs to be updated with an SEI
+ // Note that an EndpointDescritption created from an addPort (i.e. a dynamic port) can not do this.
+ endpointDescription.updateWithSEI(sei);
+ }
+ else if (getEndpointSEI(portQName) != sei) {
// TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException("ServiceDescription.updateEndpointDescription: SEIs don't match");
+ throw ExceptionFactory.makeWebServiceException("ServiceDescription.updateEndpointDescription: Can't do a getPort() specifiying a different SEI than the previous getPort(). PortQN: "
+ + portQName + "; current SEI: " + sei + "; previous SEI: " + getEndpointSEI(portQName));
+ }
+ else {
+ // All error check above passed, the EndpointDescription already exists and needs no updating
+ }
+ break;
+
+ case CREATE_DISPATCH:
+ // 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) {
+ // The EndpoingDescription already exists; nothing needs to be done
+ }
+ else if (sei != null) {
+ // The Dispatch should not have an SEI associated with it on the update call.
+ // REVIEW: Is this a valid check?
+ throw ExceptionFactory.makeWebServiceException("ServiceDescription.updateEndpointDescription: Can not specify an SEI when creating a Dispatch. PortQN: " + portQName);
+ }
+ else if (isPortDeclared) {
+ // EndpointDescription doesn't exist and this is a declared Port, so create one
+ // Use the SEI Class and its annotations to finish creating the Description hierachy. Note that EndpointInterface, Operations, Parameters, etc.
+ // are not created for Dipsatch-based ports, but might be updated later if a getPort is done against the same declared port.
+ // TODO: Need to create the Axis Description objects after we have all the config info (i.e. from this SEI)
+ endpointDescription = new EndpointDescription(sei, portQName, this);
+ addEndpointDescription(endpointDescription);
+ }
+ 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);
+ }
+ break;
+ }
+ }
+
+ private Class getEndpointSEI(QName portQName) {
+ Class endpointSEI = null;
+ EndpointInterfaceDescription endpointInterfaceDesc = getEndpointDescription(portQName).getEndpointInterfaceDescription();
+ if (endpointInterfaceDesc != null ) {
+ endpointSEI = endpointInterfaceDesc.getSEIClass();
+ }
+ return endpointSEI;
+ }
+
+ private boolean isPortDeclared(QName portQName) {
+ // 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 {
- // Use the SEI Class and its annotations to finish creating the Description hierachy: Endpoint, EndpointInterface, Operations, Parameters, etc.
- // TODO: Need to create the Axis Description objects after we have all the config info (i.e. from this SEI)
- EndpointDescription endpointDescription = new EndpointDescription(sei, portQName, this);
- addEndpointDescription(endpointDescription);
+ // 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;
}
public EndpointDescription[] getEndpointDescriptions() {
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=452886&r1=452885&r2=452886
==============================================================================
--- 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 Wed Oct 4 06:40:01 2006
@@ -99,7 +99,7 @@
throws WebServiceException {
addPortData(portName, bindingId, endpointAddress);
- DescriptionFactory.updateEndpoint(serviceDescription, null, portName);
+ DescriptionFactory.updateEndpoint(serviceDescription, null, portName, ServiceDescription.UpdateType.ADD_PORT);
}
/**
* Add a new port (either endpoint based or dispatch based) to the portData table.
@@ -153,8 +153,10 @@
if(portData == 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.
+
+ DescriptionFactory.updateEndpoint(serviceDescription, null, qname, ServiceDescription.UpdateType.CREATE_DISPATCH);
+
+ // FIXME: This call needs to be revisited. Not really sure what we're trying to do here.
addBinding(portData.getBindingID());
XMLDispatch<T> dispatch = new XMLDispatch<T>(portData);
@@ -186,9 +188,10 @@
if (!isPortValid(qname)) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail1", qname.toString()));
}
+
+ DescriptionFactory.updateEndpoint(serviceDescription, null, qname, ServiceDescription.UpdateType.CREATE_DISPATCH);
PortData portData = (PortData) ports.get(qname);
-
addBinding(portData.getBindingID());
JAXWSClientContext clientCtx = createClientContext(portData, Object.class, mode);
@@ -244,7 +247,7 @@
* if portQname is provided then add that to the ports table.
*/
// TODO: Move the annotation processing to the DescriptionFactory
- DescriptionFactory.updateEndpoint(serviceDescription, sei, portName);
+ DescriptionFactory.updateEndpoint(serviceDescription, sei, portName, ServiceDescription.UpdateType.GET_PORT);
if(portName!=null){
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java?view=diff&rev=452886&r1=452885&r2=452886
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java Wed Oct 4 06:40:01 2006
@@ -21,7 +21,16 @@
import java.lang.reflect.Field;
import java.net.URL;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.WebParam.Mode;
import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Holder;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
@@ -105,6 +114,31 @@
assertEquals(EchoPort.class, sei);
}
+ public void testValidMultipleGetPort() {
+ EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
+ assertNotNull(echoPort);
+
+ EchoPort echoPort2 = service.getPort(validPortQName, EchoPort.class);
+ assertNotNull(echoPort2);
+ }
+
+ public void testInvalidMultipleGetPort() {
+ EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
+ assertNotNull(echoPort);
+
+ try {
+ EchoPort2 echoPort2 = service.getPort(validPortQName, EchoPort2.class);
+ fail("Should have caught exception");
+ }
+ catch (WebServiceException e) {
+ // Expected flow
+ }
+ catch (Exception e) {
+ fail("Caught unexpected exception" + e);
+ }
+
+ }
+
public void testValidAddPort() {
QName dispatchPortQN = new QName(VALID_NAMESPACE, "dispatchPort");
service.addPort(dispatchPortQN, null, null);
@@ -132,7 +166,6 @@
EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
assertNotNull(echoPort);
-
EndpointDescription endpointDesc = serviceDescription.getEndpointDescription(validPortQName);
assertNotNull(endpointDesc);
@@ -152,6 +185,67 @@
assertNull(endpointInterfaceDescDispatch);
}
+ public void testValidCreateDispatch() {
+ Dispatch<Source> dispatch = service.createDispatch(validPortQName, Source.class, Service.Mode.PAYLOAD);
+ assertNotNull(dispatch);
+
+ EndpointDescription endpointDesc = serviceDescription.getEndpointDescription(validPortQName);
+ assertNotNull(endpointDesc);
+ // Since ther is no SEI, can not get the endpointDescription based on the sei class
+ EndpointDescription[] endpointDescViaSEI = serviceDescription.getEndpointDescription(EchoPort.class);
+ assertNull(endpointDescViaSEI);
+
+ // There will be an EndpointInterfaceDescription because the service was created with
+ // WSDL, however there will be no SEI created because a getPort has not been done
+ EndpointInterfaceDescription endpointInterfaceDesc = endpointDesc.getEndpointInterfaceDescription();
+ assertNotNull(endpointInterfaceDesc);
+ assertNull(endpointInterfaceDesc.getSEIClass());
+ }
+
+ public void testValidCreateAndGet() {
+ Dispatch<Source> dispatch = service.createDispatch(validPortQName, Source.class, Service.Mode.PAYLOAD);
+ assertNotNull(dispatch);
+ EndpointDescription endpointDesc = serviceDescription.getEndpointDescription(validPortQName);
+ assertNotNull(endpointDesc);
+ // Since ther is no SEI, can not get the endpointDescription based on the sei class
+ EndpointDescription[] endpointDescViaSEI = serviceDescription.getEndpointDescription(EchoPort.class);
+ assertNull(endpointDescViaSEI);
+ EndpointInterfaceDescription endpointInterfaceDesc = endpointDesc.getEndpointInterfaceDescription();
+ assertNotNull(endpointInterfaceDesc);
+ assertNull(endpointInterfaceDesc.getSEIClass());
+
+ EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
+ assertNotNull(echoPort);
+ // Since a getPort has been done, should now be able to get things based on the SEI
+ endpointDesc = serviceDescription.getEndpointDescription(validPortQName);
+ assertNotNull(endpointDesc);
+ // Since ther is no SEI, can not get the endpointDescription based on the sei class
+ endpointDescViaSEI = serviceDescription.getEndpointDescription(EchoPort.class);
+ assertNotNull(endpointDescViaSEI);
+ assertEquals(endpointDesc, endpointDescViaSEI[0]);
+ endpointInterfaceDesc = endpointDesc.getEndpointInterfaceDescription();
+ assertNotNull(endpointInterfaceDesc);
+ assertEquals(EchoPort.class, endpointInterfaceDesc.getSEIClass());
+ }
+
+ public void testValidGetAndCreate() {
+ EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
+ assertNotNull(echoPort);
+ Dispatch<Source> dispatch = service.createDispatch(validPortQName, Source.class, Service.Mode.PAYLOAD);
+ assertNotNull(dispatch);
+
+ // Since a getPort has been done, should now be able to get things based on the SEI
+ EndpointDescription endpointDesc = serviceDescription.getEndpointDescription(validPortQName);
+ assertNotNull(endpointDesc);
+ // Since ther is no SEI, can not get the endpointDescription based on the sei class
+ EndpointDescription[] endpointDescViaSEI = serviceDescription.getEndpointDescription(EchoPort.class);
+ assertNotNull(endpointDescViaSEI);
+ assertEquals(endpointDesc, endpointDescViaSEI[0]);
+ EndpointInterfaceDescription endpointInterfaceDesc = endpointDesc.getEndpointInterfaceDescription();
+ assertNotNull(endpointInterfaceDesc);
+ assertEquals(EchoPort.class, endpointInterfaceDesc.getSEIClass());
+ }
+ // TODO: Need to add a similar test with no WSDL present; note that it currently would not pass
public void testInvalidAddAndGetPort() {
// Should not be able to do a getPort on one that was added with addPort
QName dispatchPortQN = new QName(VALID_NAMESPACE, "dispatchPort");
@@ -163,7 +257,24 @@
catch (WebServiceException e) {
// Expected path
}
-
-
}
+}
+
+// EchoPort2 is identical to EchoPort, but it should still cause an exception
+// if it is used on a subsequent getPort after getPort(EchoPort.class) is done.
+@WebService(name = "EchoPort", targetNamespace = "http://ws.apache.org/axis2/tests", wsdlLocation = "\\work\\apps\\eclipse\\workspace\\axis2-live\\modules\\jaxws\\test-resources\\wsdl\\WSDLTests.wsdl")
+interface EchoPort2 {
+
+
+ /**
+ *
+ * @param text
+ */
+ @WebMethod(operationName = "Echo", action = "http://ws.apache.org/axis2/tests/echo")
+ @RequestWrapper(localName = "Echo", targetNamespace = "http://ws.apache.org/axis2/tests", className = "org.apache.ws.axis2.tests.Echo")
+ @ResponseWrapper(localName = "EchoResponse", targetNamespace = "http://ws.apache.org/axis2/tests", className = "org.apache.ws.axis2.tests.EchoResponse")
+ public void echo(
+ @WebParam(name = "text", targetNamespace = "", mode = Mode.INOUT)
+ Holder<String> text);
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org