cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r598644 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ api/src/main/java/org/apache/cxf/transport/ rt/core/src/main/java/org/apache/cxf/feature/ rt/core/src/main/java/org/apache/cxf/transport/ rt/core/src/test/ja...
Date Tue, 27 Nov 2007 13:58:03 GMT
Author: bimargulies
Date: Tue Nov 27 05:57:43 2007
New Revision: 598644

URL: http://svn.apache.org/viewvc?rev=598644&view=rev
Log:
Extend JavaScript handling to more cases, including empty return types and cases with
anonymous complex types.

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/DestinationWithEndpoint.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptOptionsFeature.java
    incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldGreeterBeans.xml
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/BasicNameManager.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java Tue Nov 27 05:57:43 2007
@@ -124,6 +124,14 @@
     public void addSchema(SchemaInfo schemaInfo) {
         schemas.add(schemaInfo);
     }
+    
+    public SchemaInfo addNewSchema(String namespaceURI) {
+        SchemaInfo schemaInfo = new SchemaInfo(this, namespaceURI);
+        schemaInfo.setSchema(getXmlSchemaCollection().
+                                newXmlSchemaInCollection(namespaceURI));
+        schemas.add(schemaInfo);
+        return schemaInfo;
+    }
 
     public SchemaInfo getSchema(String namespaceURI) {
         for (SchemaInfo s : schemas) {

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/DestinationWithEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/DestinationWithEndpoint.java?rev=598644&view=auto
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/DestinationWithEndpoint.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/DestinationWithEndpoint.java Tue Nov 27 05:57:43 2007
@@ -0,0 +1,33 @@
+/**
+ * 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.transport;
+
+import org.apache.cxf.service.model.EndpointInfo;
+
+/**
+ * A destination that has a specific endpoint.
+ */
+public interface DestinationWithEndpoint {
+    /**
+     * Return the ServiceModel endpoint description for this destination.
+     * @return the endpoint description.
+     */
+    EndpointInfo getEndpointInfo();
+}

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java Tue Nov 27 05:57:43 2007
@@ -23,6 +23,21 @@
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 
+/**
+ * This class is used to control message-on-the-wire logging. 
+ * By attaching this feature to an endpoint, you
+ * can specify logging. If this feature is present, an endpoint will log input
+ * and output of ordinary and log messages.
+ * <pre>
+ * <![CDATA[
+    <jaxws:endpoint ...>
+      <jaxws:features>
+       <bean class="org.apache.cxf.feature.LoggingFeature"/>
+      </jaxws:features>
+    </jaxws:endpoint>
+  ]]>
+  </pre>
+ */
 public class LoggingFeature extends AbstractFeature {
     private static final int DEFAULT_LIMIT = 100 * 1024;
     private static final LoggingInInterceptor IN = new LoggingInInterceptor(DEFAULT_LIMIT);
@@ -47,10 +62,18 @@
         }
     }
 
+    /**
+     * This function has no effect at this time.
+     * @param lim
+     */
     public void setLimit(int lim) {
         limit = lim;
     }
     
+    /**
+     * Retrieve the value set with {@link #setLimit(int)}.
+     * @return
+     */
     public int getLimit() {
         return limit;
     }    

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java Tue Nov 27 05:57:43 2007
@@ -36,7 +36,7 @@
  * regard for the decoupled back-channel or partial response logic.
  */
 public abstract class AbstractDestination
-    extends AbstractObservable implements Destination {
+    extends AbstractObservable implements Destination, DestinationWithEndpoint {
 
     protected final EndpointReferenceType reference;
     protected final EndpointInfo endpointInfo;
@@ -169,5 +169,12 @@
         protected Logger getLogger() {
             return AbstractDestination.this.getLogger();
         }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public EndpointInfo getEndpointInfo() {
+        return endpointInfo;
     }
 }

Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java Tue Nov 27 05:57:43 2007
@@ -124,7 +124,7 @@
     
     @Test    
     public void testDefinition() throws Exception {
-        assertEquals("http://apache.org/hello_world_soap_http", newDef.getTargetNamespace());
+        assertEquals(newDef.getTargetNamespace(), "http://apache.org/hello_world_soap_http");
         Service serv = newDef.getService(new QName("http://apache.org/hello_world_soap_http",
                                                    "SOAPService"));
         assertNotNull(serv);
@@ -133,7 +133,7 @@
     
     @Test
     public void testPortType() throws Exception {
-        assertEquals(newDef.getPortTypes().size(), 1);
+        assertEquals(1, newDef.getPortTypes().size());
         PortType portType = (PortType)newDef.getPortTypes().values().iterator().next();
         assertNotNull(portType);
         assertTrue(portType.getQName().equals(new QName(newDef.getTargetNamespace(), "Greeter")));
@@ -148,29 +148,29 @@
             CastUtils.cast(
                 portType.getOperations(), Operation.class);
         
-        assertEquals(operations.size(), 4);
+        assertEquals(4, operations.size());
         Operation sayHi = portType.getOperation("sayHi", "sayHiRequest", "sayHiResponse");
         assertNotNull(sayHi);
-        assertEquals("sayHi", sayHi.getName());
+        assertEquals(sayHi.getName(), "sayHi");
         Input input = sayHi.getInput();
         assertNotNull(input);
-        assertEquals(input.getName(), "sayHiRequest");
+        assertEquals("sayHiRequest", input.getName());
         Message message = input.getMessage();
         assertNotNull(message);
-        assertEquals(message.getQName().getLocalPart(), "sayHiRequest");
-        assertEquals(message.getQName().getNamespaceURI(), newDef.getTargetNamespace());
-        assertEquals(message.getParts().size(), 1);
-        assertEquals(message.getPart("in").getName(), "in");
+        assertEquals("sayHiRequest", message.getQName().getLocalPart());
+        assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
+        assertEquals(1, message.getParts().size());
+        assertEquals("in", message.getPart("in").getName());
         Output output = sayHi.getOutput();
         assertNotNull(output);
-        assertEquals(output.getName(), "sayHiResponse");
+        assertEquals("sayHiResponse", output.getName());
         message = output.getMessage();
         assertNotNull(message);
-        assertEquals(message.getQName().getLocalPart(), "sayHiResponse");
-        assertEquals(message.getQName().getNamespaceURI(), newDef.getTargetNamespace());
-        assertEquals(message.getParts().size(), 1);
-        assertEquals(message.getPart("out").getName(), "out");
-        assertTrue(sayHi.getFaults().size() == 0);
+        assertEquals("sayHiResponse", message.getQName().getLocalPart());
+        assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
+        assertEquals(1, message.getParts().size());
+        assertEquals("out", message.getPart("out").getName());
+        assertEquals(0, sayHi.getFaults().size());
               
     }
     
@@ -183,23 +183,23 @@
         assertEquals("greetMe", greetMe.getName());
         Input input = greetMe.getInput();
         assertNotNull(input);
-        assertEquals(input.getName(), "greetMeRequest");
+        assertEquals("greetMeRequest", input.getName());
         Message message = input.getMessage();
         assertNotNull(message);
-        assertEquals(message.getQName().getLocalPart(), "greetMeRequest");
-        assertEquals(message.getQName().getNamespaceURI(), newDef.getTargetNamespace());
-        assertEquals(message.getParts().size(), 1);
-        assertEquals(message.getPart("in").getName(), "in");
+        assertEquals("greetMeRequest", message.getQName().getLocalPart());
+        assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
+        assertEquals(1, message.getParts().size());
+        assertEquals("in", message.getPart("in").getName());
         Output output = greetMe.getOutput();
         assertNotNull(output);
-        assertEquals(output.getName(), "greetMeResponse");
+        assertEquals("greetMeResponse", output.getName());
         message = output.getMessage();
         assertNotNull(message);
-        assertEquals(message.getQName().getLocalPart(), "greetMeResponse");
-        assertEquals(message.getQName().getNamespaceURI(), newDef.getTargetNamespace());
-        assertEquals(message.getParts().size(), 1);
-        assertEquals(message.getPart("out").getName(), "out");
-        assertTrue(greetMe.getFaults().size() == 0);
+        assertEquals("greetMeResponse", message.getQName().getLocalPart());
+        assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
+        assertEquals(1, message.getParts().size());
+        assertEquals("out", message.getPart("out").getName());
+        assertEquals(0, greetMe.getFaults().size());
         
     }
     
@@ -212,16 +212,16 @@
         assertEquals("greetMeOneWay", greetMeOneWay.getName());
         Input input = greetMeOneWay.getInput();
         assertNotNull(input);
-        assertEquals(input.getName(), "greetMeOneWayRequest");
+        assertEquals("greetMeOneWayRequest", input.getName());
         Message message = input.getMessage();
         assertNotNull(message);
-        assertEquals(message.getQName().getLocalPart(), "greetMeOneWayRequest");
-        assertEquals(message.getQName().getNamespaceURI(), newDef.getTargetNamespace());
-        assertEquals(message.getParts().size(), 1);
-        assertEquals(message.getPart("in").getName(), "in");
+        assertEquals("greetMeOneWayRequest", message.getQName().getLocalPart());
+        assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
+        assertEquals(1, message.getParts().size());
+        assertEquals("in", message.getPart("in").getName());
         Output output = greetMeOneWay.getOutput();
         assertNull(output);
-        assertTrue(greetMeOneWay.getFaults().size() == 0);
+        assertEquals(0, greetMeOneWay.getFaults().size());
     }
     
     @Test
@@ -233,32 +233,32 @@
         assertEquals("pingMe", pingMe.getName());
         Input input = pingMe.getInput();
         assertNotNull(input);
-        assertEquals(input.getName(), "pingMeRequest");
+        assertEquals("pingMeRequest", input.getName());
         Message message = input.getMessage();
         assertNotNull(message);
-        assertEquals(message.getQName().getLocalPart(), "pingMeRequest");
-        assertEquals(message.getQName().getNamespaceURI(), newDef.getTargetNamespace());
-        assertEquals(message.getParts().size(), 1);
-        assertEquals(message.getPart("in").getName(), "in");
+        assertEquals("pingMeRequest", message.getQName().getLocalPart());
+        assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
+        assertEquals(1, message.getParts().size());
+        assertEquals("in", message.getPart("in").getName());
         Output output = pingMe.getOutput();
         assertNotNull(output);
-        assertEquals(output.getName(), "pingMeResponse");
+        assertEquals("pingMeResponse", output.getName());
         message = output.getMessage();
         assertNotNull(message);
-        assertEquals(message.getQName().getLocalPart(), "pingMeResponse");
-        assertEquals(message.getQName().getNamespaceURI(), newDef.getTargetNamespace());
+        assertEquals("pingMeResponse", message.getQName().getLocalPart());
+        assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
         assertEquals(message.getParts().size(), 1);
-        assertEquals(message.getPart("out").getName(), "out");
-        assertTrue(pingMe.getFaults().size() == 1);
+        assertEquals("out", message.getPart("out").getName());
+        assertEquals(1, pingMe.getFaults().size());
         Fault fault = pingMe.getFault("pingMeFault");
         assertNotNull(fault);
-        assertEquals(fault.getName(), "pingMeFault");
+        assertEquals("pingMeFault", fault.getName());
         message = fault.getMessage();
         assertNotNull(message);
-        assertEquals(message.getQName().getLocalPart(), "pingMeFault");
-        assertEquals(message.getQName().getNamespaceURI(), newDef.getTargetNamespace());
-        assertEquals(message.getParts().size(), 1);
-        assertEquals(message.getPart("faultDetail").getName(), "faultDetail");
+        assertEquals("pingMeFault", message.getQName().getLocalPart());
+        assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
+        assertEquals(1, message.getParts().size());
+        assertEquals("faultDetail", message.getPart("faultDetail").getName());
         assertNull(message.getPart("faultDetail").getTypeName());
     }
     
@@ -267,7 +267,7 @@
         assertEquals(newDef.getBindings().size(), 1);
         Binding binding = newDef.getBinding(new QName(newDef.getTargetNamespace(), "Greeter_SOAPBinding"));
         assertNotNull(binding);
-        assertEquals(binding.getBindingOperations().size(), 4);
+        assertEquals(4, binding.getBindingOperations().size());
     }
     
     @Test
@@ -276,11 +276,12 @@
         assertNotNull(types);
         Collection<ExtensibilityElement> schemas = 
             CastUtils.cast(types.getExtensibilityElements(), ExtensibilityElement.class);
-        assertEquals(schemas.size(), 1);
+        assertEquals(1, schemas.size());
         XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
         Element schemaElem = ((Schema)schemas.iterator().next()).getElement();
-        assertEquals(schemaCollection.read(schemaElem).getTargetNamespace(), 
-                     "http://apache.org/hello_world_soap_http/types");
+        assertEquals("http://apache.org/hello_world_soap_http/types",
+                     schemaCollection.read(schemaElem).getTargetNamespace() 
+                     );
     }
     
 }

Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java Tue Nov 27 05:57:43 2007
@@ -166,7 +166,7 @@
         assertTrue(serviceInfo.getProperty(WSDLServiceBuilder.WSDL_DEFINITION) == def);
         assertTrue(serviceInfo.getProperty(WSDLServiceBuilder.WSDL_SERVICE) == service);
 
-        assertEquals("Incorrect number of endpoints", serviceInfo.getEndpoints().size(), 1);
+        assertEquals("Incorrect number of endpoints", 1, serviceInfo.getEndpoints().size());
         EndpointInfo ei = serviceInfo.getEndpoint(new QName("http://apache.org/hello_world_soap_http",
                 "SoapPort"));
         assertNotNull(ei);
@@ -184,7 +184,7 @@
     @Test
     public void testOperationInfo() throws Exception {
         QName name = new QName(serviceInfo.getName().getNamespaceURI(), "sayHi");
-        assertEquals(serviceInfo.getInterface().getOperations().size(), 4);
+        assertEquals(4, serviceInfo.getInterface().getOperations().size());
         OperationInfo sayHi = serviceInfo.getInterface().getOperation(
                 new QName(serviceInfo.getName().getNamespaceURI(), "sayHi"));
         assertNotNull(sayHi);
@@ -365,7 +365,7 @@
     public void testSchema() {
         SchemaCollection schemas = serviceInfo.getXmlSchemaCollection();
         assertNotNull(schemas);
-        assertEquals(serviceInfo.getSchemas().size(), 1);
+        assertEquals(1, serviceInfo.getSchemas().size());
         SchemaInfo schemaInfo = serviceInfo.getSchemas().iterator().next();
         assertNotNull(schemaInfo);
         assertEquals(schemaInfo.getNamespaceURI(), "http://apache.org/hello_world_soap_http/types");

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Tue Nov 27 05:57:43 2007
@@ -864,7 +864,6 @@
         }
         el.setSchemaType(ct);
 
-
         XmlSchemaSequence seq = new XmlSchemaSequence();
         ct.setParticle(seq);
 

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/BasicNameManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/BasicNameManager.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/BasicNameManager.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/BasicNameManager.java Tue Nov 27 05:57:43 2007
@@ -26,20 +26,33 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.utils.NamespacePrefixList;
 
 /**
- * 
+ * Generate JavaScript names for QNames. 
+ * This might belong on the CXF bus. 
  */
 public class BasicNameManager implements NameManager {
     
     private Map<String, String> nsPrefixMap;
     
     public BasicNameManager(ServiceInfo service) {
+        this(service, null);
+    }
+    
+    public BasicNameManager(ServiceInfo service, Endpoint endpoint) {
         nsPrefixMap = new HashMap<String, String>();
+        JavascriptOptionsFeature options = getOptions(endpoint);
+        
+        if (options.getNamespacePrefixMap() != null) {
+            nsPrefixMap.putAll(options.getNamespacePrefixMap());
+        }
+        
         Set<String> poorPrefixURIs = new HashSet<String>();
         for (SchemaInfo schemaInfo : service.getSchemas()) {
             NamespacePrefixList schemaPrefixList = schemaInfo.getSchema().getNamespaceContext();
@@ -59,6 +72,17 @@
         for (String uri : poorPrefixURIs) {
             defineFallbackPrefix(uri);
         }
+    }
+    
+    private JavascriptOptionsFeature getOptions(Endpoint endpoint) {
+        if (endpoint != null) {
+            for (AbstractFeature feature : endpoint.getActiveFeatures()) {
+                if (feature instanceof JavascriptOptionsFeature) {
+                    return (JavascriptOptionsFeature) feature;
+                }
+            }
+        }
+        return new JavascriptOptionsFeature(); // save work and return a default set of options.
     }
 
     private String defineFallbackPrefix(String uri) {

Added: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptOptionsFeature.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptOptionsFeature.java?rev=598644&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptOptionsFeature.java (added)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptOptionsFeature.java Tue Nov 27 05:57:43 2007
@@ -0,0 +1,66 @@
+/**
+ * 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;
+
+import java.util.Map;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.AbstractFeature;
+
+/**
+ * This class provides configuration options to the JavaScript client generator.
+ * Attach this feature to control namespace mapping and other options. 
+ * <pre>
+ * <![CDATA[
+    <jaxws:endpoint ...>
+      <jaxws:features>
+       <bean class="org.apache.cxf.javascript.JavascriptOptionsFeature">
+       </bean>
+      </jaxws:features>
+    </jaxws:endpoint>
+  ]]>
+  </pre>
+  * At this time, there is no corresponding WSDL extension for this information.
+ */
+public class JavascriptOptionsFeature extends AbstractFeature {
+    private Map<String, String> namespacePrefixMap;
+
+    /**
+     * Retrieve the map from namespace URI strings to JavaScript function prefixes.
+     * @return the map
+     */
+    public Map<String, String> getNamespacePrefixMap() {
+        return namespacePrefixMap;
+    }
+
+    /**
+     * Set the map from namespace URI strings to Javascript function prefixes.
+     * @param namespacePrefixMap the map from namespace URI strings to JavaScript function prefixes.
+     */
+    public void setNamespacePrefixMap(Map<String, String> namespacePrefixMap) {
+        this.namespacePrefixMap = namespacePrefixMap;
+    }
+
+    @Override
+    public void initialize(Server server, Bus bus) {
+      //  server.getEndpoint().getActiveFeatures().add(this);
+    }
+}

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java Tue Nov 27 05:57:43 2007
@@ -32,11 +32,15 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.i18n.UncheckedException;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerRegistry;
 import org.apache.cxf.javascript.service.ServiceJavascriptBuilder;
 import org.apache.cxf.javascript.types.SchemaJavascriptBuilder;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.transport.DestinationWithEndpoint;
 import org.apache.cxf.transport.http.UrlUtilities;
 import org.apache.cxf.transports.http.StemMatchingQueryHandler;
 
@@ -95,6 +99,21 @@
             throw new RuntimeException("Failed to write javascript utils to HTTP response.", e);
         }
     }
+    
+    private Endpoint findEndpoint(EndpointInfo endpointInfo) {
+        ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
+        for (Server server : serverRegistry.getServers()) {
+            // Hypothetically, not all destinations have an endpoint.
+            // There has to be a better way to do this.
+            if (server.getDestination() instanceof DestinationWithEndpoint
+                &&
+                endpointInfo.
+                    equals(((DestinationWithEndpoint)server.getDestination()).getEndpointInfo())) {
+                return server.getEndpoint();
+            }
+        }
+        return null;
+    }
 
     public void writeResponse(String fullQueryString, String ctx, EndpointInfo endpoint, OutputStream os) {
         URI uri = URI.create(fullQueryString);
@@ -106,7 +125,8 @@
         } else if (map.containsKey(CODE_QUERY_KEY)) {
             ServiceInfo serviceInfo = endpoint.getService();
             Collection<SchemaInfo> schemata = serviceInfo.getSchemas();
-            BasicNameManager nameManager = new BasicNameManager(serviceInfo);
+            Endpoint serverEndpoint = findEndpoint(endpoint);
+            BasicNameManager nameManager = new BasicNameManager(serviceInfo, serverEndpoint);
             NamespacePrefixAccumulator prefixManager = new NamespacePrefixAccumulator(serviceInfo
                 .getXmlSchemaCollection());
             try {

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=598644&r1=598643&r2=598644&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 Tue Nov 27 05:57:43 2007
@@ -138,9 +138,16 @@
             return type;
         }
         assert element != null;
+        // The referencing URI only helps if there is a schema that points to it.
+        // It might be the URI for the wsdl TNS, which might have no schema.
+        if (xmlSchemaCollection.getSchemaByTargetNamespace(referencingURI) == null) {
+            referencingURI = null;
+        }
+        
         if (referencingURI == null && containingType != null) {
             referencingURI = containingType.getQName().getNamespaceURI();
         }
+        
         XmlSchemaElement originalElement = element;
         while (element.getSchemaType() == null && element.getRefName() != null) {
             XmlSchemaElement nextElement = findElementByRefName(xmlSchemaCollection,

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties Tue Nov 27 05:57:43 2007
@@ -23,4 +23,7 @@
 RPC= Service {0} calls for unsupported RPC binding style.
 XML_BINDING= Service {0} calls for unsupported XML binding.
 MISSING_PART_ELEMENT= Part {0} lacks an element in the XML Schema.
-MISSING_SERVICE_SCHEMA= Target namespace {0} specified for service {1} is not defined in the service model.
\ No newline at end of file
+MISSING_SERVICE_SCHEMA= Target namespace {0} specified for service {1} is not defined in the service model.
+MISSING_WRAPPER_TYPE= Part {2} in operation {1} of {0} has no schema type.
+IMPOSSIBLE_OUTPUT_TYPE= Output message {0} has type represented by {1}.
+ANONYMOUS_OUTPUT_TYPE= Output message {0} has anonymous type.
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java Tue Nov 27 05:57:43 2007
@@ -49,12 +49,14 @@
 import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.local.LocalTransportFactory;
 import org.apache.cxf.wsdl.WSDLConstants;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObject;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaSimpleType;
 import org.apache.ws.commons.schema.XmlSchemaType;
 
@@ -72,7 +74,7 @@
     private Set<MessageInfo> inputMessagesWithNameConflicts;
     private Set<MessageInfo> outputMessagesWithNameConflicts;
     private SchemaCollection xmlSchemaCollection;
-    private SchemaInfo serviceSchemaInfo;
+    private String serviceTargetNamespace;
     
     private boolean isWrapped;
     // facts about the wrapper when there is one.
@@ -144,23 +146,23 @@
         utils.appendLine("this._onerror = null;");
         code.append("}\n\n");
 
-        serviceSchemaInfo = serviceInfo.getSchema(serviceInfo.getTargetNamespace());
-        if (serviceSchemaInfo == null) {
-            unsupportedConstruct("MISSING_SERVICE_SCHEMA",
-                                 serviceInfo.getTargetNamespace(),
-                                 serviceInfo.getName().toString());
-        }
+        serviceTargetNamespace = serviceInfo.getTargetNamespace();
     }
 
     private static class ElementAndNames {
         private XmlSchemaElement element;
         private String javascriptName;
         private String xmlName;
+        private boolean empty;
 
-        public ElementAndNames(XmlSchemaElement element, String javascriptName, String xmlName) {
+        public ElementAndNames(XmlSchemaElement element, 
+                               String javascriptName, 
+                               String xmlName, 
+                               boolean empty) {
             this.element = element;
             this.javascriptName = javascriptName;
             this.xmlName = xmlName;
+            this.empty = empty;
         }
 
         public XmlSchemaElement getElement() {
@@ -174,6 +176,10 @@
         public String getJavascriptName() {
             return javascriptName;
         }
+        
+        public boolean isEmpty() {
+            return empty;
+        }
     }
     
     private String getFunctionGlobalName(QName itemName, String itemType) {
@@ -378,6 +384,8 @@
     private String outputDeserializerFunctionName(MessageInfo message) {
         return getFunctionGlobalName(message.getName(), "deserializeResponse");
     }
+    
+
 
     // This ignores 'wrapped', because it assumes one part that we can use one way or 
     // the other. For simple cases, this is certainly OK.
@@ -392,22 +400,25 @@
         getElementsForParts(outputMessage, elements);
         ElementAndNames element = elements.get(0);
         XmlSchemaType type = element.getElement().getSchemaType();
-        assert type != null;
-        if (type instanceof XmlSchemaComplexType) {
-            XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
-            String typeObjectName = nameManager.getJavascriptName(complexType);
-            utils
-                .appendLine("var returnObject = " 
-                            + typeObjectName 
-                            + "_deserialize (cxfjsutils, partElement);\n");
-        } else {
-            XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)type;
-            utils.appendLine("var returnText = cxfjsutils.getNodeText(partElement);");
-            utils.appendLine("var returnObject = " 
-                             + utils.javascriptParseExpression(simpleType, "returnText") + ";");
+        if (!element.isEmpty()) {
+            if (type instanceof XmlSchemaComplexType) {
+                // if there are no response items, the type is likely to have no name and no particle.
+                XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
+                // if it is anonymous but not empty, we're in trouble here, as we have no way to talk
+                // about it. The code in getElementsForParts should have dealt with this.
+                String typeObjectName = nameManager.getJavascriptName(complexType);
+                utils
+                    .appendLine("var returnObject = " 
+                                + typeObjectName 
+                                + "_deserialize (cxfjsutils, partElement);\n");
+            } else if (type instanceof XmlSchemaSimpleType) {
+                XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)type;
+                utils.appendLine("var returnText = cxfjsutils.getNodeText(partElement);");
+                utils.appendLine("var returnObject = " 
+                                 + utils.javascriptParseExpression(simpleType, "returnText") + ";");
+            } 
+            utils.appendLine("return returnObject;");
         }
-
-        utils.appendLine("return returnObject;");
         code.append("}\n");
     }
 
@@ -458,7 +469,7 @@
                                                  "wrapperObj",
                                                  wrapperXmlElementName,
                                                  xmlSchemaCollection, 
-                                                 serviceSchemaInfo.getNamespaceURI(),
+                                                 serviceTargetNamespace,
                                                  null);
         } else {
             int px = 0;
@@ -469,7 +480,7 @@
                                                      "args[" + px + "]",
                                                      ean.getXmlName(),
                                                      xmlSchemaCollection,
-                                                     serviceSchemaInfo.getNamespaceURI(),
+                                                     serviceTargetNamespace,
                                                      null);
                 px++;
             }
@@ -483,6 +494,44 @@
                     + " = "
                     + serializerFunctionGlobalName + ";\n\n");
     }
+    
+    private XmlSchemaSequence getTypeSequence(XmlSchemaComplexType type, 
+                                              XmlSchemaElement parentElement) {
+        if (!(type.getParticle() instanceof XmlSchemaSequence)) {
+            unsupportedConstruct("NON_SEQUENCE_PARTICLE", 
+                                 type.getQName() != null ? type.getQName() 
+                                     :
+                                     parentElement.getQName());
+        }
+        return (XmlSchemaSequence)type.getParticle();
+    }
+    
+    private boolean isEmptyType(XmlSchemaType type, XmlSchemaElement parentElement) {
+        if (type instanceof XmlSchemaComplexType) {
+            XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
+            if (complexType.getParticle() == null) {
+                return true;
+            } 
+            XmlSchemaSequence sequence = getTypeSequence(complexType, parentElement);
+            if (sequence.getItems().getCount() == 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    private XmlSchemaElement getBuriedElement(XmlSchemaComplexType type, 
+                                              XmlSchemaElement parentElement) {
+        XmlSchemaSequence sequence = getTypeSequence(type, parentElement);
+        XmlSchemaObjectCollection insides = sequence.getItems();
+        if (insides.getCount() == 1) {
+            XmlSchemaObject item = insides.getItem(0);
+            if (item instanceof XmlSchemaElement) {
+                return (XmlSchemaElement) item;
+            }
+        }
+        return null;
+    }
 
     /**
      * Collect information about the parts of an unwrapped message.
@@ -510,13 +559,35 @@
             }
             assert element != null;
             assert element.getQName() != null;
+            XmlSchemaType type = element.getSchemaType();
+            if (type == null) {
+                type = XmlSchemaUtils.getElementType(xmlSchemaCollection, 
+                                                     null, 
+                                                     element, 
+                                                     null);
+            }
+            
+            boolean empty = isEmptyType(type, element);
+            if (!empty && type instanceof XmlSchemaComplexType && type.getName() == null) {
+                XmlSchemaElement betterElement = getBuriedElement((XmlSchemaComplexType) type,
+                                                                  element);
+                if (betterElement != null) {
+                    element = betterElement;
+                    if (element.getSchemaType() == null) {
+                        element.setSchemaType(xmlSchemaCollection
+                                                  .getTypeByQName(element.getSchemaTypeName()));
+                    }
+                }
+                
+            }
+            
             String partJavascriptVar = JavascriptUtils.javaScriptNameToken(element.getQName().getLocalPart());
             String elementXmlRef = prefixAccumulator.xmlElementString(mpi.getConcreteName());
 
-            elements.add(new ElementAndNames(element, partJavascriptVar, elementXmlRef));
+            elements.add(new ElementAndNames(element, partJavascriptVar, elementXmlRef, empty));
         }
     }
-
+    
     // This function generated Javascript names for the parameters. 
     private void collectWrapperElementInfo() {
         
@@ -541,6 +612,7 @@
                                                         serviceInfo.getTargetNamespace());
             }
             inputWrapperComplexType = (XmlSchemaComplexType)inputWrapperElement.getSchemaType();
+            // the null name is probably something awful in RFSB.
             if (inputWrapperComplexType == null) {
                 inputWrapperComplexType = (XmlSchemaComplexType)
                     XmlSchemaUtils.getElementType(xmlSchemaCollection, 
@@ -548,7 +620,19 @@
                                                   inputWrapperElement, 
                                                   null);
             }
-            inputWrapperClassName = nameManager.getJavascriptName(inputWrapperComplexType);
+            if (inputWrapperComplexType == null) {
+                unsupportedConstruct("MISSING_WRAPPER_TYPE",
+                                     currentOperation.getInterface().getName(),
+                                     currentOperation.getName(), 
+                                     inputWrapperPartInfo.getName());
+            }
+            
+            if (inputWrapperComplexType.getQName() == null) {
+                // we should be ignoring this for zero-argument wrappers.
+                inputWrapperClassName = nameManager.getJavascriptName(inputWrapperPartInfo.getName());
+            } else {
+                inputWrapperClassName = nameManager.getJavascriptName(inputWrapperComplexType);
+            }
         }
 
         if (currentOperation.getOutput() != null) {

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java Tue Nov 27 05:57:43 2007
@@ -123,9 +123,11 @@
         String errorText = testUtilities.rhinoEvaluateConvert("globalErrorStatusText", String.class);
         assertNull(errorText);
 
-        // this method returns void, which translated into a Javascript object with no properties. 
-        Scriptable responseObject = (Scriptable)testUtilities.rhinoEvaluate("globalResponseObject");
+        // This method returns void, which translated into a Javascript object with no properties.
+        // really. Void.
+        Object responseObject = testUtilities.rhinoEvaluate("globalResponseObject");
         assertNotNull(responseObject);
+        assertEquals(Context.getUndefinedValue(), responseObject);
         SimpleDocLitWrappedImpl impl = getBean(SimpleDocLitWrappedImpl.class, "dlw-service");
         TestBean1 b1returned = impl.getLastBean1();
         assertEquals(b1, b1returned);

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java Tue Nov 27 05:57:43 2007
@@ -20,6 +20,7 @@
 package org.apache.cxf.javascript;
 
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
@@ -42,6 +43,7 @@
     private static final Logger LOG = LogUtils.getL7dLogger(QueryHandlerTest.class);
     private EndpointImpl hwEndpoint;
     private EndpointImpl dlbEndpoint;
+    private EndpointImpl hwgEndpoint;
 
     public QueryHandlerTest() throws Exception {
         super();
@@ -57,23 +59,25 @@
     @Override
     protected String[] getConfigLocations() {
         return new String[] {"classpath:HelloWorldDocLitBeans.xml",
-                             "classpath:DocLitBareClientTestBeans.xml"};
+                             "classpath:DocLitBareClientTestBeans.xml",
+                             "classpath:HelloWorldGreeterBeans.xml"};
 
     }
     
     @Before
     public void before() {
         hwEndpoint = getBean(EndpointImpl.class, "hw-service-endpoint");
+        hwgEndpoint = getBean(EndpointImpl.class, "hwg-service-endpoint");
         dlbEndpoint = getBean(EndpointImpl.class, "dlb-service-endpoint");
 
     }
     
-    // This service runs into yet another RFSB/JAXB bug.
-    @org.junit.Ignore
-    @Test
-    public void hwQueryTest() throws Exception {
-        URL endpointURL = new URL(hwEndpoint.getAddress()  + "?js");
-        InputStream jsStream = endpointURL.openStream();
+    private String getStringFromURL(URL url) throws IOException {
+        InputStream jsStream = url.openStream();
+        return readStringFromStream(jsStream);
+    }
+
+    private String readStringFromStream(InputStream jsStream) throws IOException {
         InputStreamReader isr = new InputStreamReader(jsStream, UTF8);
         BufferedReader in = new BufferedReader(isr);
         String line = in.readLine();
@@ -87,6 +91,13 @@
             }
             line = in.readLine();
         }
+        return js.toString();
+    }
+    
+    @Test
+    public void hwQueryTest() throws Exception {
+        URL endpointURL = new URL(hwEndpoint.getAddress()  + "?js");
+        String js = getStringFromURL(endpointURL); 
         assertNotSame(0, js.length());
     }
     
@@ -97,20 +108,8 @@
         URLConnection connection = endpointURL.openConnection();
         assertEquals("application/javascript;charset=UTF-8", connection.getContentType());
         InputStream jsStream = connection.getInputStream();
-        InputStreamReader isr = new InputStreamReader(jsStream, UTF8);
-        BufferedReader in = new BufferedReader(isr);
-        String line = in.readLine();
-        StringBuilder js = new StringBuilder();
-        while (line != null) {
-            String[] tok = line.split("\\s");
-
-            for (int x = 0; x < tok.length; x++) {
-                String token = tok[x];
-                js.append("  " + token);
-            }
-            line = in.readLine();
-        }
-        assertNotSame(0, js.length());
+        String js = readStringFromStream(jsStream);
+        assertNotSame("", js);
     }
     
     @Test
@@ -118,21 +117,16 @@
         URL endpointURL = new URL(dlbEndpoint.getAddress()  + "?jsutils");
         URLConnection connection = endpointURL.openConnection();
         assertEquals("application/javascript;charset=UTF-8", connection.getContentType());
-        InputStream jsStream = connection.getInputStream(); 
-        InputStreamReader isr = new InputStreamReader(jsStream, UTF8);
-        BufferedReader in = new BufferedReader(isr);
-        String line = in.readLine();
-        StringBuilder js = new StringBuilder();
-        while (line != null) {
-            String[] tok = line.split("\\s");
-
-            for (int x = 0; x < tok.length; x++) {
-                String token = tok[x];
-                js.append("  " + token);
-            }
-            line = in.readLine();
-        }
-        String jsString = js.toString();
+        InputStream jsStream = connection.getInputStream();
+        String jsString = readStringFromStream(jsStream);
         assertTrue(jsString.contains("CxfApacheOrgUtil"));
+    }
+    
+    // this is in here since we need to use the query handler to perform the test.
+    @Test 
+    public void namespacePrefixTest() throws Exception {
+        URL endpointURL = new URL(hwgEndpoint.getAddress()  + "?js");
+        String js = getStringFromURL(endpointURL);
+        assertTrue(js.contains("hg_Greeter"));
     }
 }

Added: incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldGreeterBeans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldGreeterBeans.xml?rev=598644&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldGreeterBeans.xml (added)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldGreeterBeans.xml Tue Nov 27 05:57:43 2007
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:jaxws="http://cxf.apache.org/jaxws"
+	xsi:schemaLocation="
+           http://cxf.apache.org/jaxws                                 
+              http://cxf.apache.org/schemas/jaxws.xsd
+           http://www.springframework.org/schema/beans
+              http://www.springframework.org/schema/beans/spring-beans-2.0.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-http.xml" />
+	<import
+		resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+	<import
+		resource="classpath:META-INF/cxf/cxf-extension-javascript-client.xml" />
+
+	<bean id='hwg-service' class='org.apache.hello_world.GreeterImpl' />
+
+	<jaxws:endpoint id="hwg-service-endpoint" implementor="#hwg-service"
+		address="http://localhost:8808/HelloWorldGreeter">
+		<jaxws:features>
+			<bean
+				class="org.apache.cxf.javascript.JavascriptOptionsFeature">
+				<property name="namespacePrefixMap">
+					<map>
+						<entry>
+							<key>
+								<value>http://apache.org/hello_world</value>
+							</key>
+							<value>hg</value>
+						</entry>
+						<entry>
+							<key>
+								<value>http://apache.org/hello_world/types</value>
+							</key>
+							<value>hgt</value>
+						</entry>
+					</map>
+				</property>
+			</bean>
+		</jaxws:features>
+	</jaxws:endpoint>
+
+</beans>
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=598644&r1=598643&r2=598644&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Tue Nov 27 05:57:43 2007
@@ -90,7 +90,7 @@
      * @param b the associated Bus
      * @param ci the associated conduit initiator
      * @param ei the endpoint info of the destination 
-     * @param dp ture for adding the default port if it is missing
+     * @param dp true for adding the default port if it is missing
      * @throws IOException
      */    
     public AbstractHTTPDestination(Bus b,



Mime
View raw message