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 sc...@apache.org on 2007/02/13 00:01:52 UTC

svn commit: r506735 - in /webservices/axis2/trunk/java/modules/jaxws: src/org/apache/axis2/jaxws/marshaller/impl/alt/ test-resources/wsdl/ test/org/apache/axis2/jaxws/proxy/ test/org/apache/axis2/jaxws/proxy/rpclit/ test/org/apache/axis2/jaxws/proxy/rp...

Author: scheu
Date: Mon Feb 12 15:01:51 2007
New Revision: 506735

URL: http://svn.apache.org/viewvc?view=rev&rev=506735
Log:
AXIS2-2162
Contributor:Rich Scheuerle
Small change for unmarshalling rpc faults + test

Added:
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCFault.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
    webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/RPCLit.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/META-INF/RPCLit.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/RPCLitImpl.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCLit.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java?view=diff&rev=506735&r1=506734&r2=506735
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java Mon Feb 12 15:01:51 2007
@@ -738,12 +738,13 @@
             // Get the JAXB object from the block
             JAXBBlockContext blockContext = new JAXBBlockContext(marshalDesc.getPackages());        
             
+            // Note that faultBean may not be a bean, it could be a primitive 
+            Class faultBeanFormalClass = loadClass(faultDesc.getFaultBean());     
             if (isRPC) {
                 // RPC is problem ! 
                 // Since RPC is type based, JAXB needs the declared type
                 // to unmarshal the object.
-                Class rpcType = faultDesc.getClass();
-                blockContext.setRPCType(rpcType);
+                blockContext.setRPCType(faultBeanFormalClass);
                 
             }
             
@@ -766,7 +767,6 @@
             if (log.isErrorEnabled()) {
                 log.debug("Found FaultDescription.  The exception name is " + exceptionClass.getName());
             }
-            Class faultBeanFormalClass = loadClass(faultDesc.getFaultBean());  // Note that faultBean may not be a bean, it could be a primitive     
             exception =createServiceException(xmlfault.getReason().getText(), 
                     exceptionClass, 
                     faultBeanObject, 

Modified: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/RPCLit.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/RPCLit.wsdl?view=diff&rev=506735&r1=506734&r2=506735
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/RPCLit.wsdl (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/RPCLit.wsdl Mon Feb 12 15:01:51 2007
@@ -88,6 +88,8 @@
    
    <xsd:element name="headerParam" type="xsd:string" />
    <xsd:element name="headerReturn" type="xsd:string" />
+   
+    <xsd:element name="myFault" type="xsd:int" />
   </schema>
  </wsdl:types>
 
@@ -239,9 +241,13 @@
       <wsdl:part name="headerReturn" element="impl:headerReturn"/>
 
    </wsdl:message>
-
-
-  
+   
+   <wsdl:message name="testFaultRequest" />
+   <wsdl:message name="testFaultResponse" />
+   
+   <wsdl:message name="rpcFault">
+     <wsdl:part name="rpcFault" element="impl:myFault" />
+   </wsdl:message>
 
    <wsdl:portType name="RPCLit">
      
@@ -333,6 +339,14 @@
 
       </wsdl:operation>
       
+      <wsdl:operation name="testFault">
+
+         <wsdl:input message="impl:testFaultRequest" name="testFaultRequest"/>
+
+         <wsdl:output message="impl:testFaultResponse" name="testFaultResponse"/>
+         <wsdl:fault name="rpcFault" message="impl:rpcFault" />
+      </wsdl:operation>
+      
    </wsdl:portType>
 
    <wsdl:binding name="RPCLitSoapBinding" type="impl:RPCLit">
@@ -518,6 +532,26 @@
 
          </wsdl:output>
 
+      </wsdl:operation> 
+      <wsdl:operation name="testFault">
+
+         <wsdlsoap:operation soapAction="testFault"/>
+
+         <wsdl:input name="testFaultRequest">
+
+            <wsdlsoap:body namespace="http://org/apache/axis2/jaxws/proxy/rpclit" use="literal"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="testFaultResponse">
+
+            <wsdlsoap:body namespace="http://org/apache/axis2/jaxws/proxy/rpclit" use="literal"/>
+
+         </wsdl:output>
+         <wsdl:fault name="rpcFault">
+            <wsdlsoap:fault name="rpcFault" use="literal" />
+         </wsdl:fault>
+
       </wsdl:operation>      
 
    </wsdl:binding>
@@ -533,3 +567,4 @@
    </wsdl:service>
 
 </wsdl:definitions>
+

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java?view=diff&rev=506735&r1=506734&r2=506735
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java Mon Feb 12 15:01:51 2007
@@ -35,6 +35,7 @@
 
 import junit.framework.TestCase;
 import org.apache.axis2.jaxws.proxy.rpclit.RPCLitImpl;
+import org.apache.axis2.jaxws.proxy.rpclit.sei.RPCFault;
 import org.apache.axis2.jaxws.proxy.rpclit.sei.RPCLit;
 import org.test.proxy.rpclit.ComplexAll;
 import org.test.proxy.rpclit.Enum;
@@ -126,6 +127,24 @@
         assertTrue(response != null);
         assertTrue(response.equals("helloworld"));
         
+    }
+    
+    /**
+     * Simple test that ensures that a service fault is thrown correctly
+     */
+    public void testFault() throws Exception {
+        try{ 
+            RPCLit proxy = getProxy();
+     
+            proxy.testFault();
+            fail("Expected RPCFault");
+        } catch(RPCFault rpcFault){ 
+            assertTrue(rpcFault.getMessage().equals("Throw RPCFault"));
+            assertTrue(rpcFault.getFaultInfo() == 123);
+        } catch(Exception e){ 
+            e.printStackTrace(); 
+            fail("Exception received" + e);
+        }
     }
     
     /**

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/META-INF/RPCLit.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/META-INF/RPCLit.wsdl?view=diff&rev=506735&r1=506734&r2=506735
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/META-INF/RPCLit.wsdl (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/META-INF/RPCLit.wsdl Mon Feb 12 15:01:51 2007
@@ -88,6 +88,8 @@
    
    <xsd:element name="headerParam" type="xsd:string" />
    <xsd:element name="headerReturn" type="xsd:string" />
+   
+    <xsd:element name="myFault" type="xsd:int" />
   </schema>
  </wsdl:types>
 
@@ -239,9 +241,13 @@
       <wsdl:part name="headerReturn" element="impl:headerReturn"/>
 
    </wsdl:message>
-
-
-  
+   
+   <wsdl:message name="testFaultRequest" />
+   <wsdl:message name="testFaultResponse" />
+   
+   <wsdl:message name="rpcFault">
+     <wsdl:part name="rpcFault" element="impl:myFault" />
+   </wsdl:message>
 
    <wsdl:portType name="RPCLit">
      
@@ -333,6 +339,14 @@
 
       </wsdl:operation>
       
+      <wsdl:operation name="testFault">
+
+         <wsdl:input message="impl:testFaultRequest" name="testFaultRequest"/>
+
+         <wsdl:output message="impl:testFaultResponse" name="testFaultResponse"/>
+         <wsdl:fault name="rpcFault" message="impl:rpcFault" />
+      </wsdl:operation>
+      
    </wsdl:portType>
 
    <wsdl:binding name="RPCLitSoapBinding" type="impl:RPCLit">
@@ -518,6 +532,26 @@
 
          </wsdl:output>
 
+      </wsdl:operation> 
+      <wsdl:operation name="testFault">
+
+         <wsdlsoap:operation soapAction="testFault"/>
+
+         <wsdl:input name="testFaultRequest">
+
+            <wsdlsoap:body namespace="http://org/apache/axis2/jaxws/proxy/rpclit" use="literal"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="testFaultResponse">
+
+            <wsdlsoap:body namespace="http://org/apache/axis2/jaxws/proxy/rpclit" use="literal"/>
+
+         </wsdl:output>
+         <wsdl:fault name="rpcFault">
+            <wsdlsoap:fault name="rpcFault" use="literal" />
+         </wsdl:fault>
+
       </wsdl:operation>      
 
    </wsdl:binding>
@@ -533,3 +567,4 @@
    </wsdl:service>
 
 </wsdl:definitions>
+

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/RPCLitImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/RPCLitImpl.java?view=diff&rev=506735&r1=506734&r2=506735
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/RPCLitImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/RPCLitImpl.java Mon Feb 12 15:01:51 2007
@@ -25,6 +25,7 @@
 import javax.xml.datatype.XMLGregorianCalendar;
 import javax.xml.namespace.QName;
 
+import org.apache.axis2.jaxws.proxy.rpclit.sei.RPCFault;
 import org.apache.axis2.jaxws.proxy.rpclit.sei.RPCLit;
 import org.test.proxy.rpclit.ComplexAll;
 import org.test.proxy.rpclit.Enum;
@@ -152,5 +153,9 @@
 
     public String testHeader(String bodyParam, String headerParam) {
         return bodyParam + headerParam;
+    }
+
+    public void testFault() throws RPCFault {
+        throw new RPCFault("Throw RPCFault", 123);
     }
 }

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCFault.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCFault.java?view=auto&rev=506735
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCFault.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCFault.java Mon Feb 12 15:01:51 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.proxy.rpclit.sei;
+
+import javax.xml.ws.WebFault;
+
+@WebFault(name = "myFault", targetNamespace = "http://org/apache/axis2/jaxws/proxy/rpclit")
+public class RPCFault extends Exception {
+
+    private int faultInfo;
+    public RPCFault() {
+        super();
+    }
+
+    public RPCFault(String message, int faultInfo) {
+        super(message);
+        this.faultInfo = faultInfo;
+    }
+
+    public RPCFault(String message, int faultInfo,Throwable cause) {
+        super(message, cause);
+        this.faultInfo = faultInfo;
+    }
+
+    public int getFaultInfo() {
+        return faultInfo;
+    }
+
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCLit.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCLit.java?view=diff&rev=506735&r1=506734&r2=506735
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCLit.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclit/sei/RPCLit.java Mon Feb 12 15:01:51 2007
@@ -206,6 +206,10 @@
         @WebParam(name = "arg_7_0", partName = "arg_7_0")
         String[] arg70);
 
-  
+    /**
+     * Tests Fault
+     */
+    @WebMethod(operationName="testFault", action="testFault")
+    public void testFault() throws RPCFault;
 
 }



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