Author: dkulp
Date: Wed Jun 8 15:31:23 2011
New Revision: 1133430
URL: http://svn.apache.org/viewvc?rev=1133430&view=rev
Log:
Merged revisions 1133425 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1133425 | dkulp | 2011-06-08 11:24:32 -0400 (Wed, 08 Jun 2011) | 1 line
[CXF-3580] Allow element refs when checking for unwrapping from Dynamic client
........
Modified:
cxf/branches/2.3.x-fixes/ (props changed)
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=1133430&r1=1133429&r2=1133430&view=diff
==============================================================================
---
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
(original)
+++
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
Wed Jun 8 15:31:23 2011
@@ -118,11 +118,13 @@ public class ClientImpl
}
public ClientImpl(URL wsdlUrl) {
- this(BusFactory.getThreadDefaultBus(), wsdlUrl, null, null,
SimpleEndpointImplFactory.getSingleton());
+ this(BusFactory.getThreadDefaultBus(), wsdlUrl, (QName)null,
+ null, SimpleEndpointImplFactory.getSingleton());
}
public ClientImpl(URL wsdlUrl, QName port) {
- this(BusFactory.getThreadDefaultBus(), wsdlUrl, null, port,
SimpleEndpointImplFactory.getSingleton());
+ this(BusFactory.getThreadDefaultBus(), wsdlUrl, (QName)null,
+ port, SimpleEndpointImplFactory.getSingleton());
}
/**
@@ -152,7 +154,31 @@ public class ClientImpl
WSDLServiceFactory sf = (service == null)
? (new WSDLServiceFactory(bus, wsdlUrl)) : (new
WSDLServiceFactory(bus, wsdlUrl, service));
Service svc = sf.create();
+ EndpointInfo epfo = findEndpoint(svc, port);
+ try {
+ if (endpointImplFactory != null) {
+
getConduitSelector().setEndpoint(endpointImplFactory.newEndpointImpl(bus, svc,
epfo));
+ } else {
+ getConduitSelector().setEndpoint(new EndpointImpl(bus, svc,
epfo));
+ }
+ } catch (EndpointException epex) {
+ throw new IllegalStateException("Unable to create endpoint: " +
epex.getMessage(), epex);
+ }
+ notifyLifecycleManager();
+ }
+ /**
+ * Create a Client that uses a specific EndpointImpl.
+ * @param bus
+ * @param wsdlUrl
+ * @param service
+ * @param port
+ * @param endpointImplFactory
+ */
+ public ClientImpl(Bus bus, URL wsdlUrl, Service svc, QName port,
+ EndpointImplFactory endpointImplFactory) {
+ this.bus = bus;
+ outFaultObserver = new ClientOutFaultObserver(bus);
EndpointInfo epfo = findEndpoint(svc, port);
try {
Modified:
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java?rev=1133430&r1=1133429&r2=1133430&view=diff
==============================================================================
---
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
(original)
+++
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
Wed Jun 8 15:31:23 2011
@@ -47,6 +47,7 @@ public class WSDLServiceFactory extends
private QName serviceName;
private QName endpointName;
private Definition definition;
+ private boolean allowRefs;
public WSDLServiceFactory(Bus b, Definition d) {
setBus(b);
@@ -95,6 +96,11 @@ public class WSDLServiceFactory extends
serviceName = sn;
}
+
+ public void setAllowElementRefs(boolean b) {
+ allowRefs = b;
+ }
+
public void setEndpointName(QName qn) {
endpointName = qn;
}
@@ -108,7 +114,9 @@ public class WSDLServiceFactory extends
List<ServiceInfo> services;
if (serviceName == null) {
try {
- services = new
WSDLServiceBuilder(getBus()).buildServices(definition);
+ WSDLServiceBuilder builder = new WSDLServiceBuilder(getBus());
+ builder.setAllowElementRefs(allowRefs);
+ services = builder.buildServices(definition);
} catch (XmlSchemaException ex) {
throw new ServiceConstructionException(new
Message("SERVICE_CREATION_MSG", LOG), ex);
}
Modified:
cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=1133430&r1=1133429&r2=1133430&view=diff
==============================================================================
---
cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
(original)
+++
cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Wed Jun 8 15:31:23 2011
@@ -76,6 +76,7 @@ import org.apache.cxf.service.factory.Se
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.wsdl11.WSDLServiceFactory;
/**
* This class reads a WSDL and creates a dynamic client from it.
*
@@ -98,6 +99,7 @@ public class DynamicClientFactory {
private String tmpdir = System.getProperty("java.io.tmpdir");
private boolean simpleBindingEnabled = true;
+ private boolean allowRefs;
private Map<String, Object> jaxbContextProperties;
@@ -112,6 +114,10 @@ public class DynamicClientFactory {
public void setTemporaryDirectory(String dir) {
tmpdir = dir;
}
+
+ public void setAllowElementReferences(boolean b) {
+ allowRefs = b;
+ }
/**
* Create a new instance using a specific <tt>Bus</tt>.
@@ -252,10 +258,15 @@ public class DynamicClientFactory {
}
URL u = composeUrl(wsdlUrl);
LOG.log(Level.FINE, "Creating client from URL " + u.toString());
- ClientImpl client = new ClientImpl(bus, u, service, port,
+
+ WSDLServiceFactory sf = (service == null)
+ ? (new WSDLServiceFactory(bus, wsdlUrl)) : (new
WSDLServiceFactory(bus, wsdlUrl, service));
+ sf.setAllowElementRefs(allowRefs);
+ Service svc = sf.create();
+
+ ClientImpl client = new ClientImpl(bus, u, svc, port,
getEndpointImplFactory());
- Service svc = client.getEndpoint().getService();
//all SI's should have the same schemas
Collection<SchemaInfo> schemas =
svc.getServiceInfos().get(0).getSchemas();