cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r440628 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/phase/ common/src/main/java/org/apache/cxf/helpers/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/core/src/main/java/org/apache/cxf/endpoint/ r...
Date Wed, 06 Sep 2006 06:13:30 GMT
Author: ffang
Date: Tue Sep  5 23:13:29 2006
New Revision: 440628

URL: http://svn.apache.org/viewvc?view=rev&rev=440628
Log:
get JAX-WS Holder working

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    incubator/cxf/trunk/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SimpleMethodInvoker.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ProxyTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
Tue Sep  5 23:13:29 2006
@@ -125,6 +125,7 @@
         while (state == State.EXECUTING && iterator.hasNext()) {
             try {
                 Interceptor currentInterceptor = iterator.next();
+                //System.out.println("Invoking handleMessage on interceptor " + currentInterceptor);
                 if (LOG.isLoggable(Level.FINE)) {
                     LOG.fine("Invoking handleMessage on interceptor " + currentInterceptor);
                 }

Modified: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java (original)
+++ incubator/cxf/trunk/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java Tue Sep
 5 23:13:29 2006
@@ -263,4 +263,17 @@
         return new ByteArrayInputStream(buf);
     }
 
+    public static Element fetchElementByNameAttribute(Element parent, String targetName,
String nameValue) {
+        Element ret = null;
+        NodeList nodeList = parent.getElementsByTagName(targetName);
+        Node node = null;
+        for (int i = 0; i < nodeList.getLength(); i++) {
+            node = nodeList.item(i);
+            if (node instanceof Element && ((Element)node).getAttribute("name").equals(nameValue))
{
+                ret = (Element)node;
+                break;
+            }
+        }
+        return ret;
+    }
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
Tue Sep  5 23:13:29 2006
@@ -35,6 +35,7 @@
 import org.apache.cxf.binding.soap.SoapVersionFactory;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
+//import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.staxutils.PartialXMLStreamReader;
 import org.apache.cxf.staxutils.StaxUtils;
@@ -49,8 +50,16 @@
 
     public void handleMessage(SoapMessage message) {
         XMLStreamReader xmlReader = message.getContent(XMLStreamReader.class);
+     
+        /*XMLUtils.setIndention(4);
+        System.out.println("the xml frag is ");
+        try {
+            System.out.println(XMLUtils.toString(StaxUtils.read(xmlReader)));
+        } catch (XMLStreamException e1) {
+            // TODO Auto-generated catch block
+            e1.printStackTrace();
+        }*/
         
-                
         if (xmlReader == null) {
             InputStream in = (InputStream)message.getContent(InputStream.class);
             if (in == null) {

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
Tue Sep  5 23:13:29 2006
@@ -20,15 +20,19 @@
 package org.apache.cxf.binding.soap.interceptor;
 
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.ResourceBundle;
 
 
 
+import javax.jws.WebParam;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.ws.Holder;
 
 import org.w3c.dom.Element;
 
@@ -146,8 +150,16 @@
             Object[] els = parts.toArray();
  
             if (args.length != els.length) {
-                message.setContent(Exception.class,
+                int holder = 0;
+                if (args.length > els.length) {
+                    //detect Holder in params
+                    Method method = message.getContent(Method.class);
+                    holder = checkHolder(method);
+                }
+                if ((args.length - holder) != els.length) {
+                    message.setContent(Exception.class,
                                    new RuntimeException("The number of arguments is not equal!"));
+                }
             }
  
             SoapVersion soapVersion = message.getVersion();
@@ -170,6 +182,9 @@
                     }
                     QName elName = ServiceModelUtil.getPartName(part);
                     DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message);
+                    if (arg instanceof Holder) {
+                        arg = ((Holder)arg).value;
+                    }
                     dataWriter.write(arg, elName, xtw);
                         
                     hasHeader = true;
@@ -188,6 +203,25 @@
         }
 
 
+    }
+
+    private int checkHolder(Method method) {
+        int holder = 0;
+        if (method != null) {
+            
+            Annotation[][] paramAnnotations = method.getParameterAnnotations();
+            for (int i = 0; i < paramAnnotations.length; i++) {
+                Annotation[] annotation = paramAnnotations[i];
+                for (int j = 0; j < annotation.length; j++) {
+                    if (annotation[j] instanceof WebParam 
+                        && (((WebParam)annotation[j]).mode().equals(WebParam.Mode.OUT)
+                            || ((WebParam)annotation[j]).mode().equals(WebParam.Mode.INOUT)))
{
+                        holder++;
+                    }
+                }
+            }
+        }
+        return holder;
     }       
     
     protected boolean isRequestor(Message message) {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Tue
Sep  5 23:13:29 2006
@@ -21,6 +21,9 @@
 
 import java.io.IOException;
 import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -28,6 +31,9 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.xml.ws.Holder;
+
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.Binding;
@@ -60,7 +66,7 @@
     
     Bus bus;
     Endpoint endpoint;
-    
+    Method methd;
     public ClientImpl(Bus b, Endpoint e) {
         bus = b;
         endpoint = e;
@@ -77,15 +83,8 @@
             LOG.fine("Invoke, operation info: " + oi + ", params: " + params);
         }
         Message message = endpoint.getBinding().createMessage();
-        if (ctx != null) {
-            message.setContent(Method.class, ctx.get(Message.METHOD));
-        }
-        if (params == null) {
-            message.setContent(List.class, Collections.emptyList());
-        } else {
-            message.setContent(List.class, Arrays.asList(params));
-        }
-   
+        setMethod(ctx, message);
+        setParameters(params, message);
         Exchange exchange = new ExchangeImpl();
         if (null != ctx) {
             exchange.putAll(ctx);
@@ -167,18 +166,87 @@
                     throw new RuntimeException(inMsg.getContent(Exception.class));
                 }
                     
+                // handle Holder case
+                List<Object> retList = new ArrayList<Object>();
+                if (message.getContent(Method.class) != null) {
+                    handleHolderReturn(params, message, inMsg, retList);
+                    return retList.toArray();
+                } 
                 return inMsg.getContent(List.class).toArray();
             }
         } 
         return null;
     }
 
+    private void setParameters(Object[] params, Message message) {
+        if (params == null) {
+            message.setContent(List.class, Collections.emptyList());
+        } else {
+            message.setContent(List.class, Arrays.asList(params));
+        }
+    }
+
+    private void setMethod(Map<String, Object> ctx, Message message) {
+        if (ctx != null) {
+            message.setContent(Method.class, ctx.get(Message.METHOD));
+            methd = (Method)ctx.get(Message.METHOD);
+        }
+    }
+
+    private void handleHolderReturn(Object[] params, Message message, Message inMsg, List<Object>
retList) {
+        Object[] rawRet = inMsg.getContent(List.class).toArray(); 
+        
+        int idx = 0;
+        Method method = message.getContent(Method.class);
+        if (method == null) {
+            return;
+        }
+        if (!((Class)method.getReturnType()).getName().equals("void")) {
+            retList.add(rawRet[0]);
+            idx++;
+        }
+        int holderStartIndex = 0;
+        Type[] para = method.getGenericParameterTypes();
+        for (int i = 0; i < para.length; i++) {
+            if (para[i] instanceof ParameterizedType) {
+                ParameterizedType paramType = (ParameterizedType)para[i];
+                if (((Class)paramType.getRawType()).getName().equals("javax.xml.ws.Holder"))
{
+                    break;
+                } else {
+                    holderStartIndex++;
+                }
+            } else {
+                holderStartIndex++;
+            }
+        }
+                    
+        for (int i = idx; i < rawRet.length; i++, holderStartIndex++) {
+            try {
+                ((Holder)params[holderStartIndex]).getClass().getField(
+                    "value").set(params[holderStartIndex], rawRet[i]);
+            } catch (IllegalArgumentException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            } catch (SecurityException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            } catch (IllegalAccessException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            } catch (NoSuchFieldException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+            
+        }
+    }
+
 
     public void onMessage(Message message) {
        
         message = endpoint.getBinding().createMessage(message);
         message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
-        
+        message.setContent(Method.class, methd);
         PhaseManager pm = bus.getExtension(PhaseManager.class);
         PhaseInterceptorChain chain = new PhaseInterceptorChain(pm.getInPhases());
         message.setInterceptorChain(chain);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
Tue Sep  5 23:13:29 2006
@@ -19,8 +19,11 @@
 
 package org.apache.cxf.interceptor;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
 import java.util.List;
 
+import javax.jws.WebParam;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamWriter;
 
@@ -65,8 +68,16 @@
             Object[] els = parts.toArray();
 
             if (args.length != els.length) {
-                message.setContent(Exception.class,
+                int holder = 0;
+                if (args.length > els.length) {
+                    //detect Holder in params
+                    Method method = message.getContent(Method.class);
+                    holder = checkHolder(method);
+                }
+                if ((args.length - holder) != els.length) {
+                    message.setContent(Exception.class,
                                    new RuntimeException("The number of arguments is not equal!"));
+                }
             }
             XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
             for (int idx = 0; idx < countParts; idx++) {
@@ -82,5 +93,22 @@
         }
     }
     
-    
+    private int checkHolder(Method method) {
+        int holder = 0;
+        if (method != null) {
+            
+            Annotation[][] paramAnnotations = method.getParameterAnnotations();
+            for (int i = 0; i < paramAnnotations.length; i++) {
+                Annotation[] annotation = paramAnnotations[i];
+                for (int j = 0; j < annotation.length; j++) {
+                    if (annotation[j] instanceof WebParam 
+                        && (((WebParam)annotation[j]).mode().equals(WebParam.Mode.OUT)
+                            || ((WebParam)annotation[j]).mode().equals(WebParam.Mode.INOUT)))
{
+                        holder++;
+                    }
+                }
+            }
+        }
+        return holder;
+    }       
 }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SimpleMethodInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SimpleMethodInvoker.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SimpleMethodInvoker.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SimpleMethodInvoker.java
Tue Sep  5 23:13:29 2006
@@ -19,14 +19,21 @@
 
 package org.apache.cxf.service.invoker;
 
+
 import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import javax.xml.ws.Holder;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.service.model.BindingOperationInfo;
 
+
 /**
  * An invoker which invokes a bean method. Will be replaced soon with something better.
  */
@@ -37,23 +44,72 @@
         super();
         this.bean = bean;
     }
-
+    
+    @SuppressWarnings("unchecked")
     public Object invoke(Exchange exchange, Object o) {
         BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
         
-        Method m = (Method)bop.getOperationInfo().getProperty(Method.class.getName());
-        List<?> params = (List<?>) o;
         
+        Method m = (Method)bop.getOperationInfo().getProperty(Method.class.getName());
+        List<Object> params = (List<Object>) o;
+                
+        checkHolder(m, params, exchange);
         Object res;
         try {
-            res = m.invoke(bean, params.toArray());
+            Object[] paramArray = params.toArray();
+            res = m.invoke(bean, paramArray);
             if (exchange.isOneWay()) {
                 return null;
             }
-            return Arrays.asList(res);
+            List<Object> retList = new ArrayList<Object>();
+            if (!((Class)m.getReturnType()).getName().equals("void")) {
+                retList.add(res);
+            }
+            for (int i = 0; i < paramArray.length; i++) {
+                if (paramArray[i] instanceof Holder) {
+                    retList.add(((Holder)paramArray[i]).value);
+                }
+            }
+            return Arrays.asList(retList.toArray());
         } catch (Exception e) {
             throw new Fault(e);
         }
     }
 
+    @SuppressWarnings("unchecked")
+    private void checkHolder(Method method, List<Object> params, Exchange exchange)
{
+        if (method != null) {
+           
+            Type[] para = method.getGenericParameterTypes();
+            for (int i = 0; i < para.length; i++) {
+                if (para[i] instanceof ParameterizedType) {
+                    Object param = null;
+                    ParameterizedType paramType = (ParameterizedType)para[i];
+                    if (((Class)paramType.getRawType()).getName().equals("javax.xml.ws.Holder"))
{
+                        
+                        try {
+                            param = new Holder(
+                                ((Class)paramType.getActualTypeArguments()[0]).newInstance());
+                        } catch (InstantiationException e) {
+                            throw new Fault(e);
+                        } catch (IllegalAccessException e) {
+                            throw new Fault(e);
+                        }
+                        if (i >= params.size()) {
+                            params.add(param);
+                        } else {
+                            params.set(i, new Holder(params.get(i)));
+                        }
+                        
+                    }
+                                       
+                    
+                }
+            }
+            
+        }
+        
+    }
+
+    
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
Tue Sep  5 23:13:29 2006
@@ -19,8 +19,12 @@
 
 package org.apache.cxf.jaxws.interceptors;
 
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
 import java.util.List;
 
+import javax.jws.soap.SOAPBinding;
+
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.jaxb.WrapperHelper;
@@ -44,6 +48,37 @@
 
     public void handleMessage(Message message) throws Fault {
         BindingOperationInfo boi = message.getExchange().get(BindingOperationInfo.class);
+        if (boi == null) {
+            return;
+        }
+        Method method = (Method)boi.getOperationInfo().getProperty(Method.class.getName());
+        if (method == null) {
+            method = message.getContent(Method.class);
+        }
+        try {
+            if (method != null) {
+                Class inter = null;
+                if (method.getDeclaringClass().isInterface()) {
+                    inter = method.getDeclaringClass();
+                } else {
+                    Type[] interfaces = method.getDeclaringClass().getGenericInterfaces();
+                    inter = (Class)interfaces[0];
+                }
+                
+                method = inter.getDeclaredMethod(
+                    method.getName(), (Class[])method.getParameterTypes());
+            }
+        } catch (SecurityException e) {
+            throw new Fault(e);
+
+        } catch (NoSuchMethodException e) {
+            throw new Fault(e);
+        }
+        if (method != null 
+            && method.isAnnotationPresent(SOAPBinding.class)
+            && method.getAnnotation(SOAPBinding.class).parameterStyle() == SOAPBinding.ParameterStyle.BARE)
{
+            return;
+        }
         if (boi != null && boi.isUnwrappedCapable()) {
             BindingOperationInfo boi2 = boi.getUnwrappedOperation();
             OperationInfo op = boi2.getOperationInfo();

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
Tue Sep  5 23:13:29 2006
@@ -27,13 +27,11 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Endpoint;
-//import javax.xml.ws.Holder;
+import javax.xml.ws.Holder;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-
-
 import org.apache.cxf.systest.common.ClientServerSetupBase;
 import org.apache.cxf.systest.common.ClientServerTestBase;
 import org.apache.cxf.systest.common.TestServerBase;
@@ -42,11 +40,11 @@
 import org.apache.header_test.TestHeaderImpl;
 import org.apache.header_test.types.TestHeader1;
 import org.apache.header_test.types.TestHeader1Response;
-/*import org.apache.header_test.types.TestHeader2;
+import org.apache.header_test.types.TestHeader2;
 import org.apache.header_test.types.TestHeader2Response;
 import org.apache.header_test.types.TestHeader3;
 import org.apache.header_test.types.TestHeader3Response;
-import org.apache.header_test.types.TestHeader5;*/
+import org.apache.header_test.types.TestHeader5;
 
 
 public class HeaderClientServerTest extends ClientServerTestBase {
@@ -89,7 +87,7 @@
                 assertTrue("server did not launch correctly", launchServer(MyServer.class));
             }
         };
-        
+                
     }  
 
     
@@ -111,11 +109,11 @@
             }
         } catch (UndeclaredThrowableException ex) {
             throw (Exception)ex.getCause();
-        } 
+        }
     } 
 
-    /*public void testOutHeader() throws Exception {
-        URL wsdl = getClass().getResource("/wsdl/soapheader_test.wsdl");
+    public void testOutHeader() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl");
         assertNotNull(wsdl);
         
         SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
@@ -135,14 +133,13 @@
                 assertEquals(val, outHeader.value.getResponseType());
             }
         } catch (UndeclaredThrowableException ex) {
-            //throw (Exception)ex.getCause();
-        } catch (Exception e) {
-            //should get Exception since Holder is not supported now
-        }
+            ex.printStackTrace();
+            throw (Exception)ex.getCause();
+        } 
     } 
 
     public void testInOutHeader() throws Exception {
-        URL wsdl = getClass().getResource("/wsdl/soapheader_test.wsdl");
+        URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl");
         assertNotNull(wsdl);
         
         SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
@@ -172,14 +169,12 @@
                 assertNull(inoutHeader.value.getRequestType());
             }
         } catch (UndeclaredThrowableException ex) {
-            //throw (Exception)ex.getCause();
-        } catch (Exception e) {
-            //should get Exception since Holder is not supported now
-        }
-    } 
+            throw (Exception)ex.getCause();
+        } 
+    }
 
     public void testReturnHeader() throws Exception {
-        URL wsdl = getClass().getResource("/wsdl/soapheader_test.wsdl");
+        URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl");
         assertNotNull(wsdl);
         
         SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
@@ -198,13 +193,11 @@
                 assertEquals(val, returnVal.getRequestType());
             }
         } catch (UndeclaredThrowableException ex) {
-            //throw (Exception)ex.getCause();
-        } catch (Exception e) {
-            //should get Exception since Holder is not supported now
-        }
+            throw (Exception)ex.getCause();
+        } 
     } 
     
     public static void main(String[] args) {
         junit.textui.TestRunner.run(HeaderClientServerTest.class);
-    }*/
+    }
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ProxyTest.java?view=diff&rev=440628&r1=440627&r2=440628
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ProxyTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ProxyTest.java Tue Sep
 5 23:13:29 2006
@@ -45,14 +45,17 @@
         assertNotNull(service);
 
         Greeter greeter = service.getPort(portName, Greeter.class);
+        boolean getException = false;
 
         try {
             String reply = greeter.sayHi();
             System.out.println("Response to sayHi() is: " + reply);
         } catch (Exception ex) {
-            ex.printStackTrace();
+            //ex.printStackTrace();
             // ecpect this as no server is up and running
+            getException = true;
         }
+        assertTrue(getException);
 
     }
 



Mime
View raw message