cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r989123 - in /cxf/trunk: rt/databinding/xmlbeans/ rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/ rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/ systests/databinding/src/test/java/org/apache/cxf/systest/...
Date Wed, 25 Aug 2010 14:13:27 GMT
Author: ningjiang
Date: Wed Aug 25 14:13:26 2010
New Revision: 989123

URL: http://svn.apache.org/viewvc?rev=989123&view=rev
Log:
CXF-2957 fixed the wsdl2java issue of xmlbeans databinding

Modified:
    cxf/trunk/rt/databinding/xmlbeans/pom.xml
    cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
    cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GreeterMineImpl.java
    cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XmlBeansTest.java
    cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/cxf2.xml
    cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java
    cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java
    cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/PutLastTradePriceImpl.java

Modified: cxf/trunk/rt/databinding/xmlbeans/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/xmlbeans/pom.xml?rev=989123&r1=989122&r2=989123&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/xmlbeans/pom.xml (original)
+++ cxf/trunk/rt/databinding/xmlbeans/pom.xml Wed Aug 25 14:13:26 2010
@@ -97,7 +97,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-transports-http</artifactId>
+            <artifactId>cxf-rt-transports-http-jetty</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>

Modified: cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java?rev=989123&r1=989122&r2=989123&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
(original)
+++ cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
Wed Aug 25 14:13:26 2010
@@ -94,6 +94,7 @@ public class XMLBeansToolingDataBinding 
     XmlErrorWatcher errorListener = new XmlErrorWatcher(errors);
     PathResourceLoader cpResourceLoader = new PathResourceLoader(CodeGenUtil.systemClasspath());
     StscState state;
+   
     
     public void initialize(ToolContext context) throws ToolException {
         context.put(ToolConstants.RUNTIME_DATABINDING_CLASS,
@@ -101,6 +102,7 @@ public class XMLBeansToolingDataBinding 
         
         String wsdl = (String)context.get(ToolConstants.CFG_WSDLURL);
         String catalog = (String)context.get(ToolConstants.CFG_CATALOG);
+              
         Object o = context.get(ToolConstants.CFG_BINDING);
         String bindingFiles[]; 
         if (o instanceof String) {
@@ -135,7 +137,7 @@ public class XMLBeansToolingDataBinding 
     public String getType(QName qn, boolean element) {
         String ret;
         if (element) {
-            ret = typeSystem.findElement(qn).getType().getFullJavaName();
+            ret = typeSystem.findDocumentType(qn).getFullJavaName();                  
             if (ret.contains("$")) {
                 ret = ret.substring(0, ret.indexOf('$'));
             }

Modified: cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GreeterMineImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GreeterMineImpl.java?rev=989123&r1=989122&r2=989123&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GreeterMineImpl.java
(original)
+++ cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GreeterMineImpl.java
Wed Aug 25 14:13:26 2010
@@ -23,10 +23,10 @@ import javax.jws.WebService;
 import javax.xml.ws.BindingType;
 
 import org.apache.cxf.xmlbeans.wsdltest.GreeterMine;
-import org.apache.cxf.xmlbeans.wsdltest.StringListType;
+import org.apache.cxf.xmlbeans.wsdltest.SayHi2MessageDocument;
 
 @WebService(endpointInterface = "org.apache.cxf.xmlbeans.wsdltest.GreeterMine",
-            targetNamespace = "http://org.apache.cxf/xmlbeans",
+            targetNamespace = "http://cxf.apache.org/xmlbeans/wsdltest",
             portName = "SoapPort",
             serviceName = "SOAPMineService",
             name = "GreeterMine")
@@ -39,8 +39,10 @@ public class GreeterMineImpl implements 
         return "Bonjour";
     }
 */
-    public void sayHi2(StringListType stringList) {
+    public void sayHi2(SayHi2MessageDocument in) {
         System.out.println("****** Executing the operation sayHi2 *****");
+        in.dump();
+        
     }
 
 

Modified: cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XmlBeansTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XmlBeansTest.java?rev=989123&r1=989122&r2=989123&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XmlBeansTest.java
(original)
+++ cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XmlBeansTest.java
Wed Aug 25 14:13:26 2010
@@ -28,10 +28,10 @@ import org.apache.cxf.bus.spring.SpringB
 import org.apache.cxf.test.AbstractCXFTest;
 import org.apache.cxf.xmlbeans.wsdltest.GreeterMine;
 import org.apache.cxf.xmlbeans.wsdltest.SOAPMineService;
+import org.apache.cxf.xmlbeans.wsdltest.SayHi2MessageDocument;
 import org.apache.cxf.xmlbeans.wsdltest.StringListType;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class XmlBeansTest extends AbstractCXFTest {
@@ -58,7 +58,6 @@ public class XmlBeansTest extends Abstra
     
     
     @Test
-    @Ignore
     public void testBusCreationFails() throws Exception {
         bf = new SpringBusFactory();
         bus = bf.createBus(CONFIG1);
@@ -66,22 +65,22 @@ public class XmlBeansTest extends Abstra
     }
 
     @Test
-    @Ignore
     public void testBasicFails() throws Exception {
 
         bf = new SpringBusFactory();
         bus = bf.createBus(CONFIG2);
         BusFactory.setDefaultBus(bus);
-        URL wsdlURL = XmlBeansTest.class.getResource("xmlbeanstest.wsdl");
+        URL wsdlURL = XmlBeansTest.class.getResource("/wsdl/xmlbeanstest.wsdl");
         SOAPMineService ss =
             new SOAPMineService(wsdlURL,
-                                new QName("http://cxf.apache.org/xmlbeans", "SOAPMineService"));
+                                new QName("http://cxf.apache.org/xmlbeans/wsdltest", "SOAPMineService"));
         GreeterMine port = ss.getSoapPort();
-
-        StringListType stringListType = StringListType.Factory.newInstance();
+        
+        SayHi2MessageDocument document = SayHi2MessageDocument.Factory.newInstance();
+        StringListType stringListType = document.addNewSayHi2Message();
         stringListType.setMyname("sean");
         stringListType.setMyaddress("home");
-        port.sayHi2(stringListType);
+        port.sayHi2(document);
     }
     
 

Modified: cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/cxf2.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/cxf2.xml?rev=989123&r1=989122&r2=989123&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/cxf2.xml (original)
+++ cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/cxf2.xml Wed Aug
25 14:13:26 2010
@@ -22,14 +22,12 @@
           class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
           scope="singleton">
       <property name="dataBinding" ref="xmlBeansBean" />
+      <property name="wrapped" value="false"/>
     </bean>
 
     <jaxws:endpoint id="greeterMineEndpoint"
                     address="http://localhost:9000/SoapContext/SoapPort"
-                    wsdlLocation="src/test/java/org/apache/cxf/xmlbeans/xmlbeanstest.wsdl"
-                    implementor="org.apache.cxf.xmlbeans.GreeterMineImpl"
-                    serviceName="ns:SOAPMineService"
-                    xmlns:ns="http://cxf.apache.org/xmlbeans">
+                    implementor="org.apache.cxf.xmlbeans.GreeterMineImpl">
         <jaxws:serviceFactory>
             <ref bean="testServiceFactory"/>
         </jaxws:serviceFactory>

Modified: cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java?rev=989123&r1=989122&r2=989123&view=diff
==============================================================================
--- cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java
(original)
+++ cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java
Wed Aug 25 14:13:26 2010
@@ -19,13 +19,14 @@
 
 package org.apache.cxf.systest.xmlbeans;
 
+import java.math.BigDecimal;
 import java.net.URL;
 
 import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.soap.SOAPBinding;
 
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
@@ -34,12 +35,20 @@ import org.apache.cxf.interceptor.Loggin
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.TestUtil;
+import org.apache.cxf.xmlbeans.docLitBare.types.InDecimalDocument;
+import org.apache.cxf.xmlbeans.docLitBare.types.InDocument;
+import org.apache.cxf.xmlbeans.docLitBare.types.InoutDocument;
+import org.apache.cxf.xmlbeans.docLitBare.types.OutStringDocument;
+import org.apache.cxf.xmlbeans.docLitBare.types.StringRespTypeDocument;
+import org.apache.cxf.xmlbeans.docLitBare.types.TradePriceData;
+import org.apache.cxf.xmlbeans.doc_lit_bare.PutLastTradedPricePortType;
 import org.apache.helloWorldSoapHttp.xmlbeans.types.FaultDetailDocument;
 import org.apache.helloWorldSoapHttp.xmlbeans.types.FaultDetailDocument.FaultDetail;
 import org.apache.hello_world_soap_http.xmlbeans.GreetMeFault;
 import org.apache.hello_world_soap_http.xmlbeans.Greeter;
 import org.apache.hello_world_soap_http.xmlbeans.PingMeFault;
 import org.apache.hello_world_soap_http.xmlbeans.SOAPService;
+
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -53,6 +62,8 @@ public class ClientServerXmlBeansTest ex
     private static final QName SERVICE_NAME 
         = new QName("http://apache.org/hello_world_soap_http/xmlbeans", "SOAPService");
     
+    private static final QName DOC_LIT_BARE_SERVICE =
+        new QName("http://cxf.apache.org/xmlbeans/doc_lit_bare", "SOAPService");
     
     @BeforeClass
     public static void startServers() throws Exception {
@@ -61,6 +72,45 @@ public class ClientServerXmlBeansTest ex
     }
     
     @Test
+    public void testCallFromDocLitBareClient() throws Exception {
+        SpringBusFactory factory = new SpringBusFactory();
+        Bus bus = factory.createBus("org/apache/cxf/systest/xmlbeans/cxf.xml");
+        BusFactory.setDefaultBus(bus);
+        URL wsdl = this.getClass().getResource("/wsdl_systest_databinding/xmlbeans/doc_lit_bare.wsdl");
+        assertNotNull("We should have found the WSDL here. " , wsdl);      
+        
+        org.apache.cxf.xmlbeans.doc_lit_bare.SOAPService ss = 
+            new org.apache.cxf.xmlbeans.doc_lit_bare.SOAPService(wsdl, DOC_LIT_BARE_SERVICE);
+        PutLastTradedPricePortType port = ss.getSoapPort();
+        updateAddressPort(port, WSDL_PORT);
+        
+         
+        ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor());
+        ClientProxy.getClient(port).getOutInterceptors().add(new LoggingOutInterceptor());
+        StringRespTypeDocument resp = port.bareNoParam();
+        assertEquals("Get a wrong response", "Get the request!", resp.getStringRespType());
+        
+        InDecimalDocument xd = InDecimalDocument.Factory.newInstance();
+        xd.setInDecimal(new BigDecimal(123));
+        OutStringDocument response = port.nillableParameter(xd);
+        assertEquals("Get a wrong response", "Get the request 123", response.getOutString());
+        
+        InDocument document = InDocument.Factory.newInstance();
+        TradePriceData data = document.addNewIn();
+        data.setTickerPrice(12.33F);
+        data.setTickerSymbol("CXF");
+        port.putLastTradedPrice(document);
+        
+        InoutDocument inOut = InoutDocument.Factory.newInstance();
+        data = inOut.addNewInout();
+        data.setTickerPrice(12.33F);
+        data.setTickerSymbol("CXF");
+        Holder<InoutDocument> holder = new Holder<InoutDocument>(inOut);
+        port.sayHi(holder);
+        assertEquals("Get a wrong response", "BAK", holder.value.getInout().getTickerSymbol());
+    }
+    
+    @Test
     public void testCallFromClient() throws Exception {
         SpringBusFactory factory = new SpringBusFactory();
         Bus bus = factory.createBus("org/apache/cxf/systest/xmlbeans/cxf.xml");
@@ -71,6 +121,7 @@ public class ClientServerXmlBeansTest ex
         SOAPService ss = new SOAPService(wsdl, SERVICE_NAME);
         Greeter port = ss.getSoapPort();
         updateAddressPort(port, WSDL_PORT);
+        
         String resp; 
         ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor());
         ClientProxy.getClient(port).getOutInterceptors().add(new LoggingOutInterceptor());
@@ -84,7 +135,7 @@ public class ClientServerXmlBeansTest ex
             port.greetMe("fault");
             fail("Should have been a fault");
         } catch (GreetMeFault ex) {
-            assertEquals("Some fault detail", ex.getFaultInfo().getStringValue());
+            assertEquals("Some fault detail", ex.getFaultInfo().getGreetMeFaultDetail());
         }
 
         try {
@@ -152,7 +203,7 @@ public class ClientServerXmlBeansTest ex
             port.greetMe("fault");
             fail("Should have been a fault");
         } catch (GreetMeFault ex) {
-            assertEquals("Some fault detail", ex.getFaultInfo().getStringValue());
+            assertEquals("Some fault detail", ex.getFaultInfo().getGreetMeFaultDetail());
         }
 
     }

Modified: cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java?rev=989123&r1=989122&r2=989123&view=diff
==============================================================================
--- cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java
(original)
+++ cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java
Wed Aug 25 14:13:26 2010
@@ -40,9 +40,11 @@ public class GreeterImpl implements Gree
      */
     public String greetMe(String me) throws GreetMeFault {
         if ("fault".equals(me)) {
-            org.apache.xmlbeans.XmlString st = org.apache.xmlbeans.XmlString.Factory.newInstance();
-            st.setStringValue("Some fault detail");
-            throw new GreetMeFault("Fault String", st);
+            org.apache.helloWorldSoapHttp.xmlbeans.types.GreetMeFaultDetailDocument detail
+                = org.apache.helloWorldSoapHttp.xmlbeans.types.GreetMeFaultDetailDocument.Factory
+                .newInstance();
+            detail.setGreetMeFaultDetail("Some fault detail");
+            throw new GreetMeFault("Fault String", detail);
         }
         LOG.info("Executing operation greetMe");        
         return "Hello " + me;

Modified: cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/PutLastTradePriceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/PutLastTradePriceImpl.java?rev=989123&r1=989122&r2=989123&view=diff
==============================================================================
--- cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/PutLastTradePriceImpl.java
(original)
+++ cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/PutLastTradePriceImpl.java
Wed Aug 25 14:13:26 2010
@@ -20,12 +20,9 @@
 package org.apache.cxf.systest.xmlbeans;
 
 import javax.jws.WebService;
-import javax.xml.ws.Holder;
 
-import org.apache.cxf.xmlbeans.docLitBare.types.TradePriceData;
+import org.apache.cxf.xmlbeans.docLitBare.types.StringRespTypeDocument;
 import org.apache.cxf.xmlbeans.doc_lit_bare.PutLastTradedPricePortType;
-import org.apache.xmlbeans.XmlDecimal;
-import org.apache.xmlbeans.XmlString;
 
 /**
  * 
@@ -35,25 +32,31 @@ import org.apache.xmlbeans.XmlString;
             endpointInterface = "org.apache.cxf.xmlbeans.doc_lit_bare.PutLastTradedPricePortType"
 )
 public class PutLastTradePriceImpl implements PutLastTradedPricePortType {
-
-    /** {@inheritDoc}*/
-    public XmlString bareNoParam() {
-        return null;
+    
+    public StringRespTypeDocument bareNoParam() {
+        StringRespTypeDocument st = StringRespTypeDocument.Factory.newInstance();
+        st.setStringRespType("Get the request!");
+        return st;
     }
 
-    /** {@inheritDoc}*/
-    public XmlString nillableParameter(XmlDecimal theRequest) {
-        return null;
+    public org.apache.cxf.xmlbeans.docLitBare.types.OutStringDocument nillableParameter(
+         org.apache.cxf.xmlbeans.docLitBare.types.InDecimalDocument theRequest) {       

+        org.apache.cxf.xmlbeans.docLitBare.types.OutStringDocument st 
+            = org.apache.cxf.xmlbeans.docLitBare.types.OutStringDocument.Factory.newInstance();
+        st.setOutString("Get the request " + theRequest.getInDecimal().toString());
+        return st;
     }
 
-    /** {@inheritDoc}*/
-    public void putLastTradedPrice(TradePriceData body) {
-
+    public void sayHi(javax.xml.ws.Holder<org.apache.cxf.xmlbeans.docLitBare.types.InoutDocument>
body) {
+        body.value.getInout().setTickerSymbol("BAK");
     }
+    
 
-    /** {@inheritDoc}*/
-    public void sayHi(Holder<TradePriceData> body) {
-
+    public void putLastTradedPrice(org.apache.cxf.xmlbeans.docLitBare.types.InDocument body)
{
+        System.out.println("Get the last trade price " 
+                           + body.getIn().getTickerPrice() + ", " + body.getIn().getTickerSymbol());
+    
     }
+    
 
 }



Mime
View raw message