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 ro...@apache.org on 2007/09/12 19:52:44 UTC

svn commit: r575025 - in /webservices/axis2/trunk/java/modules: kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java

Author: rott
Date: Wed Sep 12 10:52:42 2007
New Revision: 575025

URL: http://svn.apache.org/viewvc?rev=575025&view=rev
Log:
On the client side, generation of actions (when WS-A is enabled) works fine. But, when pure annotations are used, several problems occurred. This change fixes the creation of client side axisOperations when WS-A is enabled

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java?rev=575025&r1=575024&r2=575025&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java Wed Sep 12 10:52:42 2007
@@ -274,6 +274,8 @@
             outputName = operationName;
             if (messageExchangePattern.indexOf("in-out") >= 0) {
                 outputName += RESPONSE;
+            } else if (messageExchangePattern.indexOf("out-in") >= 0) {
+                outputName += REQUEST;
             }
         }
 

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?rev=575025&r1=575024&r2=575025&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Wed Sep 12 10:52:42 2007
@@ -114,8 +114,8 @@
     private Boolean onewayIsOneway;
 
     // ANNOTATION: @XmlList
-    private boolean 			isListType = false;
-    
+    private boolean isListType = false;
+
     // ANNOTATION: @RequestWrapper
     private RequestWrapper requestWrapperAnnotation;
     private String requestWrapperTargetNamespace;
@@ -274,7 +274,133 @@
         }
 
         newAxisOperation.setName(determineOperationQName(seiMethod));
+
+        newAxisOperation.setSoapAction(this.getAction());
+        
+        //*************************************************************************************
+        //NOTE: assumption here is that all info. need to generate the actions will have to come
+        //      from annotations (or default values)
+        //*************************************************************************************
+        
+        String messageExchangePattern = newAxisOperation.getMessageExchangePattern();
+        String targetNS = getEndpointInterfaceDescriptionImpl().getTargetNamespace();        
+        String portTypeName = getEndpointInterfaceDescriptionImpl().getEndpointDescriptionImpl().getName();
+        ArrayList inputActions = new ArrayList();
+         
+        //We don't have a name at this point, shouldn't matter if we have the MEP
+        //String inputName = newAxisOperation.getName().getLocalPart();
+        String inputName = null;
+        String inputAction = 
+                WSDL11ActionHelper.getInputActionFromStringInformation( messageExchangePattern, 
+                                                                        targetNS, 
+                                                                        portTypeName, 
+                                                                        newAxisOperation.getName().getLocalPart(), 
+                                                                        inputName);
+                
+        if (inputAction != null) {
+            inputActions.add(inputAction);
+                newAxisOperation.setWsamappingList(inputActions);
+        }
+        
+        
+        //set the OUTPUT ACTION
+
+        //We don't have a name at this point, shouldn't matter if we have the MEP
+        //String outputName = newAxisOperation.getName().getLocalPart();  //REVIEW:
+        String outputName = null;
+        String outputAction = 
+                WSDL11ActionHelper.getOutputActionFromStringInformation( messageExchangePattern, 
+                                                                         targetNS, 
+                                                                         portTypeName, 
+                                                                         newAxisOperation.getName().getLocalPart(), 
+                                                                         outputName);
+        
+        if (outputAction != null) {
+                newAxisOperation.setOutputAction(outputAction);
+        }
         
+        
+        //Map the action to the operation on the actual axisService
+        //TODO: Determine whether this should be done at a higher level in the 
+        //      description hierarchy
+        getEndpointInterfaceDescriptionImpl().getEndpointDescriptionImpl().getAxisService().mapActionToOperation(outputAction, newAxisOperation);
+
+        //Set the FAULT ACTION
+        // Walk the fault information
+        FaultDescription[] faultDescs = getFaultDescriptions();
+        if (faultDescs != null) {
+            for (int i=0; i <faultDescs.length; i++) {
+        
+                AxisMessage faultMessage = new AxisMessage();
+                String faultName = faultDescs[i].getName();
+                faultMessage.setName(faultName);
+                
+                String faultAction = 
+                        WSDL11ActionHelper.getFaultActionFromStringInformation( messageExchangePattern, 
+                                        portTypeName, 
+                                        newAxisOperation.getName().getLocalPart(), 
+                                        faultMessage.getName());
+                
+                if (faultAction != null) {
+                        newAxisOperation.addFaultAction(faultMessage.getName(), faultAction);
+                }
+                newAxisOperation.setFaultMessages(faultMessage);
+            }
+        }
+         
+        //REVIEW: Determine if other axisOperation values may need to be set
+        //      Currently, the following values are being set on AxisOperation in 
+        //      ServiceBuilder.populateService which we are not setting:
+        //          AxisOperation.setPolicyInclude()
+        //          AxisOperation.setFaultMessages()
+
+        // If this is a DOC/LIT/BARE operation, then set the QName of the input AxisMessage to the 
+        // part for the first IN or IN/OUT non-header parameter.  If there are no parameters, then don't set
+        // anything.  The AxisMessage name is used to do SOAP-body based routing of DOC/LIT/BARE
+        // incoming messages.
+        if (getSoapBindingStyle() == javax.jws.soap.SOAPBinding.Style.DOCUMENT
+                && getSoapBindingUse() == javax.jws.soap.SOAPBinding.Use.LITERAL
+                && getSoapBindingParameterStyle() == javax.jws.soap.SOAPBinding.ParameterStyle.BARE) {
+            ParameterDescription[] paramDescs = getParameterDescriptions();
+            if (paramDescs != null && paramDescs.length > 0) {
+                for (ParameterDescription paramDesc : paramDescs) {
+                    WebParam.Mode paramMode = paramDesc.getMode();
+                    if (!paramDesc.isHeader()
+                            && (paramMode == WebParam.Mode.IN || paramMode == WebParam.Mode.INOUT)) {
+                        // We've found the first IN or INOUT non-header parameter, so set the AxisMessage
+                        // QName based on this parameter then break out of the loop.
+                        AxisMessage axisMessage =
+                                newAxisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                        String elementName = paramDesc.getParameterName();
+                        String partNamespace = paramDesc.getTargetNamespace();
+                        if (log.isDebugEnabled()) {
+                            log.debug("Setting up annotation based Doc/Lit/Bare operation: "
+                                    + newAxisOperation.getName() + "; axisMessage: " + axisMessage
+                                    + "; name: " + elementName + "; partTNS: " + partNamespace);
+                        }
+                        if (axisMessage == null) {
+                            // TODO: RAS & NLS
+                            throw ExceptionFactory.makeWebServiceException("Could not setup Doc/Lit/Bare operation because input message is null");
+                        } else if (DescriptionUtils.isEmpty(partNamespace)) {
+                            // TODO: RAS & NLS
+                            throw ExceptionFactory.makeWebServiceException("Could not setup Doc/Lit/Bare operation because part namespace is empty");
+                        } else if (DescriptionUtils.isEmpty(elementName)) {
+                            // TODO: RAS & NLS
+                            throw ExceptionFactory.makeWebServiceException("Could not setup Doc/Lit/Bare operation because name is empty");
+                        } else {
+                            QName partQName = new QName(partNamespace, elementName);
+                            if (log.isDebugEnabled()) {
+                                log.debug("Setting AxisMessage element QName for bare mapping: "
+                                        + partQName);
+                            }
+                            axisMessage.setElementQName(partQName);
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+
         getEndpointInterfaceDescriptionImpl().getEndpointDescriptionImpl().getAxisService().addOperation(newAxisOperation);
         
         return newAxisOperation;
@@ -310,7 +436,12 @@
                     .makeWebServiceException("Caught exception trying to create AxisOperation", e);
         }
 
-        newAxisOperation.setName(determineOperationQName(this.methodComposite));
+        if (!getEndpointInterfaceDescription().getEndpointDescription().getServiceDescription().isServerSide()) {
+            newAxisOperation.setName(determineOperationQName(seiMethod));
+        } else {
+            newAxisOperation.setName(determineOperationQName(this.methodComposite));            
+        }
+        
         newAxisOperation.setSoapAction(this.getAction());
 
         //*************************************************************************************



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