You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2007/04/20 05:13:16 UTC

svn commit: r530622 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/ tools/javato/src/test/java/o...

Author: mmao
Date: Thu Apr 19 20:13:15 2007
New Revision: 530622

URL: http://svn.apache.org/viewvc?view=rev&rev=530622
Log:
CXF-539
SOAPTransportFactory add soapFault extensors into wsdlFault

Added:
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java?view=diff&rev=530622&r1=530621&r2=530622
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java Thu Apr 19 20:13:15 2007
@@ -151,7 +151,7 @@
      *
      * @param fault the fault.
      */
-    synchronized void addFault(FaultInfo fault) {
+    public synchronized void addFault(FaultInfo fault) {
         if (faults == null) { 
             faults = new ConcurrentHashMap<QName, FaultInfo>(4);
         }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java?view=diff&rev=530622&r1=530621&r2=530622
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java Thu Apr 19 20:13:15 2007
@@ -40,6 +40,7 @@
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -48,6 +49,7 @@
 import org.apache.cxf.tools.common.extensions.soap.SoapAddress;
 import org.apache.cxf.tools.common.extensions.soap.SoapBinding;
 import org.apache.cxf.tools.common.extensions.soap.SoapBody;
+import org.apache.cxf.tools.common.extensions.soap.SoapFault;
 import org.apache.cxf.tools.common.extensions.soap.SoapHeader;
 import org.apache.cxf.tools.common.extensions.soap.SoapOperation;
 import org.apache.cxf.tools.util.SOAPBindingUtil;
@@ -108,6 +110,12 @@
             bi.addExtensor(soapBinding);
 
             for (BindingOperationInfo b : bi.getOperations()) {
+                for (BindingFaultInfo faultInfo : b.getFaults()) {
+                    SoapFault soapFault = SOAPBindingUtil.createSoapFault(extensionRegistry, isSoap12);
+                    soapFault.setUse("literal");
+                    soapFault.setName(faultInfo.getFaultInfo().getFaultName().getLocalPart());
+                    faultInfo.addExtensor(soapFault);
+                }
                 SoapOperationInfo soi = b.getExtensor(SoapOperationInfo.class);
                 
                 SoapOperation soapOperation = SOAPBindingUtil.createSoapOperation(extensionRegistry,

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?view=diff&rev=530622&r1=530621&r2=530622
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java Thu Apr 19 20:13:15 2007
@@ -70,12 +70,15 @@
     @Test
     public void testCalculator() throws Exception {
         ToolContext context = new ToolContext();
-        context.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/calculator_rpc.wsdl");
+        context.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/calculator.wsdl");
         context.put(ToolConstants.CFG_CLASSNAME,
                     "org.apache.cxf.tools.fortest.classnoanno.docwrapped.Calculator");
         processor.setEnvironment(context);
         processor.process();
 
+        String expectedFile = getClass().getResource("expected/calculator.wsdl").getFile();
+        assertFileEquals(new File(expectedFile), new File(output, "calculator.wsdl"));
+
         // Test for CXF-337
         // FIXME - check for existence and correctness of faults
     }
@@ -115,7 +118,6 @@
         assertTrue(((SoapBindingConfiguration)config).getVersion() instanceof Soap12);
     }
 
-    // FIXME CXF-534
     @Test
     public void testSOAP12() throws Exception {
         ToolContext context = new ToolContext();

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl?view=auto&rev=530622
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl (added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl Thu Apr 19 20:13:15 2007
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<wsdl:definitions name="Calculator" targetNamespace="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/" xmlns:ns1="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <wsdl:types>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/">
+<xsd:element name="add">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="a" nillable="true" type="xsd:int"/>
+<xsd:element name="b" nillable="true" type="xsd:int"/>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="addResponse">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="return" nillable="true" type="xsd:int"/>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+  </wsdl:types>
+  <wsdl:message name="add">
+    <wsdl:part name="add" element="ns1:add">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="addResponse">
+    <wsdl:part name="addResponse" element="ns1:addResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="AddException">
+    <wsdl:part name="AddException">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="CalculatorPortType">
+    <wsdl:operation name="add">
+      <wsdl:input name="add" message="ns1:add">
+    </wsdl:input>
+      <wsdl:output name="addResponse" message="ns1:addResponse">
+    </wsdl:output>
+      <wsdl:fault name="AddException" message="ns1:AddException">
+    </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="CalculatorSoapBinding" type="ns1:CalculatorPortType">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="add">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="add">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="addResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+      <wsdl:fault name="AddException">
+        <soap:fault name="AddException" use="literal"/>
+      </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="Calculator">
+    <wsdl:port name="CalculatorPort" binding="ns1:CalculatorSoapBinding">
+      <soap:address location="http://localhost:9090/hello"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl?view=diff&rev=530622&r1=530621&r2=530622
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl Thu Apr 19 20:13:15 2007
@@ -1,21 +1,3 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements. See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership. The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License. You may obtain a copy of the License at
- 
-  http://www.apache.org/licenses/LICENSE-2.0
- 
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied. See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
 <?xml version="1.0" encoding="UTF-8"?>
 <wsdl:definitions name="GreeterService" targetNamespace="http://apache.org/hello_world_soap12_http" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ns1="http://apache.org/hello_world_soap12_http" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://apache.org/hello_world_soap12_http/types" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <wsdl:types>
@@ -102,6 +84,7 @@
         <soap12:body use="literal"/>
       </wsdl:output>
       <wsdl:fault name="faultDetail">
+        <soap12:fault name="faultDetail" use="literal"/>
       </wsdl:fault>
     </wsdl:operation>
   </wsdl:binding>

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl?view=diff&rev=530622&r1=530621&r2=530622
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl Thu Apr 19 20:13:15 2007
@@ -160,6 +160,7 @@
         <soap:body use="literal"/>
       </wsdl:output>
       <wsdl:fault name="faultDetail">
+        <soap:fault name="faultDetail" use="literal"/>
       </wsdl:fault>
     </wsdl:operation>
   </wsdl:binding>

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl?view=diff&rev=530622&r1=530621&r2=530622
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl Thu Apr 19 20:13:15 2007
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements. See the NOTICE file
@@ -16,7 +17,6 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<?xml version="1.0" encoding="UTF-8"?>
 <wsdl:definitions name="StockService" targetNamespace="http://rpc.classnoanno.fortest.tools.cxf.apache.org/" xmlns:ns1="http://rpc.classnoanno.fortest.tools.cxf.apache.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <wsdl:message name="getPrice">
     <wsdl:part name="arg0" type="xsd:string">