You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2013/01/14 07:30:59 UTC
svn commit: r1432811 - in /cxf/branches/2.5.x-fixes: ./
rt/core/src/main/java/org/apache/cxf/wsdl11/
rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/
systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/
systests/jaxws/src/test/res...
Author: ffang
Date: Mon Jan 14 06:30:59 2013
New Revision: 1432811
URL: http://svn.apache.org/viewvc?rev=1432811&view=rev
Log:
Merged revisions 1432803 via svnmerge from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
................
r1432803 | ffang | 2013-01-14 12:52:49 +0800 (一, 14 1 2013) | 16 lines
Merged revisions 1432800 via svnmerge from
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
................
r1432800 | ffang | 2013-01-14 12:44:04 +0800 (一, 14 1 2013) | 9 lines
Merged revisions 1432798 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1432798 | ffang | 2013-01-14 12:32:40 +0800 (一, 14 1 2013) | 1 line
[CXF-4676]Partial WSDL support in CXF
........
................
................
Added:
cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ExtensionInvocationHandler.java
cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/PartialWSDLProcessor.java
- copied unchanged from r1432803, cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/PartialWSDLProcessor.java
cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SOAPBindingUtil.java
- copied, changed from r1432803, cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SOAPBindingUtil.java
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AddNumbersImplPartial1.java
- copied unchanged from r1432803, cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AddNumbersImplPartial1.java
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AddNumbersImplPartial2.java
- copied unchanged from r1432803, cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AddNumbersImplPartial2.java
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerPartialWsdlTest.java
- copied unchanged from r1432803, cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerPartialWsdlTest.java
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerPartialWsdl.java
- copied unchanged from r1432803, cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerPartialWsdl.java
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/resources/partialwsdl/
- copied from r1432803, cxf/branches/2.6.x-fixes/systests/jaxws/src/test/resources/partialwsdl/
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/resources/partialwsdl/AddNumbersImplPartial1Service.wsdl
- copied unchanged from r1432803, cxf/branches/2.6.x-fixes/systests/jaxws/src/test/resources/partialwsdl/AddNumbersImplPartial1Service.wsdl
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/resources/partialwsdl/AddNumbersImplPartial1Service_schema1.xsd
- copied unchanged from r1432803, cxf/branches/2.6.x-fixes/systests/jaxws/src/test/resources/partialwsdl/AddNumbersImplPartial1Service_schema1.xsd
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/resources/partialwsdl/AddNumbersImplPartial2Service.wsdl
- copied unchanged from r1432803, cxf/branches/2.6.x-fixes/systests/jaxws/src/test/resources/partialwsdl/AddNumbersImplPartial2Service.wsdl
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/resources/partialwsdl/AddNumbersImplPartial2Service_schema1.xsd
- copied unchanged from r1432803, cxf/branches/2.6.x-fixes/systests/jaxws/src/test/resources/partialwsdl/AddNumbersImplPartial2Service_schema1.xsd
Modified:
cxf/branches/2.5.x-fixes/ (props changed)
cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/branches/2.7.x-fixes:r1432800
Merged /cxf/trunk:r1432798
Merged /cxf/branches/2.6.x-fixes:r1432803
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Added: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ExtensionInvocationHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ExtensionInvocationHandler.java?rev=1432811&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ExtensionInvocationHandler.java (added)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ExtensionInvocationHandler.java Mon Jan 14 06:30:59 2013
@@ -0,0 +1,44 @@
+/**
+ * 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.wsdl11;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+public class ExtensionInvocationHandler implements InvocationHandler {
+
+ private Object obj;
+ public ExtensionInvocationHandler(Object o) {
+ obj = o;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ Class<?>[] clzs = null;
+ if (args != null) {
+ clzs = new Class[args.length];
+ for (int i = 0; i < args.length; i++) {
+ clzs[i] = args[i].getClass();
+ }
+ }
+
+ Method m = obj.getClass().getMethod(method.getName(), method.getParameterTypes());
+ return m.invoke(obj, args);
+ }
+}
Copied: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SOAPBindingUtil.java (from r1432803, cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SOAPBindingUtil.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SOAPBindingUtil.java?p2=cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SOAPBindingUtil.java&p1=cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SOAPBindingUtil.java&r1=1432803&r2=1432811&rev=1432811&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SOAPBindingUtil.java (original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SOAPBindingUtil.java Mon Jan 14 06:30:59 2013
@@ -50,10 +50,8 @@ import javax.wsdl.extensions.soap12.SOAP
import javax.xml.namespace.QName;
import org.apache.cxf.common.WSDLConstants;
-import org.apache.cxf.common.util.ExtensionInvocationHandler;
import org.apache.cxf.common.util.StringUtils;
-
public final class SOAPBindingUtil {
private static Map<String, String> bindingMap = new HashMap<String, String>();
Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java?rev=1432811&r1=1432810&r2=1432811&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java (original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java Mon Jan 14 06:30:59 2013
@@ -22,15 +22,21 @@ package org.apache.cxf.wsdl11;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.logging.Logger;
+import javax.wsdl.Binding;
import javax.wsdl.Definition;
+import javax.wsdl.PortType;
import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
import javax.xml.namespace.QName;
import org.apache.cxf.Bus;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.ServiceImpl;
import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
@@ -136,7 +142,34 @@ public class WSDLServiceFactory extends
} else {
javax.wsdl.Service wsdlService = definition.getService(serviceName);
if (wsdlService == null) {
- throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC", LOG, serviceName));
+ if ((!PartialWSDLProcessor.isServiceExisted(definition, serviceName))
+ && (!PartialWSDLProcessor.isBindingExisted(definition, serviceName))
+ && (PartialWSDLProcessor.isPortTypeExisted(definition, serviceName))) {
+ try {
+ Map<QName, PortType> portTypes = CastUtils.cast(definition.getPortTypes());
+ String existPortName = null;
+ PortType portType = null;
+ for (QName existPortQName : portTypes.keySet()) {
+ existPortName = existPortQName.getLocalPart();
+ if (serviceName.getLocalPart().contains(existPortName)) {
+ portType = portTypes.get(existPortQName);
+ break;
+ }
+ }
+ WSDLFactory factory = WSDLFactory.newInstance();
+ ExtensionRegistry extReg = factory.newPopulatedExtensionRegistry();
+ Binding binding = PartialWSDLProcessor.doAppendBinding(definition,
+ existPortName, portType, extReg);
+ definition.addBinding(binding);
+ wsdlService = PartialWSDLProcessor.doAppendService(definition,
+ existPortName, extReg, binding);
+ definition.addService(wsdlService);
+ } catch (Exception e) {
+ throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC", LOG, serviceName));
+ }
+ } else {
+ throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC", LOG, serviceName));
+ }
}
try {
services = new WSDLServiceBuilder(getBus()).buildServices(definition,
Modified: cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1432811&r1=1432810&r2=1432811&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Mon Jan 14 06:30:59 2013
@@ -46,7 +46,9 @@ import java.util.concurrent.Executor;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.wsdl.Definition;
import javax.wsdl.Operation;
+import javax.wsdl.WSDLException;
import javax.xml.bind.annotation.XmlAttachmentRef;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlList;
@@ -106,6 +108,7 @@ import org.apache.cxf.service.model.Oper
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.service.model.UnwrappedOperationInfo;
+import org.apache.cxf.wsdl.WSDLManager;
import org.apache.cxf.wsdl11.WSDLServiceBuilder;
import org.apache.cxf.wsdl11.WSDLServiceFactory;
import org.apache.ws.commons.schema.XmlSchema;
@@ -496,7 +499,7 @@ public class ReflectionServiceFactoryBea
}
protected boolean isFromWsdl() {
- return !populateFromClass && getWsdlURL() != null;
+ return !populateFromClass && getWsdlURL() != null && !isEmptywsdl(getWsdlURL());
}
protected void initializeServiceModel() {
@@ -2558,4 +2561,17 @@ public class ReflectionServiceFactoryBea
public void setSchemaLocations(List<String> schemaLocations) {
this.schemaLocations = schemaLocations;
}
+
+ private boolean isEmptywsdl(String wsdlUrl) {
+ Definition definition;
+ try {
+ definition = getBus().getExtension(WSDLManager.class).getDefinition(wsdlUrl);
+ } catch (WSDLException e) {
+ return true;
+ }
+ if (definition.getPortTypes().isEmpty() && definition.getImports().isEmpty()) {
+ return true;
+ }
+ return false;
+ }
}