cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r661064 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/staxutils/ parent/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/javascript/ systests/src/test/java/org/apache/cxf/systest/type_test/soap/
Date Wed, 28 May 2008 20:03:00 GMT
Author: dkulp
Date: Wed May 28 13:02:59 2008
New Revision: 661064

URL: http://svn.apache.org/viewvc?rev=661064&view=rev
Log:
[CXF-1551, CXF-1614] Cache xml events when validating and flush them out only if validation
succeeds

Added:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java
  (with props)
Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    cxf/trunk/parent/pom.xml
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
    cxf/trunk/rt/javascript/pom.xml
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitServerImpl.java

Added: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java?rev=661064&view=auto
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java
(added)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java
Wed May 28 13:02:59 2008
@@ -0,0 +1,277 @@
+/**
+ * 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.staxutils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.events.XMLEvent;
+
+import org.apache.cxf.common.util.StringUtils;
+
+
+/**
+ * 
+ */
+public class CachingXmlEventWriter implements XMLStreamWriter {
+    protected XMLEventFactory factory;
+    
+    List<XMLEvent> events = new ArrayList<XMLEvent>(1000);
+    Stack<NSContext> contexts = new Stack<NSContext>();
+    Stack<QName> elNames = new Stack<QName>();
+    QName lastStart;
+    NSContext curContext = new NSContext(null);
+    
+    public CachingXmlEventWriter() {
+        factory = XMLEventFactory.newInstance();
+    }
+
+    protected void addEvent(XMLEvent event) {
+        events.add(event);
+    }
+    
+    public List<XMLEvent> getEvents() {
+        return events;
+    }
+
+    public void close() throws XMLStreamException {
+        //nothing
+    }
+
+    public void flush() throws XMLStreamException {
+        //nothing
+    }
+
+    public NamespaceContext getNamespaceContext() {
+        return curContext;
+    }
+
+    public String getPrefix(String ns) throws XMLStreamException {
+        return curContext.getPrefix(ns);
+    }
+
+    public Object getProperty(String arg0) throws IllegalArgumentException {
+        //nothing
+        return null;
+    }
+
+
+    public void setNamespaceContext(NamespaceContext arg0) throws XMLStreamException {
+        curContext = new NSContext(arg0);
+    }
+
+    public void writeAttribute(String name, String value) throws XMLStreamException {
+        addEvent(factory.createAttribute(name, value));
+    }
+
+    public void writeAttribute(String pfx, String uri, String name, String value) throws
XMLStreamException {
+        addEvent(factory.createAttribute(pfx, uri, name, value));
+    }
+
+    public void writeCData(String arg0) throws XMLStreamException {
+        addEvent(factory.createCData(arg0));
+    }
+
+    public void writeCharacters(String arg0) throws XMLStreamException {
+        addEvent(factory.createCharacters(arg0));        
+    }
+
+    public void writeCharacters(char[] arg0, int arg1, int arg2) throws XMLStreamException
{
+        addEvent(factory.createCharacters(new String(arg0, arg1, arg2)));               

+    }
+
+    public void writeComment(String arg0) throws XMLStreamException {
+        addEvent(factory.createComment(arg0));
+    }
+
+    public void writeDTD(String arg0) throws XMLStreamException {
+        addEvent(factory.createDTD(arg0));        
+    }
+
+    public void writeEndDocument() throws XMLStreamException {
+        addEvent(factory.createEndDocument());
+    }
+
+
+    public void writeEntityRef(String arg0) throws XMLStreamException {
+        addEvent(factory.createEntityReference(arg0, null));        
+    }
+
+
+    public void writeProcessingInstruction(String arg0) throws XMLStreamException {
+        addEvent(factory.createProcessingInstruction(arg0, null));                
+    }
+
+    public void writeProcessingInstruction(String arg0, String arg1) throws XMLStreamException
{
+        addEvent(factory.createProcessingInstruction(arg0, arg1));        
+    }
+
+    public void writeStartDocument() throws XMLStreamException {
+        addEvent(factory.createStartDocument());
+    }
+
+    public void writeStartDocument(String arg0) throws XMLStreamException {
+        addEvent(factory.createStartDocument(arg0));        
+    }
+
+    public void writeStartDocument(String arg0, String arg1) throws XMLStreamException {
+        addEvent(factory.createStartDocument(arg0, arg1));        
+    }
+    
+    public void setDefaultNamespace(String ns) throws XMLStreamException {
+        writeNamespace("", ns);
+    }
+
+    
+    public void writeNamespace(String pfx, String ns) throws XMLStreamException {
+        curContext.addNs(pfx, ns);
+        if (StringUtils.isEmpty(pfx)) {
+            addEvent(factory.createNamespace(ns));            
+        } else {
+            addEvent(factory.createNamespace(pfx, ns));
+        } 
+    }
+    
+    private String creatPrefix() {
+        int count = 1;
+        String pfx = "ns" + count;
+        while (curContext.getNamespaceURI(pfx) != null) {
+            count++;
+            pfx = "ns" + count;
+        }
+        return pfx;
+    }
+    public void writeAttribute(String uri, String name, String value) throws XMLStreamException
{
+        if (!StringUtils.isEmpty(uri)) {
+            String pfx = this.getPrefix(uri);
+            if (pfx == null) {
+                pfx = creatPrefix();
+            }
+            addEvent(factory.createAttribute(pfx, uri, name, value));            
+        } else {            
+            addEvent(factory.createAttribute(name, value));            
+        }
+    }
+    public void setPrefix(String pfx, String uri) throws XMLStreamException {
+        curContext.addNs(pfx, uri);
+    }
+
+
+    public void writeEndElement() throws XMLStreamException {
+        addEvent(factory.createEndElement(lastStart, Collections.emptyList().iterator()));
+        curContext = contexts.pop();
+        lastStart = elNames.pop();
+    }
+    
+    
+    public void writeDefaultNamespace(String ns) throws XMLStreamException {
+        writeNamespace("", ns);
+    }
+    
+    public void writeEmptyElement(String name) throws XMLStreamException {
+        writeStartElement(name);
+        writeEndElement();
+    }
+    public void writeEmptyElement(String name, String ns) throws XMLStreamException {
+        writeStartElement(name, ns);
+        writeEndElement();
+    }
+    public void writeEmptyElement(String pfx, String name, String ns) throws XMLStreamException
{
+        writeStartElement(pfx, name, ns);
+        writeEndElement();
+    }
+    
+    public void writeStartElement(String name) throws XMLStreamException {
+        elNames.push(lastStart);
+        contexts.push(curContext);
+        curContext = new NSContext(curContext);
+        lastStart = new QName(name);
+        addEvent(factory.createStartElement(lastStart,
+                                            Collections.EMPTY_SET.iterator(),
+                                            Collections.EMPTY_SET.iterator()));
+    }
+    public void writeStartElement(String name, String ns) throws XMLStreamException {
+        elNames.push(lastStart);
+        contexts.push(curContext);
+        curContext = new NSContext(curContext);
+        lastStart = new QName(ns, name);
+        addEvent(factory.createStartElement(lastStart,
+                                            Collections.EMPTY_SET.iterator(),
+                                            Collections.EMPTY_SET.iterator()));
+    }
+    public void writeStartElement(String pfx, String name, String ns) throws XMLStreamException
{
+        elNames.push(lastStart);
+        contexts.push(curContext);
+        curContext = new NSContext(curContext);
+        lastStart = new QName(ns, name, pfx);
+        addEvent(factory.createStartElement(lastStart,
+                                            Collections.EMPTY_SET.iterator(),
+                                            Collections.EMPTY_SET.iterator()));
+    }
+    
+    private class NSContext implements NamespaceContext {
+        NamespaceContext parent;
+        Map<String, String> map = new HashMap<String, String>();
+        
+        public NSContext(NamespaceContext p) {
+            parent = p;
+        }
+        public void addNs(String pfx, String ns) {
+            map.put(ns, pfx);
+        }
+        
+        public String getNamespaceURI(String prefix) {
+            for (Map.Entry<String, String> e : map.entrySet()) {
+                if (e.getValue().equals(prefix)) {
+                    return e.getKey();
+                }
+            }
+            if (parent != null) {
+                return parent.getNamespaceURI(prefix);
+            }
+            return null;
+        }
+
+        public String getPrefix(String namespaceURI) {
+            String ret = map.get(namespaceURI);
+            if (ret == null && parent != null) {
+                return parent.getPrefix(namespaceURI);
+            }
+            return ret;
+        }
+
+        public Iterator getPrefixes(String namespaceURI) {
+            String pfx = getPrefix(namespaceURI);
+            return Collections.singleton(pfx).iterator();
+        }
+        
+    }
+}

Propchange: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=661064&r1=661063&r2=661064&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Wed May
28 13:02:59 2008
@@ -25,6 +25,7 @@
 import java.io.Writer;
 //import java.util.HashMap;
 //import java.util.Map;
+import java.util.Iterator;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.NamespaceContext;
@@ -38,6 +39,12 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.DTD;
+import javax.xml.stream.events.Namespace;
+import javax.xml.stream.events.StartDocument;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
@@ -875,4 +882,113 @@
             LOG.severe(e.getMessage());
         }
     }
+    
+    
+    private static void writeStartElementEvent(XMLEvent event, XMLStreamWriter writer) 
+        throws XMLStreamException {
+        StartElement start = event.asStartElement();
+        QName name = start.getName();
+        String nsURI = name.getNamespaceURI();
+        String localName = name.getLocalPart();
+        String prefix = name.getPrefix();
+        
+        if (prefix != null) {
+            writer.writeStartElement(prefix, localName, nsURI);
+        } else if (nsURI != null) {
+            writer.writeStartElement(localName, nsURI);
+        } else {
+            writer.writeStartElement(localName);
+        }
+        Iterator it = start.getNamespaces();
+        while (it != null && it.hasNext()) {
+            writeEvent((XMLEvent)it.next(), writer);
+        }
+        
+        it = start.getAttributes();
+        while (it != null && it.hasNext()) {
+            writeAttributeEvent((Attribute)it.next(), writer);            
+        }
+    }
+    private static void writeAttributeEvent(XMLEvent event, XMLStreamWriter writer) 
+        throws XMLStreamException {
+        
+        Attribute attr = (Attribute)event;
+        QName name = attr.getName();
+        String nsURI = name.getNamespaceURI();
+        String localName = name.getLocalPart();
+        String prefix = name.getPrefix();
+        String value = attr.getValue();
+
+        if (prefix != null) {
+            writer.writeAttribute(prefix, nsURI, localName, value);
+        } else if (nsURI != null) {
+            writer.writeAttribute(nsURI, localName, value);
+        } else {
+            writer.writeAttribute(localName, value);
+        }
+    }
+
+    public static void writeEvent(XMLEvent event, XMLStreamWriter writer)
+        throws XMLStreamException {
+
+        switch (event.getEventType()) {
+        case XMLEvent.START_ELEMENT:
+            writeStartElementEvent(event, writer);
+            break;
+        case XMLEvent.END_ELEMENT:
+            writer.writeEndElement();
+            break;
+        case XMLEvent.ATTRIBUTE: 
+            writeAttributeEvent(event, writer);
+            break;
+        case XMLEvent.ENTITY_REFERENCE:
+            writer.writeEntityRef(((javax.xml.stream.events.EntityReference)event).getName());
+            break;
+        case XMLEvent.DTD:
+            writer.writeDTD(((DTD)event).getDocumentTypeDeclaration());
+            break;
+        case XMLEvent.PROCESSING_INSTRUCTION:
+            if (((javax.xml.stream.events.ProcessingInstruction)event).getData() != null)
{
+                writer.writeProcessingInstruction(
+                    ((javax.xml.stream.events.ProcessingInstruction)event).getTarget(), 
+                    ((javax.xml.stream.events.ProcessingInstruction)event).getData());
+            } else {
+                writer.writeProcessingInstruction(
+                    ((javax.xml.stream.events.ProcessingInstruction)event).getTarget());
+            }
+            break;
+        case XMLEvent.NAMESPACE:
+            if (((Namespace)event).isDefaultNamespaceDeclaration()) {
+                writer.writeDefaultNamespace(((Namespace)event).getNamespaceURI());
+            } else {
+                writer.writeNamespace(((Namespace)event).getPrefix(),
+                                      ((Namespace)event).getNamespaceURI());
+            }
+            break;
+        case XMLEvent.COMMENT:
+            writer.writeComment(((javax.xml.stream.events.Comment)event).getText());
+            break;
+        case XMLEvent.CHARACTERS:
+        case XMLEvent.SPACE:
+            writer.writeCharacters(event.asCharacters().getData());
+            break;
+        case XMLEvent.CDATA:
+            writer.writeCData(event.asCharacters().getData());
+            break;
+        case XMLEvent.START_DOCUMENT:
+            if (((StartDocument)event).encodingSet()) {
+                writer.writeStartDocument(((StartDocument)event).getCharacterEncodingScheme(),
+                                          ((StartDocument)event).getVersion());
+
+            } else {
+                writer.writeStartDocument(((StartDocument)event).getVersion());
+            }
+            break;
+        case XMLEvent.END_DOCUMENT:
+            writer.writeEndDocument();
+            break;
+        default:
+            //shouldn't get here
+        }
+    }
 }

Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=661064&r1=661063&r2=661064&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Wed May 28 13:02:59 2008
@@ -478,6 +478,18 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+			<dependency>
+				<groupId>net.java.dev.stax-utils</groupId>
+				<artifactId>stax-utils</artifactId>
+				<version>20060502</version>
+				<exclusions>
+					<exclusion>
+						<groupId>com.bea.xml</groupId>
+						<artifactId>jsr173-ri</artifactId>
+					</exclusion>
+				</exclusions>
+			</dependency>
+
             <dependency>
                 <groupId>jaxen</groupId>
                 <artifactId>jaxen</artifactId>

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java?rev=661064&r1=661063&r2=661064&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
Wed May 28 13:02:59 2008
@@ -26,6 +26,7 @@
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.events.XMLEvent;
 import javax.xml.validation.Schema;
 
 import org.apache.cxf.databinding.DataWriter;
@@ -40,6 +41,8 @@
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.CachingXmlEventWriter;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
 public abstract class AbstractOutDatabindingInterceptor extends AbstractPhaseInterceptor<Message>
{
@@ -64,8 +67,23 @@
                               BindingOperationInfo operation, MessageContentsList objs, 
                               List<MessagePartInfo> parts) {
         OutputStream out = message.getContent(OutputStream.class);
-        XMLStreamWriter xmlWriter = message.getContent(XMLStreamWriter.class);
+        XMLStreamWriter origXmlWriter = message.getContent(XMLStreamWriter.class);
         Service service = exchange.get(Service.class);
+        XMLStreamWriter xmlWriter = origXmlWriter;
+        CachingXmlEventWriter cache = null;
+        
+        if (shouldValidate(message) && !isRequestor(message)) {
+            //need to cache the events in case validation fails
+            cache = new CachingXmlEventWriter();
+            try {
+                cache.setNamespaceContext(origXmlWriter.getNamespaceContext());
+            } catch (XMLStreamException e) {
+                //ignorable, will just get extra namespace decls
+            }
+            xmlWriter = cache;
+            out = null;
+        }
+        
         if (out != null 
             && writeToOutputStream(message, operation.getBinding(), service)
             && !MessageUtils.isTrue(message.getContextualProperty(DISABLE_OUTPUTSTREAM_OPTIMIZATION)))
{
@@ -96,10 +114,22 @@
                 }
             }
         }
+        if (cache != null) {
+            try {
+                for (XMLEvent event : cache.getEvents()) {
+                    StaxUtils.writeEvent(event, origXmlWriter);
+                }
+            } catch (XMLStreamException e) {
+                throw new Fault(e);
+            }
+        }
     }
     
     
-    
+    protected boolean shouldValidate(Message m) {
+        Object en = m.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED);
+        return Boolean.TRUE.equals(en) || "true".equals(en);
+    }
     
     protected boolean writeToOutputStream(Message m, BindingInfo info, Service s) {
         /**
@@ -137,8 +167,7 @@
     }
 
     private void setSchemaOutMessage(Service service, Message message, DataWriter<?>
writer) {
-        Object en = message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED);
-        if (Boolean.TRUE.equals(en) || "true".equals(en)) {
+        if (shouldValidate(message)) {
             Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfos().get(0));
             writer.setSchema(schema);
         }

Modified: cxf/trunk/rt/javascript/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/pom.xml?rev=661064&r1=661063&r2=661064&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/pom.xml (original)
+++ cxf/trunk/rt/javascript/pom.xml Wed May 28 13:02:59 2008
@@ -71,13 +71,6 @@
         <dependency>
             <groupId>net.java.dev.stax-utils</groupId>
             <artifactId>stax-utils</artifactId>
-            <version>20060502</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.bea.xml</groupId>
-                    <artifactId>jsr173-ri</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
         <dependency>
             <groupId>jaxen</groupId>
@@ -161,4 +154,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java?rev=661064&r1=661063&r2=661064&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java
Wed May 28 13:02:59 2008
@@ -18,14 +18,17 @@
  */
 package org.apache.cxf.systest.type_test.soap;
 
+import java.util.Arrays;
 import java.util.List;
 
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPFactory;
 import javax.xml.ws.Holder;
+import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.cxf.systest.type_test.AbstractTypeTestClient5;
+import org.apache.type_test.types1.FixedArray;
 import org.apache.type_test.types2.StructWithAnyArrayLax;
 import org.apache.type_test.types2.StructWithAnyStrict;
 import org.junit.BeforeClass;
@@ -45,6 +48,24 @@
     }
 
     @Test
+    public void testValidationFailureOnServerOut() throws Exception {
+        FixedArray x = new FixedArray();
+        FixedArray yOrig = new FixedArray();
+        
+        x.getItem().addAll(Arrays.asList(24, 42, 2008));
+        yOrig.getItem().addAll(Arrays.asList(24, 0, 1));
+
+        Holder<FixedArray> y = new Holder<FixedArray>(yOrig);
+        Holder<FixedArray> z = new Holder<FixedArray>();
+        try {
+            docClient.testFixedArray(x, y, z);
+            fail("should have thrown exception");
+        } catch (SOAPFaultException ex) {
+            assertTrue(ex.getMessage(), ex.getMessage().contains("Marshalling"));
+        }
+    }
+    
+    @Test
     public void testStructWithAnyStrict() throws Exception {
         SOAPFactory factory = SOAPFactory.newInstance();
         SOAPElement elem = factory.createElement("StringElementQualified",

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitServerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitServerImpl.java?rev=661064&r1=661063&r2=661064&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitServerImpl.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitServerImpl.java
Wed May 28 13:02:59 2008
@@ -21,6 +21,7 @@
 
 import javax.jws.WebService;
 import javax.xml.ws.Endpoint;
+import javax.xml.ws.Holder;
 
 
 import org.apache.cxf.BusFactory;
@@ -28,6 +29,7 @@
 import org.apache.cxf.systest.type_test.TypeTestImpl;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.type_test.doc.TypeTestPortType;
+import org.apache.type_test.types1.FixedArray;
 
 public class SOAPDocLitServerImpl extends AbstractBusTestServerBase {
     
@@ -58,6 +60,22 @@
                 endpointInterface = "org.apache.type_test.doc.TypeTestPortType",
                 targetNamespace = "http://apache.org/type_test/doc",
                 wsdlLocation = "testutils/type_test/type_test_doclit_soap.wsdl")
-    class SOAPTypeTestImpl extends TypeTestImpl implements TypeTestPortType {
+    public class SOAPTypeTestImpl extends TypeTestImpl implements TypeTestPortType {
+        
+        //override so we can test some bad validation things
+        public FixedArray testFixedArray(
+                                         FixedArray x,
+                                         Holder<FixedArray> y,
+                                         Holder<FixedArray> z) {
+            z.value = new FixedArray();
+            z.value.getItem().addAll(y.value.getItem());
+            y.value = new FixedArray();
+            y.value.getItem().addAll(x.getItem());
+            if (x.getItem().get(0) == 24) {
+                y.value.getItem().add(0);
+                z.value.getItem().remove(0);
+            }
+            return x;
+        }
     }
 }



Mime
View raw message