axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ngalla...@apache.org
Subject svn commit: r437541 - in /webservices/axis2/trunk/java/modules/jaxws: src/org/apache/axis2/jaxws/client/proxy/ src/org/apache/axis2/jaxws/core/controller/ src/org/apache/axis2/jaxws/description/ test/org/apache/axis2/proxy/
Date Mon, 28 Aug 2006 05:40:33 GMT
Author: ngallardo
Date: Sun Aug 27 22:40:32 2006
New Revision: 437541

URL: http://svn.apache.org/viewvc?rev=437541&view=rev
Log:
AXIS2-1080
Contributor: Jeff Barrett

Jeff's patch for this issue.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/BaseProxyHandler.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyDescriptor.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.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/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/ServiceDescription.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/proxy/ProxyTests.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/BaseProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/BaseProxyHandler.java?rev=437541&r1=437540&r2=437541&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/BaseProxyHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/BaseProxyHandler.java
Sun Aug 27 22:40:32 2006
@@ -136,6 +136,7 @@
 		
 		InvocationContext requestIC = InvocationContextFactory.createInvocationContext(null);
 		MessageContext requestContext = createRequest(method, args);
+        requestContext.setOperationDescription(proxyDescriptor.getOperationDescription());
 		requestIC.setRequestMessageContext(requestContext);
 		InvocationController controller = new AxisInvocationController();
 		//FIXME: Fix based on how InvocationContext changes to get ServiceClient.

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyDescriptor.java?rev=437541&r1=437540&r2=437541&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyDescriptor.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyDescriptor.java
Sun Aug 27 22:40:32 2006
@@ -47,6 +47,16 @@
     private ServiceDescription serviceDescription= null;
 	private OperationDescription operationDescription= null;
 	private EndpointDescription endpointDescription = null;
+    
+	public ServiceDescription getServiceDescription() {
+     return serviceDescription;   
+    }
+    public OperationDescription getOperationDescription() {
+        return operationDescription;
+    }
+    public EndpointDescription getEndpointDescription() {
+        return endpointDescription;
+    }
 
 	//TODO Need to put validation to check if seiMethod is null;
 	public ProxyDescriptor(Class seiClazz, ServiceDescription serviceDescription){

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?rev=437541&r1=437540&r2=437541&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
Sun Aug 27 22:40:32 2006
@@ -41,6 +41,7 @@
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.core.InvocationContext;
 import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.OperationDescription;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.impl.AsyncListener;
 import org.apache.axis2.jaxws.impl.AsyncListenerWrapper;
@@ -92,9 +93,20 @@
         
         // We need the qname of the operation being invoked to know which 
         // AxisOperation the OperationClient should be based on.
-        // TODO: Need to get the operation qname from the MessageContext
-        QName operationName = ServiceClient.ANON_OUT_IN_OP;
-        
+        // Note that the OperationDesc is only set through use of the Proxy. Dispatch
+        // clients do not use operations, so the operationDesc will be null.  In this
+        // case an anonymous AxisService with anoymouns AxisOperations for the supported
+        // MEPs will be created; and it is that anonymous operation name which needs to
+        // be specified
+        // TODO: Fix this logic once AxisService is created via annoations and not just WSDL
+        //       If ServiceDesc.axisService is null, then we created an Annon Service and
operations in 
+        //       ServiceDelegate.getServiceClient(), and that is what the service client
points to.
+        //       Therefore, we need to use the annonymous operation name in that case, so
the anonymous service client will find 
+        //       the anonymous AxisOperation on that service.  
+        //       This means the ServiceDesc was not build with WSDL, and so there are no
Axis objects attached to them
+        //       i.e the OperationDesc.axisOperation == null
+        QName operationName = getOperationNameToUse(requestMsgCtx, ServiceClient.ANON_OUT_IN_OP);
+
         // TODO: Will the ServiceClient stick around on the InvocationContext
         // or will we need some other mechanism of creating this?
         // Try to create an OperationClient from the passed in ServiceClient
@@ -207,7 +219,24 @@
         
         // Try to create an OperationClient from the passed in ServiceClient
         ServiceClient svcClient = ic.getServiceClient();
-        OperationClient opClient = createOperationClient(svcClient, ServiceClient.ANON_OUT_ONLY_OP);
+
+        // We need the qname of the operation being invoked to know which 
+        // AxisOperation the OperationClient should be based on.
+        // Note that the OperationDesc is only set through use of the Proxy. Dispatch
+        // clients do not use operations, so the operationDesc will be null.  In this
+        // case an anonymous AxisService with anoymouns AxisOperations for the supported
+        // MEPs will be created; and it is that anonymous operation name which needs to
+        // be specified
+        // TODO: Fix this logic once AxisService is created via annoations and not just WSDL
+        //       If ServiceDesc.axisService is null, then we created an Annon Service and
operations in 
+        //       ServiceDelegate.getServiceClient(), and that is what the service client
points to.
+        //       Therefore, we need to use the annonymous operation name in that case, so
the anonymous service client will find 
+        //       the anonymous AxisOperation on that service.  
+        //       This means the ServiceDesc was not build with WSDL, and so there are no
Axis objects attached to them
+        //       i.e the OperationDesc.axisOperation == null
+        QName operationName = getOperationNameToUse(requestMsgCtx, ServiceClient.ANON_OUT_ONLY_OP);
+
+        OperationClient opClient = createOperationClient(svcClient, operationName);
         
         setupProperties(requestMsgCtx.getProperties(), opClient.getOptions());
         
@@ -286,7 +315,23 @@
         MessageContext requestMsgCtx = ic.getRequestMessageContext();
         
         ServiceClient svcClient = ic.getServiceClient();
-        OperationClient opClient = createOperationClient(svcClient, ServiceClient.ANON_OUT_IN_OP);
+        // We need the qname of the operation being invoked to know which 
+        // AxisOperation the OperationClient should be based on.
+        // Note that the OperationDesc is only set through use of the Proxy. Dispatch
+        // clients do not use operations, so the operationDesc will be null.  In this
+        // case an anonymous AxisService with anoymouns AxisOperations for the supported
+        // MEPs will be created; and it is that anonymous operation name which needs to
+        // be specified
+        // TODO: Fix this logic once AxisService is created via annoations and not just WSDL
+        //       If ServiceDesc.axisService is null, then we created an Annon Service and
operations in 
+        //       ServiceDelegate.getServiceClient(), and that is what the service client
points to.
+        //       Therefore, we need to use the annonymous operation name in that case, so
the anonymous service client will find 
+        //       the anonymous AxisOperation on that service.  
+        //       This means the ServiceDesc was not build with WSDL, and so there are no
Axis objects attached to them
+        //       i.e the OperationDesc.axisOperation == null
+        QName operationName = getOperationNameToUse(requestMsgCtx, ServiceClient.ANON_OUT_IN_OP);
+
+        OperationClient opClient = createOperationClient(svcClient, operationName);
         
         setupProperties(requestMsgCtx.getProperties(), opClient.getOptions());
         
@@ -505,5 +550,34 @@
             
             ops.setProperty(key, value);
         }
+    }
+    
+    // TODO: This method may need to be removed or refactored when the ServiceDescription
can
+    //       create the AxisService hierachy using annotations.  Currently the AxisService
hierachy is
+    //       only created under a ServiceDescription if WSDL is supplied
+    private static QName getOperationNameToUse(MessageContext requestMsgCtx, QName defaultOpName)
{
+        // We need the qname of the operation being invoked to know which 
+        // AxisOperation the OperationClient should be based on.
+        // Note that the OperationDesc is only set through use of the Proxy. Dispatch
+        // clients do not use operations, so the operationDesc will be null.  In this
+        // case an anonymous AxisService with anoymouns AxisOperations for the supported
+        // MEPs will be created; and it is that anonymous operation name which needs to
+        // be specified
+        // TODO: Fix this logic once AxisService is created via annoations and not just WSDL
+        //       If ServiceDesc.axisService is null (which currently happens if no WSDL 
+        //       was supplied when the ServiceDesc is created), then we created an annonymous
Service and operations in 
+        //       ServiceDelegate.getServiceClient(), and that is what the service client
used in the inovke points to.
+        //       Therefore, we need to use the annonymous operation name in that case, so
the anonymous service client will find 
+        //       the anonymous AxisOperation on that service.  
+        //       The check below for this case is that the AxisOperation is null, since all
Axis description
+        //       objects (including AxisOperation) are only created if WSDL was use to create
the ServiceDesc.
+        //       This will probably need to change once Axis descriptions are also created
from annotions.
+        QName operationName = null;
+        OperationDescription opDesc = requestMsgCtx.getOperationDescription();
+        if (opDesc != null && opDesc.getAxisOperation() != null)
+            operationName = opDesc.getName();
+        else 
+            operationName = defaultOpName;
+        return operationName;
     }
 }

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?rev=437541&r1=437540&r2=437541&view=diff
==============================================================================
--- 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
Sun Aug 27 22:40:32 2006
@@ -94,28 +94,36 @@
         parentServiceDescription = parent;
 
         // Per JSR-181, the @WebService annotation is required.
-        // TODO: (JLB) Tests that do/do not include this annotation
+        // TODO: Tests that do/do not include this annotation
         WebService webServiceAnnotation = (WebService) sei.getAnnotation(WebService.class);
         if (webServiceAnnotation == null) {
             // TODO: NLS
             ExceptionFactory.makeWebServiceException("Invalid SEI " + sei + "; must contain
@WebService annotation");
         }
 
-        // TODO: (JLB) Process other @WebService values
+        // TODO: Process other @WebService values
 
         // If portName not specified, get it from the annotation
-        // TODO: (JLB) If the portName is specified, should we verify it against the annotation?
-        // TODO: (JLB) Add tests: null portName, !null portName, portName != annotation value
+        // TODO: If the portName is specified, should we verify it against the annotation?
+        // TODO: Add tests: null portName, !null portName, portName != annotation value
         if (portName == null) {
             String name = webServiceAnnotation.name();
             String tns = webServiceAnnotation.targetNamespace();
-            // TODO: (JLB) Check for name &/| tns null or empty string and add tests
for same
+            // TODO: Check for name &/| tns null or empty string and add tests for same
             portName = new QName(tns, name);
         }
         portQName = portName;        
         
         endpointInterfaceDescription = new EndpointInterfaceDescription(sei, this);
     }
+    
+    public void updateWithSEI(Class sei) {
+        if (sei != null) {
+            endpointInterfaceDescription.updateWithSEI(sei);
+        }
+        return;
+    }
+    
     public QName getPortQName() {
         return portQName;
     }

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?rev=437541&r1=437540&r2=437541&view=diff
==============================================================================
--- 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
Sun Aug 27 22:40:32 2006
@@ -73,7 +73,7 @@
     
     // Annotations and cached values
     private SOAPBinding         soapBindingAnnotation;
-    // TODO: (JLB) Should this be using the jaxws annotation values or should that be wrappered?
+    // TODO: Should this be using the jaxws annotation values or should that be wrappered?
     private javax.jws.soap.SOAPBinding.Style soapBindingStyle;
 
     
@@ -82,25 +82,125 @@
     }
     
     EndpointInterfaceDescription(Class sei, EndpointDescription parent) {
+        seiClass = sei;
+
         // Per JSR-181 all methods on the SEI are mapped to operations regardless
         // of whether they include an @WebMethod annotation.  That annotation may
         // be present to customize the mapping, but is not required (p14)
-        // TODO: (JLB) Testcases that do and do not include @WebMethod anno
-        seiClass = sei;
-        
-        Method[] seiMethods = seiClass.getMethods();
-        for (Method method:seiMethods) {
-            if (!Modifier.isPublic(method.getModifiers())) {
-                // JSR-181 says methods must be public (p14)
-                // TODO NLS
-                ExceptionFactory.makeWebServiceException("SEI methods must be public");
-            }
-            // TODO: (JLB) other validation per JSR-181
-            
+        // TODO:  Testcases that do and do not include @WebMethod anno
+        for (Method method:getSEIMethods(seiClass)) {
             OperationDescription operation = new OperationDescription(method, this);
             addOperation(operation);
         }
+    }
+    
+    private static Method[] getSEIMethods(Class sei) {
+        // Per JSR-181 all methods on the SEI are mapped to operations regardless
+        // of whether they include an @WebMethod annotation.  That annotation may
+        // be present to customize the mapping, but is not required (p14)
+        Method[] seiMethods = sei.getMethods();
+        if (sei != null) {
+            for (Method method:seiMethods) {
+                if (!Modifier.isPublic(method.getModifiers())) {
+                    // JSR-181 says methods must be public (p14)
+                    // TODO NLS
+                    ExceptionFactory.makeWebServiceException("SEI methods must be public");
+                }
+                // TODO: other validation per JSR-181
+            }
+            
+        }
+        return seiMethods;
+    }
+    
+    public void updateWithSEI(Class sei) {
+        if (seiClass != null && seiClass != sei)
+            // TODO: It probably is invalid to try reset the SEI; but this isn't the right
error processing
+            throw new UnsupportedOperationException("The seiClass is already set; reseting
it is not supported");
+        else if (seiClass != null && seiClass == sei)
+            // We've already done the necessary updates for this SEI
+            return;
+        else if (sei != null) {
+            seiClass = sei;
+            // Update (or possibly add) the OperationDescription for each of the methods
on the SEI.
+            for (Method seiMethod:getSEIMethods(seiClass)) {
 
+                if (getOperation(seiMethod) != null) {
+                    // If an OpDesc already exists with this java method set on it, then
the OpDesc has already
+                    // been updated for this method, so skip it.
+                    continue;
+                }
+                // At this point (for now at least) the operations were created with WSDL
previously.
+                // If they had been created from an annotated class and no WSDL, then the
seiClass would have 
+                // already been set so we would have taken other branches in this if test.
 (Note this could
+                // change once AxisServices can be built from annotations by the ServiceDescription
class).
+                // Since the operations were created from WSDL, they will not have a java
method, which
+                // comes from the SEI, set on them yet.
+                //
+                // Another consideration is that currently Axis2 does not support overloaded
WSDL operations.
+                // That means there will only be one OperationDesc build from WSDL.  Still
another consideration is
+                // that the JAXWS async methods which may exist on the SEI will NOT exist
in the WSDL.  An example
+                // of these methods for the WSDL operation:
+                //     String echo(String)
+                // optionally generated JAX-WS SEI methods from the tooling; take note of
the annotation specifying the 
+                // operation name
+                //     @WebMethod(operationName="echo" ...)
+                //     Response<String> echoStringAsync(String)
+                //     @WebMethod(operationName="echo" ...)
+                //     Future<?> echoStringAsync(String, AsyncHandler)
+                //
+                // So given all the above, the code does the following based on the operation
QName
+                // (which might also be the java method name; see determineOperationQName
for details)
+                // (1) If an operationDesc does not exist, add it.
+                // (2) If an operationDesc does exist but does not have a java method set
on it, set it
+                // (3) If an operationDesc does exist and has a java method set on it already,
add a new one. 
+                //
+                // TODO: May need to change when Axis2 supports overloaded WSDL operations
+                // TODO: May need to change when ServiceDescription can build an AxisService
from annotations
+                
+                // Get the QName for this java method and then update (or add) the appropriate
OperationDescription
+                // See comments below for imporant notes about the current implementation.
+                // NOTE ON OVERLOADED OPERATIONS
+                // Axis2 does NOT currently support overloading WSDL operations.
+                QName seiOperationQName = OperationDescription.determineOperationQName(seiMethod);
+                OperationDescription[] updateOpDesc = getOperation(seiOperationQName);
+                if (updateOpDesc == null || updateOpDesc.length == 0) {
+                    // This operation wasn't defined in the WSDL.  Note that the JAX-WS async
methods
+                    // which are defined on the SEI are not defined as operations in the
WSDL.
+                    // Although they usually specific the same OperationName as the WSDL
operation, 
+                    // there may be cases where they do not.
+                    // TODO: Is this path an error path, or can the async methods specify
different operation names than the 
+                    //       WSDL operation?
+                    OperationDescription operation = new OperationDescription(seiMethod,
this);
+                    addOperation(operation);
+                }
+                else { 
+                    // Currently Axis2 does not support overloaded operations.  That means
that even if the WSDL
+                    // defined overloaded operations, there would still only be a single
AxisOperation, and it
+                    // would be the last operation encounterd.
+                    // HOWEVER the generated JAX-WS async methods (see above) may (will always?)
have the same
+                    // operation name and so will come down this path; they need to be added.
+                    // TODO: When Axis2 starts supporting overloaded operations, then this
logic will need to be changed
+                    // TODO: Should we verify that these are the async methods before adding
them, and treat it as an error otherwise?
+
+                    // Loop through all the opdescs; if one doesn't currently have a java
method set, set it
+                    // If all have java methods set, then add a new one.  Assume we'll need
to add a new one.
+                    boolean addOpDesc = true;
+                    for (OperationDescription checkOpDesc:updateOpDesc) {
+                        if (checkOpDesc.getSEIMethod() == null) {
+                            // TODO: Should this be checking (somehow) that the signature
matches?  Probably not an issue until overloaded WSDL ops are supported.
+                            checkOpDesc.setSEIMethod(seiMethod);
+                            addOpDesc = false;
+                            break;
+                        }
+                    }
+                    if (addOpDesc) {
+                        OperationDescription operation = new OperationDescription(seiMethod,
this);
+                        addOperation(operation);
+                    }
+                }
+            }
+        }
     }
 
     /**
@@ -110,7 +210,7 @@
      * @param javaMethodName String representing a Java Method Name
      * @return
      */
-    // TODO: (JLB) This is confusing; somet getOperations use the QName from the WSDL or
annotation; this one uses the java method name; rename this signature I think; add on that
takes a String but does a QName lookup against the WSDL/Annotation
+    // FIXME: This is confusing; some getOperations use the QName from the WSDL or annotation;
this one uses the java method name; rename this signature I think; add on that takes a String
but does a QName lookup against the WSDL/Annotation
     public OperationDescription[] getOperation(String javaMethodName) {
         if (javaMethodName == null) {
             return null;
@@ -204,7 +304,7 @@
     // SOAP Binding annotation realted methods
     // ========================================
     SOAPBinding getSoapBinding(){
-        // TODO: (JLB) Test with sei Null, not null, SOAP Binding annotated, not annotated
+        // TODO: Test with sei Null, not null, SOAP Binding annotated, not annotated
         if (soapBindingAnnotation == null && seiClass != null) {
             soapBindingAnnotation = (SOAPBinding) seiClass.getAnnotation(SOAPBinding.class);
         }

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?rev=437541&r1=437540&r2=437541&view=diff
==============================================================================
--- 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
Sun Aug 27 22:40:32 2006
@@ -102,13 +102,13 @@
     private String              responseWrapperClassName;
     
     private SOAPBinding         soapBindingAnnotation;
-    // TODO: (JLB) Should this be using the jaxws annotation values or should that be wrappered?
+    // REVIEW: Should this be using the jaxws annotation values or should that be wrappered?
     private javax.jws.soap.SOAPBinding.Style soapBindingStyle;
     
     private WebMethod           webMethodAnnotation;
     private String              webMethodOperationName;
     
-    // TODO: (JLB) Should WebParam annotation be moved to the ParameterDescription?
+    // TODO: Should WebParam annotation be moved to the ParameterDescription?
     private WebParam[]          webParamAnnotations;
     private String[]            webParamNames;
     
@@ -116,16 +116,25 @@
     private String              webResultName;
     
     OperationDescription(Method method, EndpointInterfaceDescription parent) {
-        // TODO: (JLB) Look for WebMethod anno; get name and action off of it
+        // TODO: Look for WebMethod anno; get name and action off of it
         parentEndpointInterfaceDescription = parent;
-        seiMethod = method;
+        setSEIMethod(method);
         webMethodAnnotation = seiMethod.getAnnotation(WebMethod.class);
         
         this.operationName = new QName(getWebMethodOperationName());
     }
     OperationDescription(AxisOperation operation, EndpointInterfaceDescription parent) {
         parentEndpointInterfaceDescription = parent;
-        axisOperation = operation;       
+        axisOperation = operation;
+        this.operationName = axisOperation.getName();
+    }
+
+    public void setSEIMethod(Method method) {
+        if (seiMethod != null)
+            // TODO: This is probably an error, but error processing logic is incorrect
+            throw new UnsupportedOperationException("Can not set an SEI method once it has
been set.");
+        else 
+            seiMethod = method;
     }
 
     public EndpointInterfaceDescription getEndpointInterfaceDescription() {
@@ -156,7 +165,7 @@
                 returnParameters.add(param.getName());
             }
         }
-        // TODO: (JLB) This is different than the rest, which return null instead of an empty
array
+        // TODO: This is different than the rest, which return null instead of an empty array
         return returnParameters.toArray(new String[0]);
     }
     /**
@@ -169,23 +178,36 @@
     }
 
     // Annotation-related getters
-    
+
     // =====================================
     // WebMethod annotation related methods
     // =====================================
     WebMethod getWebMethod() {
         return webMethodAnnotation;
     }
+    
+    static QName determineOperationQName(Method javaMethod) {
+        return new QName(determineOperationName(javaMethod));
+    }
+    
+    private static String determineOperationName(Method javaMethod) {
+        String operationName = null;
+        WebMethod wmAnnotation = javaMethod.getAnnotation(WebMethod.class);
+        // Per JSR-181, if @WebMethod specifies and operation name, use that.  Otherwise
+        // default is the Java method name
+        if (wmAnnotation != null && !DescriptionUtils.isEmpty(wmAnnotation.operationName()))
{
+            operationName = wmAnnotation.operationName();
+        }
+        else {
+            operationName = javaMethod.getName();
+        }
+        return operationName;
+        
+    }
+    
     public String getWebMethodOperationName() {
         if (webMethodOperationName == null) {
-            // Per JSR-181, if @WebMethod specifies and operation name, use that.  Otherwise
-            // default is the Java method name
-            if (getWebMethod() != null && !DescriptionUtils.isEmpty(getWebMethod().operationName()))
{
-                webMethodOperationName = getWebMethod().operationName();
-            }
-            else {
-                webMethodOperationName = seiMethod.getName();
-            }
+            webMethodOperationName = determineOperationName(seiMethod);
         }
         return webMethodOperationName;
     }
@@ -221,7 +243,7 @@
             }
             else {
                 // The default value for targetNamespace is the target namespace of the SEI.
[JAX-WS Sec 7.3, p. 80]
-                // TODO: (JLB) Get the TNS from the SEI via the endpoint interface desc.
+                // TODO: Get the TNS from the SEI via the endpoint interface desc.
                 throw new UnsupportedOperationException("RequestWrapper.targetNamespace default
not implented yet");
             }
         }
@@ -278,7 +300,7 @@
             }
             else {
                 // The default value for targetNamespace is the target namespace of the SEI.
[JAX-WS Sec 7.4, p. 81]
-                // TODO: (JLB) Get the TNS from the SEI via the endpoint interface desc.
+                // TODO: Get the TNS from the SEI via the endpoint interface desc.
                 throw new UnsupportedOperationException("ResponseWrapper.targetNamespace
default not implented yet");
             }
         }
@@ -307,7 +329,7 @@
     // ===========================================
     // WebParam Annotation related methods
     // ===========================================
-    // TODO: (JLB) Should this annotation be moved to ParameterDescription 
+    // TODO: Should this annotation be moved to ParameterDescription 
     WebParam[] getWebParam() {
         if (webParamAnnotations == null) {
             Annotation[][] paramAnnotation = seiMethod.getParameterAnnotations();
@@ -329,7 +351,7 @@
             ArrayList<String> buildNames = new ArrayList<String>();
             WebParam[] webParams = getWebParam();
             for (WebParam currentParam:webParams) {
-                // TODO: (JLB) Is skipping param names of "asyncHandler" correct?  This came
from original ProxyDescription class and ProxyTest fails without this code
+                // TODO: Is skipping param names of "asyncHandler" correct?  This came from
original ProxyDescription class and ProxyTest fails without this code
                 //       Due to code in DocLitProxyHandler.getParamValues() which does not
add values for AsyncHandler objects.
                 //       It probably DOES need to be skipped, albeit more robustly (check
that the type of the param is javax.xml.ws.AsyncHandler also)
                 //       The reason is that the handler is part of the JAX-WS async callback
programming model; it is NOT part of the formal params
@@ -357,7 +379,7 @@
         return getWebResult() != null;
     }
 
-    // TODO: (JLB) This method returns null if the annotation is not specified; others return
default values.  I think null is the correct thing to return; change the others
+    // TODO: This method returns null if the annotation is not specified; others return default
values.  I think null is the correct thing to return; change the others
     public String getWebResultName() {
         if (isWebResultAnnotationSpecified() && webResultName == null) {
             if (!DescriptionUtils.isEmpty(getWebResult().name())) {

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?rev=437541&r1=437540&r2=437541&view=diff
==============================================================================
--- 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
Sun Aug 27 22:40:32 2006
@@ -137,12 +137,17 @@
 
         
         setupWsdlDefinition();
-        // TODO: (JLB) Refactor this with the consideration of no WSDL/Generic Service/Annotated
SEI
+        // TODO: Refactor this with the consideration of no WSDL/Generic Service/Annotated
SEI
         //       Possibly defer creation of AxisService to the getPort() call?
         setupAxisService();
         buildDescriptionHierachy();
+        addAnonymousAxisOperations();
     }
 
+    // Create the descrpiptions based on the service implementation class
+    // NOTE: Taking an axisService on the call is TEMPORARY!  Eventually the AxisService
should be constructed
+    //       based on the annotations in the ServiceImpl class.
+    // TODO: Remove axisService as paramater when the AxisService can be constructed from
the annotations
     ServiceDescription(Class serviceImplClass, AxisService axisService) {
         this.serviceImplClass = serviceImplClass;
         this.axisService = axisService;
@@ -151,11 +156,11 @@
             Parameter parameter = new Parameter();
             parameter.setName(AXIS_SERVICE_PARAMETER);
             parameter.setValue(this);
-            // TODO: (JLB) What to do if AxisFault
+            // TODO: What to do if AxisFault
             try {
                 axisService.addParameter(parameter);
             } catch (AxisFault e) {
-                // TODO: (JLB) Throwing wrong exception
+                // TODO: Throwing wrong exception
                 e.printStackTrace();
                 throw new UnsupportedOperationException("Can't add AxisService param: " +
e);
             }
@@ -165,7 +170,7 @@
         // Else use the public (including inherited) methods
         WebService webServiceAnnotation = (WebService) this.serviceImplClass.getAnnotation(WebService.class);
 
-        // TODO: (JLB) Initial code path requires the @WebService annotation
+        // TODO: Initial code path requires the @WebService annotation
         if (webServiceAnnotation == null) {
             throw new UnsupportedOperationException("TEMPORARY CODE: ServiceImpl bean must
have @WebServiceAnnotation");
         }
@@ -173,12 +178,12 @@
             throw new UnsupportedOperationException("TEMPORARY CODE: ServiceImpl bean must
have @WebServiceAnnotation.endpointInterface set");
         }
         
-        // TODO: (JLB) Using Class.forName() is probably not the best long-term way to get
the SEI class from the annotation
+        // TODO: Using Class.forName() is probably not the best long-term way to get the
SEI class from the annotation
         Class seiClass = null;
         try {
             seiClass = Class.forName(webServiceAnnotation.endpointInterface());
         } catch (ClassNotFoundException e) {
-            // TODO: (JLB) Throwing wrong exception
+            // TODO: Throwing wrong exception
             e.printStackTrace();
             throw new UnsupportedOperationException("Can't create SEI class: " + e);
         }
@@ -187,6 +192,9 @@
         EndpointDescription endpointDescription = new EndpointDescription(seiClass, null,
this);
         addEndpointDescription(endpointDescription);
 
+        // The anonymous AxisOperations are currently NOT added here.  The reason 
+        // is that (for now) this is a SERVER-SIDE code path, and the anonymous operations
+        // are only needed on the client side.
     }
 
 
@@ -203,12 +211,13 @@
     public void updateEndpointInterfaceDescription(Class sei, QName portQName) {
         
         if (getEndpointDescription(portQName) != null) {
-            // TODO: (JLB) Implement validating SEI against existing port built from WSDL
-            throw new UnsupportedOperationException("Not implemented yet");
+            // TODO: Refine validating and suplementing WSDL versus annotations
+            EndpointDescription endpointDesc = getEndpointDescription(portQName);
+            endpointDesc.updateWithSEI(sei);
         }
         else {
             // Use the SEI Class and its annotations to finish creating the Description hierachy:
Endpoint, EndpointInterface, Operations, Parameters, etc.
-            // TODO: (JLB) Need to create the Axis Description objects after we have all
the config info (i.e. from this SEI)
+            // 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);
         }
@@ -280,6 +289,9 @@
     private void buildAxisServiceFromWSDL() {
         // TODO: Change this to use WSDLToAxisServiceBuilder superclass
         WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder(wsdlWrapper.getDefinition(),
serviceQName, null);
+        // TODO: Currently this only builds the client-side AxisService; it needs to do client
and server somehow.
+        // Patterned after AxisService.createClientSideAxisService
+        serviceBuilder.setServerSide(false);
         try {
             axisService = serviceBuilder.populateService();
         } catch (AxisFault e) {
@@ -289,7 +301,7 @@
     }
     
     private void buildAxisServiceFromNoWSDL() {
-        // TODO: (JLB) Refactor this; probably just remove this method
+        // TODO: Refactor this to create from annotations.
 //        if (true) return;
 //        
 //        // Patterned after ServiceClient.createAnonymousService()
@@ -343,5 +355,24 @@
     }
     public URL getWSDLLocation() {
         return wsdlURL;
+    }
+    
+    /**
+     * Adds the anonymous axis operations to the AxisService.  Note that this is only needed
on 
+     * the client side, and they are currently used in two cases
+     * (1) For Dispatch clients (which don't use SEIs and thus don't use operations)
+     * (2) TEMPORARLIY for Services created without WSDL (and thus which have no AxisOperations
created)
+     *  See the AxisInvocationController invoke methods for more details.
+     *  
+     *   Based on ServiceClient.createAnonymouService
+     */
+    private void addAnonymousAxisOperations() {
+        if (axisService != null) {
+            OutOnlyAxisOperation outOnlyOperation = new OutOnlyAxisOperation(ServiceClient.ANON_OUT_ONLY_OP);
+            axisService.addOperation(outOnlyOperation);
+
+            OutInAxisOperation outInOperation = new OutInAxisOperation(ServiceClient.ANON_OUT_IN_OP);
+            axisService.addOperation(outInOperation);
+        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/proxy/ProxyTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/proxy/ProxyTests.java?rev=437541&r1=437540&r2=437541&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/proxy/ProxyTests.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/proxy/ProxyTests.java
Sun Aug 27 22:40:32 2006
@@ -45,7 +45,7 @@
 	private String axisEndpoint = "http://localhost:8080/axis2/services/ProxyDocLitWrappedService";
 	private QName portName = new QName("http://org.apache.axis2.proxy.doclitwrapped",
 			"ProxyDocLitWrappedPort");
-	private String wsdlLocation = "modules/jaxws/test/org/apache/axis2/jaxws/proxy/doclitwrapped/META-INF/ProxyDocLitWrapped.wsdl";
+	private String wsdlLocation = "test/org/apache/axis2/jaxws/proxy/doclitwrapped/META-INF/ProxyDocLitWrapped.wsdl";
 	private boolean runningOnAxis = true;
 	
 	public void testInvoke(){
@@ -74,6 +74,32 @@
             fail("Exception received" + e);
 		}
 	}
+
+    public void testInvokeWithWSDL(){
+        try{ 
+            if(!runningOnAxis){
+                return;
+            }
+            System.out.println("---------------------------------------");
+            File wsdl= new File(wsdlLocation); 
+            URL wsdlUrl = wsdl.toURL(); 
+            Service service = Service.create(wsdlUrl, serviceName);
+            String request = new String("some string request"); 
+            Object proxy =service.getPort(portName, DocLitWrappedProxy.class);
+            System.out.println(">>Invoking Binding Provider property");
+            BindingProvider p = (BindingProvider)proxy;
+            p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+                
+            DocLitWrappedProxy dwp = (DocLitWrappedProxy)proxy;
+            System.out.println(">> Invoking Proxy Synchronously");
+            String response = dwp.invoke(request);
+            System.out.println("Proxy Response =" + response);
+            System.out.println("---------------------------------------");
+        }catch(Exception e){ 
+            e.printStackTrace(); 
+            fail("Exception received" + e);
+        }
+    }
 	
 	public void testInvokeAsyncCallback(){
 		try{ 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message