cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r528733 - in /incubator/cxf/trunk/rt/frontend: jaxws/src/main/java/org/apache/cxf/jaxws/ jaxws/src/main/java/org/apache/cxf/jaxws/support/ jaxws/src/test/java/org/apache/cxf/jaxws/support/ simple/src/main/java/org/apache/cxf/service/factory/
Date Sat, 14 Apr 2007 01:38:46 GMT
Author: dkulp
Date: Fri Apr 13 18:38:45 2007
New Revision: 528733

URL: http://svn.apache.org/viewvc?view=rev&rev=528733
Log:
Fix problems with part namespaces not matching if the messages are in a different namespace
than the operations
Fix issues with JAX-WS PortInfo's not being created

Added:
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
  (with props)
Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=528733&r1=528732&r2=528733
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
Fri Apr 13 18:38:45 2007
@@ -106,11 +106,12 @@
         for (ServiceInfo si : service.getServiceInfos()) { 
             for (EndpointInfo ei : si.getEndpoints()) {
                 this.ports.add(ei.getName());
+                addPort(ei.getName(), ei.getBinding().getBindingId(), ei.getAddress());
             }
         }
     }
 
-    public void addPort(QName portName, String bindingId, String address) {
+    public final void addPort(QName portName, String bindingId, String address) {
         PortInfoImpl portInfo = new PortInfoImpl(bindingId, portName, serviceName);
         portInfo.setAddress(address);
         portInfos.put(portName, portInfo);
@@ -122,15 +123,16 @@
         if (portName == null) {
             ei = service.getServiceInfos().get(0).getEndpoints().iterator().next();
         } else {
-            PortInfoImpl portInfo = getPortInfo(portName);
-            if (null != portInfo) {
-                try {
-                    ei = createEndpointInfo(sf, portName, portInfo);
-                } catch (BusException e) {
-                    throw new WebServiceException(e);
+            ei = service.getEndpointInfo(portName);
+            if (ei == null) {
+                PortInfoImpl portInfo = getPortInfo(portName);
+                if (null != portInfo) {
+                    try {
+                        ei = createEndpointInfo(sf, portName, portInfo);
+                    } catch (BusException e) {
+                        throw new WebServiceException(e);
+                    }
                 }
-            } else {
-                ei = service.getEndpointInfo(portName);
             }
         }
 
@@ -303,6 +305,7 @@
         configureObject(jaxwsEndpoint);  
                                       
         List<Handler> hc = jaxwsEndpoint.getJaxwsBinding().getHandlerChain();
+        
         hc.addAll(handlerResolver.getHandlerChain(portInfos.get(portName)));
 
         LOG.log(Level.FINE, "created proxy", obj);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java?view=diff&rev=528733&r1=528732&r2=528733
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
Fri Apr 13 18:38:45 2007
@@ -137,8 +137,14 @@
             if (!StringUtils.isEmpty(service.targetNamespace())) {
                 namespace = service.targetNamespace();
             }
+            
+            if (!StringUtils.isEmpty(portName)
+                && !StringUtils.isEmpty(namespace)) {
+                break;
+            }
         }
-        if ((portName == null || namespace == null) 
+        if ((StringUtils.isEmpty(portName) 
+            || StringUtils.isEmpty(namespace)) 
             && wsProviderAnnotation != null) {
             portName = wsProviderAnnotation.portName();
             namespace = wsProviderAnnotation.targetNamespace();

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?view=diff&rev=528733&r1=528732&r2=528733
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
Fri Apr 13 18:38:45 2007
@@ -44,6 +44,7 @@
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.OperationInfo;
 
 public class JaxWsServiceConfiguration extends AbstractServiceConfiguration {
@@ -160,7 +161,7 @@
             return null;
         }
                 
-        return getPartName(op, method, paramNumber, op.getInput().size(), "arg");
+        return getPartName(op, method, paramNumber, op.getInput(), "arg");
     }
 
     @Override
@@ -172,25 +173,27 @@
         return getParameterName(op, method, paramNumber, op.getInput().size(), "arg");
     }
 
-    private QName getPartName(OperationInfo op, Method method, int paramNumber, int curSize,
String prefix) {
+    private QName getPartName(OperationInfo op, Method method,
+                              int paramNumber, MessageInfo mi, String prefix) {
+        int curSize = mi.size();
+        
         method = getDeclaredMethod(method);
         WebParam param = getWebParam(method, paramNumber);
-        String tns = op.getName().getNamespaceURI();
+        String tns = mi.getName().getNamespaceURI();
+        QName ret = null;
         if (param != null) {
-//            if (param.targetNamespace().length() > 0) {
-//                tns = param.targetNamespace();
-//            }
             String local = param.partName();
             if (local.length() == 0) {
                 local = param.name();
             }
             if (local.length() == 0) {
-                getDefaultLocalName(op, method, paramNumber, curSize, prefix);
+                local = getDefaultLocalName(op, method, paramNumber, curSize, prefix);
             }
-            return new QName(tns, local);
+            ret = new QName(tns, local);
         } else {
-            return new QName(tns, getDefaultLocalName(op, method, paramNumber, curSize, prefix));
-        }        
+            ret = new QName(tns, getDefaultLocalName(op, method, paramNumber, curSize, prefix));
+        }
+        return ret;
     }
 
     private QName getParameterName(OperationInfo op, Method method, int paramNumber, 
@@ -279,10 +282,12 @@
         method = getDeclaredMethod(method);
         
         if (paramNumber >= 0) {
-            return getPartName(op, method, paramNumber, op.getOutput().size(), "return");
+            return getPartName(op, method, paramNumber, op.getOutput(), "return");
         } else {
             WebResult webResult = getWebResult(method);
-            String tns = op.getName().getNamespaceURI();
+            String tns = op.getOutput().getName().getNamespaceURI();
+            
+            QName ret;
             if (webResult != null) {
                 String local = webResult.partName();
 //                if (webResult.targetNamespace().length() > 0) {
@@ -294,10 +299,11 @@
                 if (local.length() == 0) {
                     local = getDefaultLocalName(op, method, paramNumber, op.getOutput().size(),
"return");
                 }
-                return new QName(tns, local);
+                ret = new QName(tns, local);
             } else {
-                return new QName(tns, "return");
+                ret = new QName(tns, "return");
             }
+            return ret;
         }        
     }
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?view=diff&rev=528733&r1=528732&r2=528733
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
Fri Apr 13 18:38:45 2007
@@ -176,6 +176,7 @@
 
         // rpc out-message-part-info class mapping
         Operation op = (Operation)o.getProperty(WSDLServiceBuilder.WSDL_OPERATION);
+        
         initializeClassInfo(o, method, op == null ? null
             : CastUtils.cast(op.getParameterOrdering(), String.class));
     }
@@ -339,6 +340,7 @@
             Class paramType = paramTypes[i];
             Type genericType = genericTypes[i];
 
+            
             initializeParameter(o, method, i, paramType, genericType);
         }
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java?view=diff&rev=528733&r1=528732&r2=528733
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
Fri Apr 13 18:38:45 2007
@@ -61,8 +61,8 @@
         jwsc.setServiceFactory(bean);
         
         OperationInfo op = si.getInterface().getOperation(opName);
-        op.setInput("input", new MessageInfo(op, new QName("input")));
-        op.setOutput("output", new MessageInfo(op, new QName("output")));
+        op.setInput("input", new MessageInfo(op, new QName("http://cxf.com/", "input")));
+        op.setOutput("output", new MessageInfo(op, new QName("http://cxf.com/", "output")));
         
         QName partName = jwsc.getInPartName(op, sayHelloMethod, 0);
         assertEquals("get wrong in partName for first param", new QName("http://cxf.com/",
"arg0"), partName);
@@ -125,7 +125,7 @@
         
         // clear the output
         OperationInfo op = si.getInterface().getOperation(opName);
-        op.setOutput("output", new MessageInfo(op, new QName("output")));
+        op.setOutput("output", new MessageInfo(op, new QName("http://cxf.com/", "output")));
         
         QName partName = jwsc.getOutPartName(op, sayHiMethod, -1);
         assertEquals("get wrong return partName", new QName("http://cxf.com/", "return"),
partName);

Added: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties?view=auto&rev=528733
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
(added)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
Fri Apr 13 18:38:45 2007
@@ -0,0 +1,22 @@
+#
+#
+#    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.
+#
+#
+COULD_NOT_FIND_PORTTYPE = Could not find portType named {0}
+NO_METHOD_FOR_OP = Could not find a matching method for operation {0}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=528733&r1=528732&r2=528733
==============================================================================
--- 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
Fri Apr 13 18:38:45 2007
@@ -240,18 +240,28 @@
         this.populateFromClass = fomClass;
     }
     
+    protected InterfaceInfo getInterfaceInfo() {
+        if (getEndpointInfo() != null) {
+            return getEndpointInfo().getInterface();
+        }
+        QName qn = this.getInterfaceName();
+        for (ServiceInfo si : getService().getServiceInfos()) {
+            if (qn.equals(si.getInterface().getName())) {
+                return si.getInterface();
+            }
+        }
+        throw new ServiceConstructionException(new Message("COULD_NOT_FIND_PORTTYPE", BUNDLE,
qn));
+    }
+    
     protected void initializeWSDLOperations() {
         Method[] methods = serviceClass.getMethods();
         Arrays.sort(methods, new MethodComparator());
-
-        InterfaceInfo intf;
-        if (getEndpointInfo() != null) {
-            intf = getEndpointInfo().getInterface();
-        } else {
-            intf = getService().getServiceInfos().get(0).getInterface();
-        }
+        getInterfaceInfo();
+        
+        InterfaceInfo intf = getInterfaceInfo();
 
         Map<QName, Method> validMethods = new HashMap<QName, Method>();
+        
         for (Method m : methods) {
             if (isValidMethod(m)) {
                 QName opName = getOperationName(intf, m);



Mime
View raw message