You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by da...@apache.org on 2007/03/01 16:36:02 UTC

svn commit: r513387 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ rt/core/src/main/java/org/apache/cxf/endpoint/ rt/core/src/main/java/org/apache/cxf/i...

Author: dandiep
Date: Thu Mar  1 07:36:01 2007
New Revision: 513387

URL: http://svn.apache.org/viewvc?view=rev&rev=513387
Log:
Various improvements....
o Add helper methods to ClientProxyFactoryBean
o Allow service factories to set the ConcreteName. This is necessary for
  wrapped messages which don't have a wrapper class. Before this the 
  message parts were being written out without a namespace, which was wrong.
o For the dynamic client, don't initialize a type class for wrapped operations.
o Use the correct MessageInfo with wrapped operations inside WSDLServiceBuilder.


Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java?view=diff&rev=513387&r1=513386&r2=513387
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java Thu Mar  1 07:36:01 2007
@@ -31,6 +31,7 @@
     private boolean isElement;
     private QName typeName;
     private QName elementName;
+    private QName concreteName;
     private XmlSchemaAnnotated xmlSchema;
     private Class<?> typeClass;
     private int index;
@@ -54,10 +55,13 @@
     }
     
     public QName getConcreteName() {
-        //if !isElement, we store the non-qualified part name in element name anyway
-        return elementName;
+        return concreteName;
     }
     
+    public void setConcreteName(QName concreteName) {
+        this.concreteName = concreteName;
+    }
+
     public boolean isElement() { 
         return isElement;
     }
@@ -79,12 +83,15 @@
     }
     public void setTypeQName(QName qn) {
         isElement = false;
-        elementName = new QName(null, pname.getLocalPart());
+        if (concreteName == null) {
+            concreteName = new QName(null, pname.getLocalPart());
+        }
         typeName = qn;
     }
     public void setElementQName(QName qn) {
         isElement = true;
         elementName = qn;
+        concreteName = qn;
     }
     
     public AbstractMessageContainer getMessageInfo() {

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java?view=diff&rev=513387&r1=513386&r2=513387
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java Thu Mar  1 07:36:01 2007
@@ -70,10 +70,7 @@
             xmlOut.addAfter(wrappedOut.getId());
             chain.add(xmlOut);
             
-            chain.doInterceptInSubChain(message);
-            
-            chain.add(new URIParameterOutInterceptor());
-            
+
             Endpoint ep = message.getExchange().get(Endpoint.class);
             URIMapper mapper = (URIMapper) ep.getService().get(URIMapper.class.getName());
             BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
@@ -82,10 +79,16 @@
             message.put(Message.HTTP_REQUEST_METHOD, verb);
             boolean putOrPost = verb.equals(HttpConstants.POST) || verb.equals(HttpConstants.PUT);
             
-            if (putOrPost) {
+            if (putOrPost) { 
+                chain.doInterceptInSubChain(message);
+                chain.add(new URIParameterOutInterceptor());
                 chain.add(new DocumentWriterInterceptor());
                 chain.add(STAX_OUT);
+            } else {
+                chain.add(new URIParameterOutInterceptor());
+                
             }
+           
         } else {
             chain.add(STAX_OUT);
             chain.add(WRAPPED_OUT);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=513387&r1=513386&r2=513387
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Thu Mar  1 07:36:01 2007
@@ -103,6 +103,11 @@
             throw new UncheckedException(
                 new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
         }
+        
+        if (op.isUnwrappedCapable()) {
+            op = op.getUnwrappedOperation();
+        }
+        
         return invoke(op, params);
     }
 

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java?view=diff&rev=513387&r1=513386&r2=513387
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java Thu Mar  1 07:36:01 2007
@@ -51,9 +51,8 @@
         
         faultMessage = m.getExchange().get(Binding.class).createMessage(faultMessage);
         setFaultMessage(m, faultMessage);
-
         MessageImpl.copyContent(m, faultMessage);
-               
+
         // setup chain
         PhaseInterceptorChain chain = new PhaseInterceptorChain(getPhases());
         initializeInterceptors(faultMessage.getExchange(), chain);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=513387&r1=513386&r2=513387
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Thu Mar  1 07:36:01 2007
@@ -536,7 +536,8 @@
 
         // Now lets see if we have any attributes...
         // This should probably look at the restricted and substitute types too.
-        MessageInfo unwrappedInput = new MessageInfo(opInfo, inputMessage.getName());
+        OperationInfo unwrapped = new UnwrappedOperationInfo(opInfo);
+        MessageInfo unwrappedInput = new MessageInfo(unwrapped, inputMessage.getName());
         MessageInfo unwrappedOutput = null;
 
         XmlSchemaComplexType xsct = null;
@@ -555,7 +556,7 @@
         }
 
         if (outputMessage != null) {
-            unwrappedOutput = new MessageInfo(opInfo, outputMessage.getName());
+            unwrappedOutput = new MessageInfo(unwrapped, outputMessage.getName());
 
             if (outputEl != null && outputEl.getSchemaType() instanceof XmlSchemaComplexType) {
                 xsct = (XmlSchemaComplexType)outputEl.getSchemaType();
@@ -573,7 +574,6 @@
         }
 
         // we are wrappable!!
-        OperationInfo unwrapped = new UnwrappedOperationInfo(opInfo);
         opInfo.setUnwrappedOperation(unwrapped);
         unwrapped.setInput(opInfo.getInputName(), unwrappedInput);
         if (outputMessage != null) {

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java?view=diff&rev=513387&r1=513386&r2=513387
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java Thu Mar  1 07:36:01 2007
@@ -31,6 +31,7 @@
 import org.apache.cxf.service.ServiceModelVisitor;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 
 public class TypeClassInitializer extends ServiceModelVisitor {
@@ -45,13 +46,17 @@
 
     @Override
     public void begin(MessagePartInfo part) {
+        OperationInfo op = part.getMessageInfo().getOperation();
+        if (op.isUnwrappedCapable() && !op.isUnwrapped()) {
+            return;
+        }
+        
         QName name;
         if (part.isElement()) {
             name = part.getElementQName();
         } else {
             name = part.getTypeQName();
         }
-        
         Mapping mapping = model.get(name);
         
         String clsName = null;

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java?view=diff&rev=513387&r1=513386&r2=513387
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java Thu Mar  1 07:36:01 2007
@@ -21,17 +21,14 @@
 import java.net.URL;
 import java.util.Collection;
 
-
 import javax.wsdl.Definition;
 import javax.wsdl.factory.WSDLFactory;
 import javax.xml.namespace.QName;
 
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 import org.apache.cxf.Bus;
-
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.jaxws.service.Hello;
 import org.apache.cxf.jaxws.service.HelloInterface;
@@ -131,7 +128,7 @@
         assertNotNull(res);
         
         addNamespace("h", "http://service.jaxws.cxf.apache.org/");
-        assertValid("//s:Body/h:getGreetingsResponse/h:return/h:item", res);
+        assertValid("//s:Body/h:getGreetingsResponse/h:return/item", res);
     }
     
     public void testClient() throws Exception {

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java?view=diff&rev=513387&r1=513386&r2=513387
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java Thu Mar  1 07:36:01 2007
@@ -26,6 +26,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 
 /**
  * This class will create a client for you which implements the specified
@@ -120,6 +121,22 @@
         clientFactoryBean.getServiceFactory().setWsdlURL(wsdlURL);
     }
 
+    public String getAddress() {
+        return clientFactoryBean.getAddress();
+    }
+
+    public void setAddress(String add) {
+        clientFactoryBean.setAddress(add);
+    }
+
+    public ReflectionServiceFactoryBean getServiceFactory() {
+        return clientFactoryBean.getServiceFactory();
+    }
+    
+    public void setServiceFactory(ReflectionServiceFactoryBean sf) {
+        clientFactoryBean.setServiceFactory(sf);
+    }
+    
     public Bus getBus() {
         return bus;
     }

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?view=diff&rev=513387&r1=513386&r2=513387
==============================================================================
--- 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 Thu Mar  1 07:36:01 2007
@@ -179,6 +179,10 @@
 
         setService(factory.create());
 
+        if (properties != null) {
+            getService().putAll(properties);
+        }
+        
         initializeWSDLOperations();
 
         if (getDataBinding() != null) {
@@ -190,6 +194,12 @@
         LOG.info("Creating Service " + getServiceQName() + " from class " + getServiceClass().getName());
         ServiceInfo serviceInfo = new ServiceInfo();
         ServiceImpl service = new ServiceImpl(serviceInfo);
+
+        setService(service);  
+        
+        if (properties != null) {
+            service.putAll(properties);
+        }
         
         service.put(MethodDispatcher.class.getName(), methodDispatcher);
         
@@ -206,9 +216,7 @@
         
         if (isWrapped()) {
             initializeWrappedSchema(serviceInfo);
-        }
-        
-        setService(service);        
+        }      
     }
 
     protected void initializeServiceModel() {
@@ -219,10 +227,6 @@
         } else {
             buildServiceFromClass();
         }
-        
-        if (properties != null) {
-            getService().putAll(properties);
-        }
     }
 
     protected void initializeWSDLOperations() {
@@ -307,6 +311,11 @@
                 MessageInfo msg = new MessageInfo(op, op.getName());
                 op.setInput(uOp.getInputName(), msg);
                 msg.addMessagePart(op.getName());
+                
+                for (MessagePartInfo p : uOp.getInput().getMessageParts()) {
+                    p.setConcreteName(new QName(getServiceNamespace(), 
+                                                p.getName().getLocalPart()));
+                }
             } 
             
             if (uOp.hasOutput()) {
@@ -316,6 +325,11 @@
                 op.setOutput(uOp.getOutputName(), msg);
                 MessagePartInfo part = msg.addMessagePart(name);
                 part.setIndex(-1);
+                
+                for (MessagePartInfo p : uOp.getOutput().getMessageParts()) {
+                    p.setConcreteName(new QName(getServiceNamespace(), 
+                                                p.getName().getLocalPart()));
+                }
             }
         } else {
             createMessageParts(intf, op, m);
@@ -522,6 +536,10 @@
     }
 
     protected String getServiceNamespace() {
+        if (serviceName != null) {
+            return serviceName.getNamespaceURI();
+        }
+        
         for (AbstractServiceConfiguration c : serviceConfigurations) {
             String name = c.getServiceNamespace();
             if (name != null) {