cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r606951 - in /incubator/cxf/trunk/rt/javascript/src: main/java/org/apache/cxf/javascript/ main/resources/org/apache/cxf/javascript/ test/java/org/apache/cxf/javascript/ test/java/org/apache/cxf/javascript/fortest/ test/java/org/apache/cxf/j...
Date Wed, 26 Dec 2007 21:13:59 GMT
Author: bimargulies
Date: Wed Dec 26 13:13:58 2007
New Revision: 606951

URL: http://svn.apache.org/viewvc?rev=606951&view=rev
Log:
xsi:anyType support for Javascript.

Added:
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
  (with props)
Modified:
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
    incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
    incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml
    incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
    incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java?rev=606951&r1=606950&r2=606951&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
Wed Dec 26 13:13:58 2007
@@ -34,11 +34,13 @@
 import org.apache.ws.commons.schema.XmlSchemaType;
 
 /**
- * A set of functions that assist in JavaScript generation. This includes functions
- * for appending strings of JavaScript to a buffer as well as some type utilities.
+ * A set of functions that assist in JavaScript generation. This includes
+ * functions for appending strings of JavaScript to a buffer as well as some
+ * type utilities.
  */
 public class JavascriptUtils {
     private static final String NL = "\n";
+    private static int anyTypePrefixCounter;
     private StringBuilder code;
     private Stack<String> prefixStack;
     private String xmlStringAccumulatorVariable;
@@ -46,7 +48,7 @@
     private Set<String> nonStringSimpleTypes;
     private Set<String> intTypes;
     private Set<String> floatTypes;
-    
+
     public JavascriptUtils(StringBuilder code) {
         this.code = code;
         defaultValueForSimpleType = new HashMap<String, String>();
@@ -63,7 +65,7 @@
         nonStringSimpleTypes.add("unsignedLong");
         nonStringSimpleTypes.add("float");
         nonStringSimpleTypes.add("double");
-        
+
         intTypes = new HashSet<String>();
         intTypes.add("int");
         intTypes.add("long");
@@ -72,11 +74,11 @@
         floatTypes = new HashSet<String>();
         floatTypes.add("float");
         floatTypes.add("double");
-        
+
         prefixStack = new Stack<String>();
         prefixStack.push("    ");
     }
-    
+
     public String getDefaultValueForSimpleType(XmlSchemaType type) {
         String val = defaultValueForSimpleType.get(type.getName());
         if (val == null) { // ints and such return the appropriate 0.
@@ -85,16 +87,16 @@
             return val;
         }
     }
-    
+
     public boolean isStringSimpleType(QName typeName) {
-        return !(WSDLConstants.NS_SCHEMA_XSD.equals(typeName.getNamespaceURI()) 
-                 && nonStringSimpleTypes.contains(typeName.getLocalPart()));
+        return !(WSDLConstants.NS_SCHEMA_XSD.equals(typeName.getNamespaceURI()) &&
nonStringSimpleTypes
+            .contains(typeName.getLocalPart()));
     }
-    
+
     public void setXmlStringAccumulator(String variableName) {
         xmlStringAccumulatorVariable = variableName;
     }
-    
+
     public void startXmlStringAccumulator(String variableName) {
         xmlStringAccumulatorVariable = variableName;
         code.append(prefix());
@@ -102,17 +104,18 @@
         code.append(variableName);
         code.append(" = '';" + NL);
     }
-    
+
     public static String protectSingleQuotes(String value) {
         return value.replaceAll("'", "\\'");
     }
-    
+
     public String escapeStringQuotes(String data) {
         return data.replace("'", "\\'");
     }
-    
+
     /**
-     * emit javascript to append a value to the accumulator. 
+     * emit javascript to append a value to the accumulator.
+     * 
      * @param value
      */
     public void appendString(String value) {
@@ -121,30 +124,30 @@
         code.append(escapeStringQuotes(value));
         code.append("';" + NL);
     }
-    
+
     public void appendExpression(String value) {
         code.append(prefix());
         code.append(xmlStringAccumulatorVariable + " = " + xmlStringAccumulatorVariable +
" + ");
         code.append(value);
         code.append(";" + NL);
     }
-    
+
     private String prefix() {
         return prefixStack.peek();
     }
-    
+
     public void appendLine(String line) {
         code.append(prefix());
         code.append(line);
         code.append(NL);
     }
-    
+
     public void startIf(String test) {
         code.append(prefix());
         code.append("if (" + test + ") {" + NL);
         prefixStack.push(prefix() + " ");
     }
-    
+
     public void startBlock() {
         code.append(prefix());
         code.append("{" + NL);
@@ -157,13 +160,13 @@
         code.append("} else {" + NL);
         prefixStack.push(prefix() + " ");
     }
-    
+
     public void endBlock() {
         prefixStack.pop();
         code.append(prefix());
         code.append("}" + NL);
     }
-    
+
     public void startFor(String start, String test, String increment) {
         code.append(prefix());
         code.append("for (" + start + ";" + test + ";" + increment + ") {" + NL);
@@ -187,8 +190,9 @@
         code.append("do  {" + NL);
         prefixStack.push(prefix() + " ");
     }
-    
-    // Given a js variable and a simple type object, correctly set the variables simple type

+
+    // Given a js variable and a simple type object, correctly set the variables
+    // simple type
     public String javascriptParseExpression(XmlSchemaType type, String value) {
         if (!(type instanceof XmlSchemaSimpleType)) {
             return value;
@@ -204,16 +208,17 @@
             return value;
         }
     }
-    
+
     public static String javaScriptNameToken(String token) {
         return token;
     }
-    
+
     /**
      * Given an element, generate the serialization code.
-     * @param elementInfo      description of the element we are serializing
-     * @param referencePrefix  prefix to the Javascript variable. Nothing for args,
-     * this._ for members.
+     * 
+     * @param elementInfo description of the element we are serializing
+     * @param referencePrefix prefix to the Javascript variable. Nothing for
+     *                args, this._ for members.
      * @param schemaCollection caller's schema collection.
      */
     public void generateCodeToSerializeElement(ParticleInfo elementInfo,
@@ -224,7 +229,8 @@
         boolean optional = elementInfo.isOptional();
         boolean array = elementInfo.isArray();
         String jsVar = referencePrefix + elementInfo.getJavascriptName();
-        
+        appendLine("// block for local variables");
+        startBlock(); // allow local variables.
         // first question: optional?
         if (optional) {
             startIf(jsVar + " != null");
@@ -234,7 +240,7 @@
         // and nillable in the array case applies to the elements.
         if (nillable && !array) {
             startIf(jsVar + " == null");
-            appendString("<" + elementInfo.getXmlName() + " " + XmlSchemaUtils.NIL_ATTRIBUTES
+ "/>");
+            appendString("<" + elementInfo.getXmlName() + " " + XmlSchemaUtils.XSI_NIL
+ "/>");
             appendElse();
         }
         
@@ -243,45 +249,72 @@
             startIf(jsVar + " != null");
             startFor("var ax = 0", "ax < " +  jsVar + ".length", "ax ++");
             jsVar = jsVar + "[ax]";
-            // we need an extra level of 'nil' testing here. Or do we, depending on the type
structure?
+            // we need an extra level of 'nil' testing here. Or do we, depending
+            // on the type structure?
             // Recode and fiddle appropriately.
             startIf(jsVar + " == null");
             if (nillable) {
                 appendString("<" + elementInfo.getXmlName() 
-                             + " " + XmlSchemaUtils.NIL_ATTRIBUTES + "/>");
+                             + " " + XmlSchemaUtils.XSI_NIL + "/>");
             } else {
                 appendString("<" + elementInfo.getXmlName() + "/>");              
     
             }
             appendElse();
         }
         
-        // now for the thing itself.
-        // type will be null for anyType. Apparently, XmlSchema doesn't represent it.
-        if (type instanceof XmlSchemaComplexType) {
+        if (elementInfo.isAnyType()) {
+            // name a variable for convenience.
+            appendLine("var anyHolder = " + jsVar + ";");
+            appendLine("var anySerializer;");
+            appendLine("var typeAttr = '';");
+            // we look in the global array for a serializer.
+            startIf("anyHolder != null");
+            startIf("!anyHolder.raw"); // no serializer for raw.
+            // In anyType, the QName is for the type, not an element.
+            appendLine("anySerializer = "
+                       + "cxfjsutils.interfaceObject.globalElementSerializers[anyHolder.qname];");
+            endBlock();
+            startIf("anyHolder.xsiType");
+            appendLine("var typePrefix = 'cxfjst" + anyTypePrefixCounter + "';");
+            anyTypePrefixCounter++;
+            appendLine("var typeAttr = 'xmlns:' + typePrefix + '=\\\''"
+                       + " + anyHolder.namespaceURI + '\\\'';");
+            appendLine("typeAttr = typeAttr + ' xsi:type=\\\'' + typePrefix + ':' "
+                       + "+ anyHolder.localName + '\\\'';");
+            endBlock();
+            startIf("anySerializer");
+            appendExpression(jsVar 
+                             + ".serialize(cxfjsutils, '" 
+                             + elementInfo.getXmlName() + "', typeAttr)");
+            appendElse(); // simple type or raw
+            appendExpression("'<" + elementInfo.getXmlName() + " ' + typeAttr + " + "'>'");
+            startIf("!anyHolder.raw");
+            appendExpression("cxfjsutils.escapeXmlEntities(" + jsVar + ")");
+            appendElse();
+            appendExpression("anyHolder.xml");
+            endBlock();
+            appendString("</" + elementInfo.getXmlName() + ">");
+            endBlock();
+            appendElse(); // nil (from null holder)
+            appendString("<" + elementInfo.getXmlName() 
+                         + " " + XmlSchemaUtils.XSI_NIL + "/>");
+            endBlock();
+        } else if (type instanceof XmlSchemaComplexType) {
             // it has a value
-            // pass the extra null in the slot for the 'extra namespaces' needed by 'any'.
+            // pass the extra null in the slot for the 'extra namespaces' needed
+            // by 'any'.
             appendExpression(jsVar 
                              + ".serialize(cxfjsutils, '" 
                              + elementInfo.getXmlName() + "', null)");
         } else { // simple type
             appendString("<" + elementInfo.getXmlName() + ">");
-            // warning: this assumes that ordinary Javascript serialization is all we need.
-            // except for &gt; ad all of that.
-            if (type != null && isStringSimpleType(type.getQName())) {
-                appendExpression("cxfjsutils.escapeXmlEntities(" + jsVar + ")");
-            } else {
-                // in other words, an AnyType is a string ... of XML! 
-                // Or, to be exact, of anything permitted in XML!
-                // (That is, in the anyType case, type will be null, and we won't escape,
-                // and anything goes. If someone sticks a string with xml-y stuff into
-                // an 'int' the results here won't be pretty.)
-                appendExpression(jsVar);
-            }
+            appendExpression("cxfjsutils.escapeXmlEntities(" + jsVar + ")");
             appendString("</" + elementInfo.getXmlName() + ">");
         }
         
         if (array) {
-            endBlock(); // for the extra level of nil checking, which might be wrong.
+            endBlock(); // for the extra level of nil checking, which might be
+                        // wrong.
             endBlock(); // for the for loop.
             endBlock(); // the null protection.
         }
@@ -293,31 +326,31 @@
         if (optional) {
             endBlock();
         }
+        endBlock(); // local variables
     }
-    
+
     /**
-     * Generate code to serialize an xs:any.
-     * There is too much duplicate code with 
-     * the element serializer; fix that some day.
+     * Generate code to serialize an xs:any. There is too much duplicate code
+     * with the element serializer; fix that some day.
+     * 
      * @param elementInfo
      * @param schemaCollection
      */
-    public void generateCodeToSerializeAny(ParticleInfo itemInfo, 
-                                           String prefix,
+    public void generateCodeToSerializeAny(ParticleInfo itemInfo, String prefix,
                                            SchemaCollection schemaCollection) {
         boolean optional = XmlSchemaUtils.isParticleOptional(itemInfo.getParticle());
         boolean array = XmlSchemaUtils.isParticleArray(itemInfo.getParticle());
-        
+
         appendLine("var anyHolder = this._" + itemInfo.getJavascriptName() + ";");
         appendLine("var anySerializer = null;");
         appendLine("var anyXmlTag = null;");
         appendLine("var anyXmlNsDef = null;");
         appendLine("var anyData = null;");
         appendLine("var anyStartTag;");
-        
+
         startIf("anyHolder != null && !anyHolder.raw");
         appendLine("anySerializer = "
-                             + "cxfjsutils.interfaceObject.globalElementSerializers[anyHolder.qname];");
+                   + "cxfjsutils.interfaceObject.globalElementSerializers[anyHolder.qname];");
         appendLine("anyXmlTag = '" + prefix + ":' + anyHolder.localName;");
         appendLine("anyXmlNsDef = 'xmlns:" + prefix + "=\\'' + anyHolder.namespaceURI" +
" + '\\'';");
         appendLine("anyStartTag = '<' + anyXmlTag + ' ' + anyXmlNsDef + '>';");
@@ -331,38 +364,38 @@
         // first question: optional?
         if (optional) {
             startIf("anyHolder != null && anyData != null");
-        }  else {
+        } else {
             startIf("anyHolder == null || anyData == null");
             appendLine("throw 'null value for required any item';");
             endBlock();
         }
-        
+
         String varRef = "anyData";
-        
+
         if (array) {
             startFor("var ax = 0", "ax < anyData.length", "ax ++");
             varRef = "anyData[ax]";
-            // we need an extra level of 'nil' testing here. Or do we, depending on the type
structure?
+            // we need an extra level of 'nil' testing here. Or do we, depending
+            // on the type structure?
             // Recode and fiddle appropriately.
             startIf(varRef + " == null");
             appendExpression("anyEmptyTag");
             appendElse();
         }
-        
+
         startIf("anySerializer"); // if no constructor, a simple type.
-            // it has a value
-        appendExpression("anySerializer.call(" + varRef + ", cxfjsutils, anyXmlTag, anyXmlNsDef)");

+        // it has a value
+        appendExpression("anySerializer.call(" + varRef + ", cxfjsutils, anyXmlTag, anyXmlNsDef)");
         appendElse();
         appendExpression("anyStartTag");
         appendExpression("cxfjsutils.escapeXmlEntities(" + varRef + ")");
         appendExpression("anyEndTag");
         endBlock();
         if (array) {
-            endBlock(); // for the nil/empty tag. Gorsh, we should have runtime knowledge
of nillable
-            // on the elements.
-            endBlock(); // for the for loop.
+            endBlock(); 
+            endBlock(); 
         }
-        
+
         if (optional) {
             endBlock();
         }

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java?rev=606951&r1=606950&r2=606951&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
Wed Dec 26 13:13:58 2007
@@ -48,7 +48,8 @@
     
     public static final String XSI_NS_ATTR = WSDLConstants.NP_XMLNS + ":" 
                     + WSDLConstants.NP_SCHEMA_XSI + "='" + WSDLConstants.NS_SCHEMA_XSI +
"'";
-    public static final String NIL_ATTRIBUTES = XSI_NS_ATTR + " xsi:nil='true'";
+    public static final String XSI_NIL_WITH_PREFIX = XSI_NS_ATTR + " xsi:nil='true'";
+    public static final String XSI_NIL = "xsi:nil='true'";
 
     private static final Logger LOG = LogUtils.getL7dLogger(XmlSchemaUtils.class);
     private static final XmlSchemaSequence EMPTY_SEQUENCE = new XmlSchemaSequence();

Modified: incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js?rev=606951&r1=606950&r2=606951&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
Wed Dec 26 13:13:58 2007
@@ -175,10 +175,12 @@
 CxfApacheOrgUtil.prototype.traceElementName = org_apache_cxf_element_name_for_trace; 
 
 function org_apache_cxf_escapeXmlEntities(val) {
-    if(val == null)
+    if(val == null || val == undefined)
         return "";
-    else
+    else {
+    	val = String(val);
         return val.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g,
"&gt;");
+    }
 }
 
 CxfApacheOrgUtil.prototype.escapeXmlEntities = org_apache_cxf_escapeXmlEntities; 
@@ -255,15 +257,14 @@
 
 CxfApacheOrgUtil.prototype.getNodeText = org_apache_cxf_getNodeText;
 
-// The following could be parameterized using the SoapVersion class, but does anyone believe
that
-// there will ever be another soap version?
-
+// This always uses soap-env, soap, and xsi as prefixes.
 function org_apache_cxf_begin_soap11_message(namespaceAttributes)
 {
 	var value = 
 	    '<?xml version="1.0" encoding="UTF-8"?>' 
 	    + '<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"'
 		+ ' xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"'
+		+ ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
 	    + '><soap-env:Body '
 	    + namespaceAttributes 
 	    + '>';
@@ -414,9 +415,24 @@
 	this.raw = false;
 }
 
+// the following will simply dump the supplied XML into the message.
 function org_apache_cxf_raw_any_holder(xml)
 {
+	this.typeMarker = "org_apache_cxf_raw_any_holder";
+	this.xml = xml;
+	this.raw = true;
+	this.xsiType = false;
+}
+
+// The following will get an xsi:type attribute in addition to dumping the XML into
+// the message.
+function org_apache_cxf_raw_typed_any_holder(namespaceURI, localName, xml)
+{
+	this.typeMarker = "org_apache_cxf_raw_any_holder";
+	this.namespaceURI = namespaceURI;
+	this.localName = localName;
 	this.xml = xml;
 	this.raw = true;
+	this.xsiType = true;
 }
 	

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java?rev=606951&r1=606950&r2=606951&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
Wed Dec 26 13:13:58 2007
@@ -82,4 +82,23 @@
             }
         });
     }
+    
+    private Void acceptAnyTyped(Context context) {
+        LOG.info("About to call acceptAny with Raw XML and xsi:type" + getAddress());
+        testUtilities.rhinoCall("testAnyNToServerRawTyped",  
+                                testUtilities.javaToJS(getAddress()));
+        Collection<Object> something = implementor.getAcceptedObjects();
+        assertNotNull(something);
+        return null;
+    }
+    
+    @org.junit.Ignore
+    @Test
+    public void callAcceptAnyTyped() {
+        testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
+            public Void run(Context context) {
+                return acceptAnyTyped(context);
+            }
+        });
+    }
 }

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java?rev=606951&r1=606950&r2=606951&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
Wed Dec 26 13:13:58 2007
@@ -23,6 +23,7 @@
 
 public interface AegisService {
     void acceptAny(String before, Collection<org.jdom.Element> anything);
+    void acceptObjects(Collection<Object> anything);
     void acceptStrings(Collection<String> someStrings);
 }
 

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java?rev=606951&r1=606950&r2=606951&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
Wed Dec 26 13:13:58 2007
@@ -28,7 +28,12 @@
     private String acceptedString;
     private Collection<org.jdom.Element> acceptedCollection;
     private Collection<String> acceptedStrings;
+    private Collection<Object> acceptedObjects;
     
+    public Collection<Object> getAcceptedObjects() {
+        return acceptedObjects;
+    }
+
     public void reset() {
         acceptedString = null;
         acceptedCollection = null;
@@ -62,5 +67,9 @@
      */
     public Collection<String> getAcceptedStrings() {
         return acceptedStrings;
+    }
+
+    public void acceptObjects(Collection<Object> anything) {
+        acceptedObjects = anything;
     }
 }

Added: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java?rev=606951&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
(added)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
Wed Dec 26 13:13:58 2007
@@ -0,0 +1,36 @@
+/**
+ * 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.javascript.fortest.aegis;
+
+/**
+ * 
+ */
+public class Mammal {
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml?rev=606951&r1=606950&r2=606951&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml (original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml Wed Dec 26 13:13:58
2007
@@ -1,49 +1,66 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Licensed to the v 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.
+	Licensed to the v 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.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xmlns:simple="http://cxf.apache.org/simple"
-  xmlns:soap="http://cxf.apache.org/bindings/soap"
-  xsi:schemaLocation="
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:simple="http://cxf.apache.org/simple"
+	xmlns:soap="http://cxf.apache.org/bindings/soap"
+	xsi:schemaLocation="
            http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
            http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
            http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd">
-              
-  <import resource="classpath:META-INF/cxf/cxf.xml" />
-  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
-  <import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" />
-  <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
-  <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
-  
-  <simple:server id="aegis-service" 
-                 serviceClass="org.apache.cxf.javascript.fortest.AegisService" 
-                 address="http://localhost:8808/aegis">
-  	<simple:serviceBean>
-  		<bean class="org.apache.cxf.javascript.fortest.AegisServiceImpl" />
-  	</simple:serviceBean>
-  	<simple:dataBinding >
-      <bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
-  	</simple:dataBinding>
-  </simple:server>
-  
-  </beans>
-  
-  
\ No newline at end of file
+
+	<import resource="classpath:META-INF/cxf/cxf.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+	<import
+		resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+
+	<simple:server id="aegis-service"
+		serviceClass="org.apache.cxf.javascript.fortest.AegisService"
+		address="http://localhost:8808/aegis">
+		<simple:serviceBean>
+			<bean
+				class="org.apache.cxf.javascript.fortest.AegisServiceImpl" />
+		</simple:serviceBean>
+		<simple:dataBinding>
+			<bean
+				class="org.apache.cxf.aegis.databinding.AegisDatabinding">
+			</bean>
+		</simple:dataBinding>
+		<simple:serviceFactory>
+			<bean
+				class='org.apache.cxf.service.factory.ReflectionServiceFactoryBean'>
+				<property name="properties">
+					<map>
+						<entry key="overrideTypesList">
+							<list>
+								<value>org.apache.cxf.javascript.fortest.aegis.Mammal</value>
+							</list>
+						</entry>
+					</map>
+				</property>
+			</bean>
+		</simple:serviceFactory>
+	</simple:server>
+
+</beans>
+

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js?rev=606951&r1=606950&r2=606951&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
Wed Dec 26 13:13:58 2007
@@ -50,8 +50,31 @@
 	service.url = url;
 	
 	var arrayItem = new fortest_javascript_cxf_apache_org__ArrayOfAnyType();
-	arrayItem.setAnyType(["<walrus xmlns='uri:iam'>tusks</walrus>",
-	                      "<penguin xmlns='uri:linux'>emperor</penguin>",
-	                      "<moon xmlns='uri:planets'>blue</moon>"]); 
+	var holderArray = [];
+	holderArray.push(new org_apache_cxf_raw_any_holder("<walrus xmlns='uri:iam'>tusks</walrus>"));
+	holderArray.push(new org_apache_cxf_raw_any_holder("<penguin xmlns='uri:linux'>emperor</penguin>"));
+	holderArray.push(new org_apache_cxf_raw_any_holder("<moon xmlns='uri:planets'>blue</moon>"));
+	arrayItem.setAnyType(holderArray);
 	service.acceptAny(success, error, "before items", arrayItem);
 }
+
+function testAnyNToServerRawTyped(url)
+{
+	var service = new fortest_javascript_cxf_apache_org__AegisServicePortType();
+	service.url = url;
+	
+	var arrayItem = new fortest_javascript_cxf_apache_org__ArrayOfAnyType();
+	var holderArray = [];
+	var holder = new org_apache_cxf_raw_typed_any_holder("http://aegis.fortest.javascript.cxf.apache.org",
+														 "Mammal",
+														 "<name xmlns='http://aegis.fortest.javascript.cxf.apache.org'>cat</name>");
+	holderArray.push(holder);
+	holder = new org_apache_cxf_raw_any_holder("http://www.w3.org/2001/XMLSchema", 
+													 "string",
+													 "This is the cereal < shot from guns");
+	
+	holderArray.push(holder);
+	arrayItem.setAnyType(holderArray);
+	service.acceptObjects(success, error, arrayItem);
+}
+

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml?rev=606951&r1=606950&r2=606951&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
Wed Dec 26 13:13:58 2007
@@ -23,6 +23,12 @@
       <parameter index="0" mappedName="before"/>
       <parameter index="1" mappedName="anything"/>
     </method>
+    <method name="acceptObjects">
+      <parameter index="0" mappedName="anything"/>
+    </method>
+    <method name="acceptStrings">
+      <parameter index="0" mappedName="anything"/>
+    </method>
   </mapping>
 </mappings>
 



Mime
View raw message