cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r660076 - in /cxf/trunk: rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/ rt/frontend/jaxws/src/main/java/org/apache/...
Date Mon, 26 May 2008 02:10:47 GMT
Author: bimargulies
Date: Sun May 25 19:10:46 2008
New Revision: 660076

URL: http://svn.apache.org/viewvc?rev=660076&view=rev
Log:
Regress CXF-1603 in preparation for a real test of the JAX-WS 
DynamicClientFactory. Rename the Jaxws dynamic client  factory to 
JaxWsDynamicClientFactory.

Added:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLRuntimeException.java   (with
props)
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/JaxWsDynamicClientFactory.java
      - copied, changed from r659889, cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java
    cxf/trunk/testutils/src/main/resources/wsdl/no_body_parts.wsdl   (with props)
Removed:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java
Modified:
    cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java

Modified: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java?rev=660076&r1=660075&r2=660076&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
Sun May 25 19:10:46 2008
@@ -72,6 +72,54 @@
         bfm.registerBindingFactory(ns, bindingFactory);
         return bfm;
     }
+    
+    @Test
+    public void testNoBodyParts() throws Exception {
+        Definition d = createDefinition("/wsdl/no_body_parts.wsdl");
+        Bus bus = getMockBus();
+
+        BindingFactoryManager bfm = getBindingFactoryManager(WSDLConstants.NS_SOAP11, bus);
+
+        bus.getExtension(BindingFactoryManager.class);
+        expectLastCall().andReturn(bfm).anyTimes();
+        
+        DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
+        expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
+        
+        control.replay();
+
+        WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
+        ServiceInfo serviceInfo = builder
+            .buildServices(d, new QName("urn:cxf:no_body_parts/wsdl", 
+                                        "NoBodyParts"))
+            .get(0);
+
+        BindingInfo bi = serviceInfo.getBindings().iterator().next();
+
+        assertTrue(bi instanceof SoapBindingInfo);
+
+        SoapBindingInfo sbi = (SoapBindingInfo)bi;
+        assertEquals("document", sbi.getStyle());
+        assertTrue(WSDLConstants.NS_SOAP11_HTTP_TRANSPORT.equalsIgnoreCase(sbi.getTransportURI()));
+        assertTrue(sbi.getSoapVersion() instanceof Soap11);
+
+        BindingOperationInfo boi = sbi.getOperation(new QName("urn:cxf:no_body_parts/wsdl",
+                                                              "convertMime"));
+
+        assertNotNull(boi);
+        SoapOperationInfo sboi = boi.getExtensor(SoapOperationInfo.class);
+        assertNotNull(sboi);
+        assertNull(sboi.getStyle());
+        assertEquals("", sboi.getAction());
+
+        BindingMessageInfo input = boi.getInput();
+        SoapBodyInfo bodyInfo = input.getExtensor(SoapBodyInfo.class);
+        assertNull(bodyInfo.getUse());
+
+        List<MessagePartInfo> parts = bodyInfo.getParts();
+        assertNotNull(parts);
+        assertEquals(0, parts.size());
+    }
 
     @Test
     public void testFactory() throws Exception {        

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties?rev=660076&r1=660075&r2=660076&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties Sun May 25 19:10:46
2008
@@ -27,3 +27,5 @@
 SERVICE_CREATION_MSG = Failed to create service.
 NO_SUCH_SERVICE_EXC = Could not find definition for service {0}.
 FAIL_TO_CREATE_WSDL_DEFINITION = Fail to create wsdl definition from : {0}\r\nCaused by :
{1} 
+MISSING_DESTINATION_FACTORY = Cannot find the destination factory, check the port //wsdl:port[@name='{0}']
+MISSING_SERVICE= No definition of service {0} in the WSDL.

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java?rev=660076&r1=660075&r2=660076&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java Sun May
25 19:10:46 2008
@@ -153,7 +153,7 @@
                                       LOG,
                                       wsdlURL,
                                       we.getMessage());
-            throw new RuntimeException(msg.toString(), we);
+            throw new WSDLRuntimeException(msg, we);
         }
     }
 

Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLRuntimeException.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLRuntimeException.java?rev=660076&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLRuntimeException.java (added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLRuntimeException.java Sun May
25 19:10:46 2008
@@ -0,0 +1,42 @@
+/**
+ * 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 org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.i18n.UncheckedException;
+
+/**
+ * This exception is thrown for problems processing WSDL
+ * structures. 
+ */
+public class WSDLRuntimeException extends UncheckedException {
+
+    public WSDLRuntimeException(Message msg, Throwable t) {
+        super(msg, t);
+    }
+
+    public WSDLRuntimeException(Message msg) {
+        super(msg);
+    }
+
+    public WSDLRuntimeException(Throwable cause) {
+        super(cause);
+    }
+}

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLRuntimeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLRuntimeException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=660076&r1=660075&r2=660076&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Sun May
25 19:10:46 2008
@@ -146,6 +146,13 @@
 
     private List<ServiceInfo> buildServices(Definition d, QName name, DescriptionInfo
description) {
         Service service = d.getService(name);
+        if (service == null) {
+            org.apache.cxf.common.i18n.Message msg = 
+                new org.apache.cxf.common.i18n.Message("MISSING_SERVICE",
+                                                       LOG,
+                                                       name);
+            throw new WSDLRuntimeException(msg);
+        }
         return buildServices(d, service, description);
     }
 
@@ -356,8 +363,12 @@
                 }
             }
             if (ns == null) {
-                throw new RuntimeException("Can non find the destination factory, check the
port "
-                                           + " //wsdl:port[@name='" + port.getName() + "']");
+                
+                org.apache.cxf.common.i18n.Message msg = new 
+                    org.apache.cxf.common.i18n.Message("MISSING_DESTINATION_FACTORY",
+                                                       LOG,
+                                                       port.getName());
+                throw new WSDLRuntimeException(msg);
             }
             try {
                 factory = bus.getExtension(DestinationFactoryManager.class).getDestinationFactory(ns);

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=660076&r1=660075&r2=660076&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
(original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Sun May 25 19:10:46 2008
@@ -75,8 +75,17 @@
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 /**
+ * This class reads a WSDL and creates a dynamic client from it.
  * 
+ * Use {@link #newInstance} to obtain an instance, and then
+ * {@link #createClient(String)} (or other overloads) to create a client.
+ * 
+ * It uses the JAXB data binding. It does not set up complex interceptors for 
+ * features such as attachments. 
+ * See {@link org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory}
+ * for an alternative that sets up JAX-WS endpoints.
  *
+ * This class may be subclassed to allow for other endpoints or behaviors.
  */
 public class DynamicClientFactory {
 

Copied: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/JaxWsDynamicClientFactory.java
(from r659889, cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/JaxWsDynamicClientFactory.java?p2=cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/JaxWsDynamicClientFactory.java&p1=cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java&r1=659889&r2=660076&rev=660076&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/JaxWsDynamicClientFactory.java
Sun May 25 19:10:46 2008
@@ -22,14 +22,23 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.CXFBusFactory;
 import org.apache.cxf.endpoint.EndpointImplFactory;
+import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImplFactory;
 
 /**
- * This class creates dynamic clients with JAX-WS endpoints.
- */
-public class DynamicClientFactory extends org.apache.cxf.endpoint.dynamic.DynamicClientFactory
{
+ * This class reads a WSDL and creates a dynamic client from it with JAX-WS
+ * functionality.
+ * This provides support for attachments and other useful things that 
+ * come with JAX-WS.
+ * 
+ * Use {@link #newInstance} to obtain an instance, and then
+ * {@link #createClient(String)} (or other overloads) to create a client.
+ * 
+ * This factory uses the JAXB data binding. 
+ **/
+public class JaxWsDynamicClientFactory extends DynamicClientFactory {
 
-    protected DynamicClientFactory(Bus bus) {
+    protected JaxWsDynamicClientFactory(Bus bus) {
         super(bus);
     }
 
@@ -45,8 +54,8 @@
      *            instance
      * @return the new instance
      */
-    public static DynamicClientFactory newInstance(Bus b) {
-        return new DynamicClientFactory(b);
+    public static JaxWsDynamicClientFactory newInstance(Bus b) {
+        return new JaxWsDynamicClientFactory(b);
     }
 
     /**
@@ -55,8 +64,8 @@
      * @return the new instance
      * @see CXFBusFactory#getDefaultBus()
      */
-    public static DynamicClientFactory newInstance() {
+    public static JaxWsDynamicClientFactory newInstance() {
         Bus bus = CXFBusFactory.getThreadDefaultBus();
-        return new DynamicClientFactory(bus);
+        return new JaxWsDynamicClientFactory(bus);
     }
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=660076&r1=660075&r2=660076&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Sun
May 25 19:10:46 2008
@@ -124,8 +124,8 @@
         wsdlUrl = wsdl.toURI().toString();
         CXFBusFactory busFactory = new CXFBusFactory(); 
         Bus bus = busFactory.createBus();
-        org.apache.cxf.jaxws.endpoint.dynamic.DynamicClientFactory dynamicClientFactory =

-            org.apache.cxf.jaxws.endpoint.dynamic.DynamicClientFactory.newInstance(bus);
+        org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory dynamicClientFactory
= 
+            org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory.newInstance(bus);
         Client client = dynamicClientFactory.createClient(wsdlUrl);
         assertNotNull(client);
     }

Added: cxf/trunk/testutils/src/main/resources/wsdl/no_body_parts.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/resources/wsdl/no_body_parts.wsdl?rev=660076&view=auto
==============================================================================
--- cxf/trunk/testutils/src/main/resources/wsdl/no_body_parts.wsdl (added)
+++ cxf/trunk/testutils/src/main/resources/wsdl/no_body_parts.wsdl Sun May 25 19:10:46 2008
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" 
+             xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+             xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
+             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
+             xmlns:tns="urn:cxf:no_body_parts/wsdl"
+             xmlns:types="urn:cxf:no_body_parts/types"
+             targetNamespace="urn:cxf:no_body_parts/wsdl"
+             name="no_body_parts">
+<types>
+<xsd:schema xmlns:tns="http://ws-i.org/profiles/basic/1.1/xsd" 
+            elementFormDefault="qualified" 
+            targetNamespace="http://ws-i.org/profiles/basic/1.1/xsd"> 
+	<xsd:simpleType name="swaRef"> 
+		<xsd:restriction base="xsd:anyURI"/> 
+	</xsd:simpleType> 
+</xsd:schema>
+
+<xsd:schema xmlns:tns="urn:cxf:no_body_parts/types" 
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+            xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" 
+            elementFormDefault="qualified" 
+            targetNamespace="urn:cxf:no_body_parts/types">
+
+    <xsd:element name="convertMime">        
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="targetType" type="xsd:string" nillable="true"/>
+                <xsd:element name="optionString" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            </xsd:sequence>
+        </xsd:complexType>            
+    </xsd:element>
+    <xsd:element name="convertMimeResponse"> 
+        <xsd:complexType>
+            <xsd:sequence>    
+                <xsd:element name="status" type="xsd:string" nillable="true"/>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+
+
+</xsd:schema>
+</types>
+
+<message name="convertMimeRequest">
+    <part name="parameters" element="types:convertMime"/>
+    <part name="mimeAttachment" type="xsd:base64Binary"/>
+</message>
+<message name="convertMimeResponse">
+    <part name="result" element="types:convertMimeResponse"/>
+    <part name="mimeAttachment" type="xsd:base64Binary"/>
+</message>
+
+<portType name="NoBodyPartsSEI">
+    <operation name="convertMime">
+        <input message="tns:convertMimeRequest"/>
+        <output message="tns:convertMimeResponse"/>
+    </operation>    
+</portType>
+
+<binding name="NoBodyPartsSEIBinding" type="tns:NoBodyPartsSEI">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" 
+                  style="document"/>
+    <operation name="convertMime">
+        <soap:operation soapAction=""/>
+        <input>
+            <mime:multipartRelated>
+                <mime:part>
+                    <soap:body use="literal"/>
+                </mime:part>
+                <mime:part>
+                    <mime:content part="mimeAttachment" type="application/octet-stream"/>
+                </mime:part>
+            </mime:multipartRelated>
+        </input>
+        <output>
+            <mime:multipartRelated> 
+                <mime:part>
+                    <soap:body use="literal"/>
+                </mime:part>
+                <mime:part>
+                    <mime:content part="mimeAttachment" type="application/octet-stream"/>
+                </mime:part>
+            </mime:multipartRelated>        
+        </output>        
+    </operation>
+</binding>
+
+<service name="NoBodyParts">
+    <port name="NoBodyPartsPort" binding="tns:NoBodyPartsSEIBinding">
+      <soap:address location="http://localhost/NoBodyParts" />
+    </port>
+</service>
+
+</definitions>
+

Propchange: cxf/trunk/testutils/src/main/resources/wsdl/no_body_parts.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/testutils/src/main/resources/wsdl/no_body_parts.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/testutils/src/main/resources/wsdl/no_body_parts.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message