cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r949080 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/ tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/expec...
Date Fri, 28 May 2010 03:15:10 GMT
Author: ema
Date: Fri May 28 03:15:10 2010
New Revision: 949080

URL: http://svn.apache.org/viewvc?rev=949080&view=rev
Log:
[CXF-2827]:Generated the wsa:action attribute for <wsdl:input> and <wsdl:output>
element;Removed the duplicate wsam:action attribute

Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
    cxf/trunk/tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=949080&r1=949079&r2=949080&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
Fri May 28 03:15:10 2010
@@ -482,46 +482,49 @@ public class JaxWsServiceFactoryBean ext
         }
 
         Action action = method.getAnnotation(Action.class);
-        if (action == null) {
+        Addressing addressing = method.getDeclaringClass().getAnnotation(Addressing.class);
+        if (action == null && addressing == null) {
             return;
         }
-        MessageInfo input = operation.getInput();
-        if (!StringUtils.isEmpty(action.input())) {
-            input.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, action.input());
-            input.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, action.input());
+        if (action == null && addressing != null) {
+            operation.getInput().addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME,
+                                                       computeAction(operation, "Request"));
+            operation.getOutput().addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME,
+                                                       computeAction(operation, "Response"));
+
         } else {
-            input.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, 
-                                        computeAction(operation, "Request"));
-        }
-        
-        MessageInfo output = operation.getOutput();
-        if (output != null && !StringUtils.isEmpty(action.output())) {
-            output.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, action.output());
-            output.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, action.output());
-        } else if (output != null) {
-            output.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, 
-                                         computeAction(operation, "Response"));         
  
-        }
-        
-        FaultAction[] faultActions = action.fault();
-        if (faultActions != null 
-            && faultActions.length > 0 
-            && operation.getFaults() != null) {
-            for (FaultAction faultAction : faultActions) {                
-                FaultInfo faultInfo = getFaultInfo(operation, faultAction.className());
-                faultInfo.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, 
-                                                faultAction.value());
-                faultInfo.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, 
-                                                faultAction.value());
-                if (operation.isUnwrappedCapable()) {
-                    faultInfo = getFaultInfo(operation.getUnwrappedOperation(), faultAction.className());
-                    faultInfo.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, 
-                                                    faultAction.value());
-                    faultInfo.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, 
-                                                    faultAction.value());
+            MessageInfo input = operation.getInput();
+            if (!StringUtils.isEmpty(action.input())) {
+                input.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, action.input());
+            } else {
+                input.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, computeAction(operation,
+                                                                                        
    "Request"));
+            }
+
+            MessageInfo output = operation.getOutput();
+            if (output != null && !StringUtils.isEmpty(action.output())) {
+                output.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, action.output());
+            } else if (output != null) {
+                output.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, computeAction(operation,
+                                                                                        
     "Response"));
+            }
+
+            FaultAction[] faultActions = action.fault();
+            if (faultActions != null && faultActions.length > 0 && operation.getFaults()
!= null) {
+                for (FaultAction faultAction : faultActions) {
+                    FaultInfo faultInfo = getFaultInfo(operation, faultAction.className());
+                    faultInfo.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, faultAction.value());
+                    faultInfo.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, faultAction.value());
+                    if (operation.isUnwrappedCapable()) {
+                        faultInfo = getFaultInfo(operation.getUnwrappedOperation(), faultAction.className());
+                        faultInfo.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME,
faultAction
+                            .value());
+                        faultInfo.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME,
faultAction
+                            .value());
+                    }
                 }
             }
-        } 
+        }
         for (FaultInfo fi : operation.getFaults()) {
             if (fi.getExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME) == null) {
                 String f = "/Fault/" + fi.getName().getLocalPart();

Modified: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?rev=949080&r1=949079&r2=949080&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
(original)
+++ cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Fri May 28 03:15:10 2010
@@ -502,6 +502,12 @@ public class JavaToProcessorTest extends
         }
         File wsdlFile = new File(output, "add_numbers.wsdl");
         assertTrue("Generate Wsdl Fail", wsdlFile.exists());
+        //To test there is wsam:action generated for the 
+        String wsdlString = getStringFromFile(wsdlFile);
+        assertTrue("The wsaAction is not generated for NOActionAnotation method", wsdlString
+            .indexOf("http://fortest.tools.cxf.apache.org/AddNumbersImpl/addNumbers2Request")
> -1);
+        assertTrue("The wsaAction is not generated for NOActionAnotation method", wsdlString
+            .indexOf("http://fortest.tools.cxf.apache.org/AddNumbersImpl/addNumbers2Response")
> -1);
         URI expectedFile = getClass().getResource("expected/add_numbers_expected.wsdl").toURI();
         assertWsdlEquals(new File(expectedFile), wsdlFile);
     }

Modified: cxf/trunk/tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl?rev=949080&r1=949079&r2=949080&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl
(original)
+++ cxf/trunk/tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl
Fri May 28 03:15:10 2010
@@ -77,25 +77,25 @@
   </wsdl:message>
   <wsdl:portType name="AddNumbersImpl">
     <wsdl:operation name="addNumbers">
-      <wsdl:input name="addNumbers" message="tns:addNumbers" wsam:Action="http://cxf.apache.org/input"
wsaw:Action="http://cxf.apache.org/input">
+      <wsdl:input name="addNumbers" message="tns:addNumbers" wsaw:Action="http://cxf.apache.org/input">
     </wsdl:input>
-      <wsdl:output name="addNumbersResponse" message="tns:addNumbersResponse" wsam:Action="http://cxf.apache.org/output"
wsaw:Action="http://cxf.apache.org/output">
+      <wsdl:output name="addNumbersResponse" message="tns:addNumbersResponse" wsaw:Action="http://cxf.apache.org/output">
     </wsdl:output>
       <wsdl:fault name="AddNumbersException" message="tns:AddNumbersException" wsam:Action="http://fortest.tools.cxf.apache.org/AddNumbersImpl/addNumbers/Fault/AddNumbersException">
     </wsdl:fault>
     </wsdl:operation>
     <wsdl:operation name="addNumbers3">
-      <wsdl:input name="addNumbers3" message="tns:addNumbers3" wsam:Action="http://cxf.apache.org/input3"
wsaw:Action="http://cxf.apache.org/input3">
+      <wsdl:input name="addNumbers3" message="tns:addNumbers3" wsaw:Action="http://cxf.apache.org/input3">
     </wsdl:input>
-      <wsdl:output name="addNumbers3Response" message="tns:addNumbers3Response" wsam:Action="http://cxf.apache.org/output3"
wsaw:Action="http://cxf.apache.org/output3">
+      <wsdl:output name="addNumbers3Response" message="tns:addNumbers3Response" wsaw:Action="http://cxf.apache.org/output3">
     </wsdl:output>
       <wsdl:fault name="AddNumbersException" message="tns:AddNumbersException" wsam:Action="http://cxf.apache.org/fault3"
wsaw:Action="http://cxf.apache.org/fault3">
     </wsdl:fault>
     </wsdl:operation>
     <wsdl:operation name="addNumbers2">
-      <wsdl:input name="addNumbers2" message="tns:addNumbers2">
+      <wsdl:input name="addNumbers2" message="tns:addNumbers2" wsam:Action="http://fortest.tools.cxf.apache.org/AddNumbersImpl/addNumbers2Request">
     </wsdl:input>
-      <wsdl:output name="addNumbers2Response" message="tns:addNumbers2Response">
+      <wsdl:output name="addNumbers2Response" message="tns:addNumbers2Response" wsam:Action="http://fortest.tools.cxf.apache.org/AddNumbersImpl/addNumbers2Response">
     </wsdl:output>
     </wsdl:operation>
   </wsdl:portType>
@@ -143,4 +143,4 @@
     </wsdl:port>
   </wsdl:service>
     <wsp:Policy wsu:Id="AddNumbersImplServiceSoapBinding_WSAM_Addressing_Policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsam:Addressing
wsp:Optional="true"><wsp:Policy/></wsam:Addressing></wsp:Policy>
-</wsdl:definitions>
+</wsdl:definitions>
\ No newline at end of file



Mime
View raw message