cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r765773 [2/2] - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/staxutils/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/core/src/main/java/org/apache/cxf/attachment/ rt/core/src/main/java/org/apache/cxf/data...
Date Thu, 16 Apr 2009 21:36:55 GMT
Added: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsResponseCallback.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsResponseCallback.java?rev=765773&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsResponseCallback.java
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsResponseCallback.java
Thu Apr 16 21:36:54 2009
@@ -0,0 +1,62 @@
+/**
+ * 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.cxf.jaxws;
+
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import javax.xml.ws.Response;
+
+import org.apache.cxf.endpoint.ClientCallback;
+
+class JaxwsResponseCallback<T> implements Response<T> {
+    ClientCallback callback;
+    public JaxwsResponseCallback(ClientCallback cb) {
+        callback = cb;
+    }
+    
+    public Map<String, Object> getContext() {
+        try {
+            return callback.getResponseContext();
+        } catch (Exception ex) {
+            return null;
+        }
+    }
+    public boolean cancel(boolean mayInterruptIfRunning) {
+        return callback.cancel(mayInterruptIfRunning);
+    }
+    @SuppressWarnings("unchecked")
+    public T get() throws InterruptedException, ExecutionException {
+        return (T)callback.get()[0];
+    }
+    @SuppressWarnings("unchecked")
+    public T get(long timeout, TimeUnit unit) throws InterruptedException,
+        ExecutionException, TimeoutException {
+        return (T)callback.get(timeout, unit)[0];
+    }
+    public boolean isCancelled() {
+        return callback.isCancelled();
+    }
+    public boolean isDone() {
+        return callback.isDone();
+    }
+}
\ No newline at end of file

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsResponseCallback.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsResponseCallback.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/Messages.properties?rev=765773&r1=765772&r2=765773&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/Messages.properties (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/Messages.properties Thu
Apr 16 21:36:54 2009
@@ -17,25 +17,7 @@
 #    specific language governing permissions and limitations
 #    under the License.
 #
-#
-#WEBSERVICE_ANNOTATION_NOT_PRESENT_MSG = Implementor or SEI is not annotated with WebService
annotation
-#SEI_NOT_IMPLEMENTED_MSG = Implementor does not implement required SEI
-#METHOD_NOT_DEFINED_MSG = Method {0} is not defined in SEI
-##SERVER_BINDING_ACTIVATION_FAILURE_MSG = Failed to publish endpoint - server binding could
not be activated
-#ENDPOINT_ALREADY_PUBLISHED_MSG = Endpoint is already published
-#ENDPOINT_INACTIVE_MSG = Endpoint is not active
-#ENDPOINT_ALREADY_REGISTERED_MSG = Endpoint is already registered
-#ENDPOINT_ACTIVE_MSG = Can't unregister active endpoint
-#BINDING_INCOMPATIBLE_CONTEXT_EXC = Server context does not contain address information compatible
with binding.
-#BINDING_INCOMPATIBLE_ADDRESS_EXC = Address is incompatible with binding.
-#BINDING_FACTORY_MISSING_EXC = Could not find binding for {0}
-#ENDPOINT_INVOCATION_FAILED = SEI Method {0} raised exception.  See exception for details.
-#BINDING_PROVIDER_METHOD_EXC = BindingProvider method {0} failed.
-#ASYNC_HANDLER_TIMEDOUT_EXC = AsyncHandler did not complete time.
-#BINDING_ID_NOT_IDENTICAL_MSG = BindingType in the impl class is not identical to the one
in WSDL.
-#DISPATCH_INVOKE_EXC = Dispatch of {0} raised exception.  See exception for details.
-#WSDL_DESCRIPTION_URI_MSG = Failed to set context property javax.xml.ws.wsdl.description
as URI. A URL will be used instead.
-#WSDL_DESCRIPTION_URL_MSG = Failed to set context property javax.xml.ws.wsdl.description
as URL.
+
 
 UNSUPPORTED_API_EXC = Method {0} is not supported yet.
 PORT_NAME_NULL_EXC = Port name must not be null.
@@ -52,4 +34,6 @@
 
 ENDPOINT_NOT_PUBLISHED = Endpoint has not been published yet. 
 ENDPOINTREFERENCE_TYPE_NOT_SUPPORTED = Class type {0} is not a subclass of EndpointReference
or the Endpoint implementation does not support EndpointReferences of this type.
-GET_ENDPOINTREFERENCE_UNSUPPORTED_BINDING = getEndpointReference not support binding HTTP
Binding.
\ No newline at end of file
+GET_ENDPOINTREFERENCE_UNSUPPORTED_BINDING = getEndpointReference not support binding HTTP
Binding.
+
+DISPATCH_OBJECT_NOT_SUPPORTED = {0} is not valid in {1} mode with {2} binding.

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=765773&r1=765772&r2=765773&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Thu Apr
16 21:36:54 2009
@@ -586,8 +586,10 @@
         for (AbstractFeature af : clientFac.getFeatures()) {
             af.initialize(client, bus);
         }
-        
-        Dispatch<T> disp = new DispatchImpl<T>(bus, client, mode, type, getExecutor());
+        if (executor != null) {
+            client.getEndpoint().setExecutor(executor);
+        }
+        Dispatch<T> disp = new DispatchImpl<T>(client, mode, type);
         configureObject(disp);
 
         return disp;
@@ -621,7 +623,9 @@
 
         AbstractServiceFactoryBean sf = null;
         try {
-            sf = createDispatchService(new JAXBDataBinding(context));
+            JAXBDataBinding db = new JAXBDataBinding(context);
+            db.setUnwrapJAXBElement(false);
+            sf = createDispatchService(db);
         } catch (ServiceConstructionException e) {
             throw new WebServiceException(e);
         }
@@ -630,8 +634,11 @@
         for (AbstractFeature af : clientFac.getFeatures()) {
             af.initialize(client, bus);
         }
-        Dispatch<Object> disp = new DispatchImpl<Object>(bus, client, mode, 
-                                                         context, Object.class, getExecutor());
+        if (executor != null) {
+            client.getEndpoint().setExecutor(executor);
+        }
+        Dispatch<Object> disp = new DispatchImpl<Object>(client, mode, 
+                                                         context, Object.class);
         configureObject(disp);
 
         return disp;

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java?rev=765773&r1=765772&r2=765773&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
Thu Apr 16 21:36:54 2009
@@ -29,6 +29,8 @@
 import javax.xml.ws.Binding;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 import org.apache.cxf.endpoint.Endpoint;
@@ -40,6 +42,7 @@
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.staxutils.W3CDOMStreamReader;
 import org.apache.cxf.staxutils.W3CDOMStreamWriter;
 import org.apache.cxf.transport.MessageObserver;
 
@@ -67,7 +70,7 @@
             XMLStreamWriter origWriter = message.getContent(XMLStreamWriter.class);
             Document document = XMLUtils.newDocument();
             message.setContent(Node.class, document);
-            W3CDOMStreamWriter writer = new W3CDOMStreamWriter(document);
+            W3CDOMStreamWriter writer = new W3CDOMStreamWriter(document.createDocumentFragment());
         
             // Replace stax writer with DomStreamWriter
             message.setContent(XMLStreamWriter.class, writer);        
@@ -112,6 +115,16 @@
                 origMessage = message.getContent(SOAPMessage.class);
                 message.setContent(XMLStreamReader.class, reader);
                 message.removeContent(SOAPMessage.class);
+            } else if (domWriter.getCurrentFragment() != null) {
+                DocumentFragment frag = domWriter.getCurrentFragment();
+                Node nd = frag.getFirstChild();
+                while (nd != null && !(nd instanceof Element)) {
+                    nd = nd.getNextSibling();
+                }
+                Source source = new DOMSource(nd);
+                message.setContent(Source.class, source);
+                message.setContent(XMLStreamReader.class,
+                                   new W3CDOMStreamReader(domWriter.getCurrentFragment()));
             } else if (domWriter.getDocument().getDocumentElement() != null) {
                 Source source = new DOMSource(domWriter.getDocument());
                 message.setContent(Source.class, source);

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java?rev=765773&r1=765772&r2=765773&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java
Thu Apr 16 21:36:54 2009
@@ -190,7 +190,8 @@
 
     public void setPayload(Source s) {       
         Message message = msgContext.getWrappedMessage();
-        Service.Mode mode = msgContext.getWrappedMessage().getExchange().get(Service.Mode.class);
+        Service.Mode mode = (Service.Mode)msgContext.getWrappedMessage()
+            .getContextualProperty(Service.Mode.class.getName());
         if (mode != null) {
             if (message instanceof SoapMessage) {
                 if (mode == Service.Mode.MESSAGE) {

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java?rev=765773&r1=765772&r2=765773&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
Thu Apr 16 21:36:54 2009
@@ -113,8 +113,9 @@
                 }
 
                 message.setContent(List.class, newObjs);
+            } catch (Fault f) {
+                throw f;
             } catch (Exception e) {
-                e.printStackTrace();
                 throw new Fault(e);
             }
             

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/DummyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/DummyImpl.java?rev=765773&r1=765772&r2=765773&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/DummyImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/DummyImpl.java
Thu Apr 16 21:36:54 2009
@@ -18,13 +18,11 @@
  */
 package org.apache.cxf.jaxws.support;
 
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+
 // this class do nothing here, just for a dispatch impl
-public class DummyImpl {
-//    public void invokeOneWay(Object o) {
-//        
-//    }
-//    
-//    public Object invoke(Object o) {
-//        return null;
-//    }
+@SOAPBinding(parameterStyle = ParameterStyle.BARE)
+public interface DummyImpl {
+
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=765773&r1=765772&r2=765773&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
Thu Apr 16 21:36:54 2009
@@ -36,6 +36,7 @@
 import javax.xml.ws.Response;
 import javax.xml.ws.Service;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 import org.xml.sax.InputSource;
@@ -45,6 +46,8 @@
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.hello_world_soap_http.GreeterImpl;
@@ -86,6 +89,12 @@
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly", launchServer(Server.class));
     }
+    
+    @org.junit.Before
+    public void setUp() {
+        BusFactory.getDefaultBus().getOutInterceptors().add(new LoggingOutInterceptor());
+        BusFactory.getDefaultBus().getInInterceptors().add(new LoggingInInterceptor());
+    }
 
     @Test
     public void testSOAPMessage() throws Exception {
@@ -210,6 +219,7 @@
     
     @Test
     public void testDOMSourcePAYLOAD() throws Exception {
+        
         /*URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
         assertNotNull(wsdl);
 
@@ -232,8 +242,15 @@
         
         assertNotNull(domResMsg);
         String expected = "Hello TestSOAPInputMessage";
-        assertEquals("Response should be : Hello TestSOAPInputMessage", expected, domResMsg.getNode()
-            .getTextContent().trim());
+        
+        Node node = domResMsg.getNode();
+        assertNotNull(node);
+        if (node instanceof Document) {
+            node = ((Document)node).getDocumentElement();
+        }
+        String content = node.getTextContent();
+        assertNotNull(content);
+        assertEquals("Response should be : Hello TestSOAPInputMessage", expected, content.trim());
 
         InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml");
         SOAPMessage soapReqMsg1 = MessageFactory.newInstance().createMessage(null, is1);
@@ -251,8 +268,16 @@
         DOMSource domRespMsg2 = (DOMSource)response.get();
         assertNotNull(domRespMsg2);
         String expected2 = "Hello TestSOAPInputMessage2";
-        assertEquals("Response should be : Hello TestSOAPInputMessage2", expected2, domRespMsg2.getNode()
-            .getTextContent().trim());
+        
+        node = domRespMsg2.getNode();
+        assertNotNull(node);
+        if (node instanceof Document) {
+            node = ((Document)node).getDocumentElement();
+        }
+        content = node.getTextContent();
+        assertNotNull(content);
+
+        assertEquals("Response should be : Hello TestSOAPInputMessage2", expected2, content.trim());
 
         InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml");
         SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null, is3);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java?rev=765773&r1=765772&r2=765773&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
Thu Apr 16 21:36:54 2009
@@ -191,7 +191,7 @@
             disp.invoke(soapReq);
             fail("Did not get expected exception");
         } catch (SOAPFaultException e) {
-            assertTrue("Did not get expected exception message",  e.getMessage()
+            assertTrue("Did not get expected exception message: " + e.getMessage(),  e.getMessage()
                        .indexOf("is not valid in PAYLOAD mode with SOAP/HTTP binding") >
-1);
         }
     }



Mime
View raw message