cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r543420 - in /incubator/cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/wsdl11/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ tools/wsdlto/test/src/te...
Date Fri, 01 Jun 2007 08:03:46 GMT
Author: mmao
Date: Fri Jun  1 01:03:42 2007
New Revision: 543420

URL: http://svn.apache.org/viewvc?view=rev&rev=543420
Log:
CXF-631 Regression in simple front end WSDL auto-generation
* Move soap binding/operation creation from SoapTransportFactory to SoapBindingFactory
  SoapTransport only need to take care of soap address.


Added:
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/Hello.java
Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/wsdl11/SoapAddressPlugin.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/mapping-doc-literal.wsdl

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?view=diff&rev=543420&r1=543419&r2=543420
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
Fri Jun  1 01:03:42 2007
@@ -23,8 +23,11 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionRegistry;
 import javax.wsdl.extensions.mime.MIMEContent;
 import javax.wsdl.extensions.mime.MIMEMultipartRelated;
 import javax.wsdl.extensions.mime.MIMEPart;
@@ -60,6 +63,7 @@
 import org.apache.cxf.interceptor.URIMappingInterceptor;
 import org.apache.cxf.interceptor.WrappedOutInterceptor;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -67,7 +71,9 @@
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.extensions.soap.SoapBinding;
 import org.apache.cxf.tools.common.extensions.soap.SoapBody;
+import org.apache.cxf.tools.common.extensions.soap.SoapFault;
 import org.apache.cxf.tools.common.extensions.soap.SoapHeader;
 import org.apache.cxf.tools.common.extensions.soap.SoapOperation;
 import org.apache.cxf.tools.util.SOAPBindingUtil;
@@ -75,6 +81,7 @@
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.transport.MultipleEndpointObserver;
+import org.apache.cxf.wsdl.WSDLManager;
 
 
 public class SoapBindingFactory extends AbstractBindingFactory {
@@ -149,9 +156,114 @@
                 setupHeaders(bop, bOutput, unwrappedMsg, output, config);
             }
         }
+
+        try {
+            createSoapBinding(info);
+        } catch (WSDLException e) {
+            e.printStackTrace();
+        }
         
         return info;
     }
+
+
+    private void createSoapBinding(final SoapBindingInfo bi) throws WSDLException {
+        boolean isSoap12 = bi.getSoapVersion() instanceof Soap12;
+        ExtensionRegistry extensionRegistry = getBus().getExtension(WSDLManager.class)
+            .getExtenstionRegistry();
+        
+        SoapBinding soapBinding = SOAPBindingUtil.createSoapBinding(extensionRegistry, isSoap12);
+        soapBinding.setStyle(bi.getStyle());
+        soapBinding.setTransportURI(bi.getTransportURI());
+        bi.addExtensor(soapBinding);
+
+        for (BindingOperationInfo b : bi.getOperations()) {
+            for (BindingFaultInfo faultInfo : b.getFaults()) {
+                SoapFault soapFault = SOAPBindingUtil.createSoapFault(extensionRegistry,
isSoap12);
+                soapFault.setUse("literal");
+                soapFault.setName(faultInfo.getFaultInfo().getFaultName().getLocalPart());
+                faultInfo.addExtensor(soapFault);
+            }
+            SoapOperationInfo soi = b.getExtensor(SoapOperationInfo.class);
+                
+            SoapOperation soapOperation = SOAPBindingUtil.createSoapOperation(extensionRegistry,
+                                                                              isSoap12);
+            soapOperation.setSoapActionURI(soi.getAction());
+            soapOperation.setStyle(soi.getStyle());
+            boolean isRpc = "rpc".equals(soapOperation.getStyle());
+
+            b.addExtensor(soapOperation);
+
+            if (b.getInput() != null) {
+                List<String> bodyParts = null;
+                SoapHeaderInfo headerInfo = b.getInput().getExtensor(SoapHeaderInfo.class);
+                if (headerInfo != null) {
+                    bodyParts = new ArrayList<String>();
+                    for (MessagePartInfo part : b.getInput().getMessageParts()) {
+                        bodyParts.add(part.getName().getLocalPart());
+                    }
+                        
+                    SoapHeader soapHeader = SOAPBindingUtil.createSoapHeader(extensionRegistry,
+                                                                             BindingInput.class,
+                                                                             isSoap12);
+                    soapHeader.setMessage(b.getInput().getMessageInfo().getName());
+                    soapHeader.setPart(headerInfo.getPart().getName().getLocalPart());
+                    soapHeader.setUse("literal");
+                    bodyParts.remove(headerInfo.getPart().getName().getLocalPart());
+                    b.getInput().addExtensor(soapHeader);
+
+                } 
+                SoapBody body = SOAPBindingUtil.createSoapBody(extensionRegistry,
+                                                               BindingInput.class,
+                                                               isSoap12);
+                body.setUse("literal");
+                if (isRpc) {
+                    body.setNamespaceURI(b.getName().getNamespaceURI());
+                }
+
+                if (bodyParts != null) {
+                    body.setParts(bodyParts);
+                }
+
+                b.getInput().addExtensor(body);
+            }
+
+            if (b.getOutput() != null) {
+                List<String> bodyParts = null;
+                SoapHeaderInfo headerInfo = b.getOutput().getExtensor(SoapHeaderInfo.class);
+                if (headerInfo != null) {
+                    bodyParts = new ArrayList<String>();
+                    for (MessagePartInfo part : b.getOutput().getMessageParts()) {
+                        bodyParts.add(part.getName().getLocalPart());
+                    }
+                    SoapHeader soapHeader = SOAPBindingUtil.createSoapHeader(extensionRegistry,
+                                                                             BindingOutput.class,
+                                                                             isSoap12);
+                    soapHeader.setMessage(b.getOutput().getMessageInfo().getName());
+                    soapHeader.setPart(headerInfo.getPart().getName().getLocalPart());
+                    soapHeader.setUse("literal");
+                    bodyParts.remove(headerInfo.getPart().getName().getLocalPart());
+                    b.getOutput().addExtensor(soapHeader);
+
+                }
+                SoapBody body = SOAPBindingUtil.createSoapBody(extensionRegistry,
+                                                               BindingOutput.class,
+                                                               isSoap12);
+                body.setUse("literal");
+                if (isRpc) {
+                    body.setNamespaceURI(b.getName().getNamespaceURI());
+                }
+
+                if (bodyParts != null) {
+                    body.setParts(bodyParts);
+                }
+                    
+                b.getOutput().addExtensor(body);
+            }
+        }
+    }
+    
+    
     private void setupHeaders(BindingOperationInfo op, 
                               BindingMessageInfo bMsg, 
                               BindingMessageInfo unwrappedBMsg, 
@@ -179,12 +291,12 @@
         String parameterStyle = SoapConstants.PARAMETER_STYLE_WRAPPED;
         String bindingStyle = SoapConstants.BINDING_STYLE_DOC;
 
-        SoapBinding sb = null;
+        org.apache.cxf.binding.soap.SoapBinding sb = null;
         SoapVersion version = null;
         if (binding instanceof SoapBindingInfo) {
             SoapBindingInfo sbi = (SoapBindingInfo) binding;
             version = sbi.getSoapVersion();
-            sb = new SoapBinding(binding, version);
+            sb = new org.apache.cxf.binding.soap.SoapBinding(binding, version);
             // Service wide style
             if (!StringUtils.isEmpty(sbi.getStyle())) {
                 bindingStyle = sbi.getStyle();
@@ -259,7 +371,7 @@
         // Copy all the extensors
         initializeBindingInfo(service, binding, bi);
     
-        org.apache.cxf.tools.common.extensions.soap.SoapBinding wSoapBinding
+        SoapBinding wSoapBinding
             = SOAPBindingUtil.getSoapBinding(bi.getExtensors(ExtensibilityElement.class));
         
         bi.setTransportURI(wSoapBinding.getTransportURI());

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java?view=diff&rev=543420&r1=543419&r2=543420
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
Fri Jun  1 01:03:42 2007
@@ -20,14 +20,11 @@
 package org.apache.cxf.binding.soap;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOutput;
 import javax.wsdl.Port;
 import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensionRegistry;
@@ -36,21 +33,12 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
-import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
-import org.apache.cxf.binding.soap.model.SoapOperationInfo;
+import org.apache.cxf.binding.soap.wsdl11.SoapAddressPlugin;
 import org.apache.cxf.service.Service;
-import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingInfo;
-import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.extensions.soap.SoapAddress;
-import org.apache.cxf.tools.common.extensions.soap.SoapBinding;
-import org.apache.cxf.tools.common.extensions.soap.SoapBody;
-import org.apache.cxf.tools.common.extensions.soap.SoapFault;
-import org.apache.cxf.tools.common.extensions.soap.SoapHeader;
-import org.apache.cxf.tools.common.extensions.soap.SoapOperation;
 import org.apache.cxf.tools.util.SOAPBindingUtil;
 import org.apache.cxf.transport.AbstractTransportFactory;
 import org.apache.cxf.transport.Conduit;
@@ -101,111 +89,24 @@
         try {
             // We need to populate the soap extensibilityelement proxy for soap11 and soap12
             ExtensionRegistry extensionRegistry = WSDLFactory.newInstance().newPopulatedExtensionRegistry();
-            
-            SoapAddress soapAddress = SOAPBindingUtil.createSoapAddress(extensionRegistry,
isSoap12);
+            SoapAddressPlugin addresser = new SoapAddressPlugin();
+            addresser.setExtensionRegistry(extensionRegistry);
+                //SoapAddress soapAddress = SOAPBindingUtil.createSoapAddress(extensionRegistry,
isSoap12);
             String address = ei.getAddress();
             if (address == null) {
                 address = "http://localhost:9090";
             }
 
-            soapAddress.setLocationURI(address);
-            ei.addExtensor(soapAddress);
-            
-            SoapBinding soapBinding = SOAPBindingUtil.createSoapBinding(extensionRegistry,
isSoap12);
-            soapBinding.setStyle(bi.getStyle());
-            soapBinding.setTransportURI(bi.getTransportURI());
-            bi.addExtensor(soapBinding);
-
-            for (BindingOperationInfo b : bi.getOperations()) {
-                for (BindingFaultInfo faultInfo : b.getFaults()) {
-                    SoapFault soapFault = SOAPBindingUtil.createSoapFault(extensionRegistry,
isSoap12);
-                    soapFault.setUse("literal");
-                    soapFault.setName(faultInfo.getFaultInfo().getFaultName().getLocalPart());
-                    faultInfo.addExtensor(soapFault);
-                }
-                SoapOperationInfo soi = b.getExtensor(SoapOperationInfo.class);
-                
-                SoapOperation soapOperation = SOAPBindingUtil.createSoapOperation(extensionRegistry,
-                                                                                  isSoap12);
-                soapOperation.setSoapActionURI(soi.getAction());
-                soapOperation.setStyle(soi.getStyle());
-                boolean isRpc = "rpc".equals(soapOperation.getStyle());
-
-                b.addExtensor(soapOperation);
-
-                if (b.getInput() != null) {
-                    List<String> bodyParts = null;
-                    SoapHeaderInfo headerInfo = b.getInput().getExtensor(SoapHeaderInfo.class);
-                    if (headerInfo != null) {
-                        bodyParts = new ArrayList<String>();
-                        for (MessagePartInfo part : b.getInput().getMessageParts()) {
-                            bodyParts.add(part.getName().getLocalPart());
-                        }
-                        
-                        SoapHeader soapHeader = SOAPBindingUtil.createSoapHeader(extensionRegistry,
-                                                                                 BindingInput.class,
-                                                                                 isSoap12);
-                        soapHeader.setMessage(b.getInput().getMessageInfo().getName());
-                        soapHeader.setPart(headerInfo.getPart().getName().getLocalPart());
-                        soapHeader.setUse("literal");
-                        bodyParts.remove(headerInfo.getPart().getName().getLocalPart());
-                        b.getInput().addExtensor(soapHeader);
-
-                    } 
-                    SoapBody body = SOAPBindingUtil.createSoapBody(extensionRegistry,
-                                                                   BindingInput.class,
-                                                                   isSoap12);
-                    body.setUse("literal");
-                    if (isRpc) {
-                        body.setNamespaceURI(b.getName().getNamespaceURI());
-                    }
-
-                    if (bodyParts != null) {
-                        body.setParts(bodyParts);
-                    }
-
-                    b.getInput().addExtensor(body);
-                }
-
-                if (b.getOutput() != null) {
-                    List<String> bodyParts = null;
-                    SoapHeaderInfo headerInfo = b.getOutput().getExtensor(SoapHeaderInfo.class);
-                    if (headerInfo != null) {
-                        bodyParts = new ArrayList<String>();
-                        for (MessagePartInfo part : b.getOutput().getMessageParts()) {
-                            bodyParts.add(part.getName().getLocalPart());
-                        }
-                        SoapHeader soapHeader = SOAPBindingUtil.createSoapHeader(extensionRegistry,
-                                                                                 BindingOutput.class,
-                                                                                 isSoap12);
-                        soapHeader.setMessage(b.getOutput().getMessageInfo().getName());
-                        soapHeader.setPart(headerInfo.getPart().getName().getLocalPart());
-                        soapHeader.setUse("literal");
-                        bodyParts.remove(headerInfo.getPart().getName().getLocalPart());
-                        b.getOutput().addExtensor(soapHeader);
-
-                    }
-                    SoapBody body = SOAPBindingUtil.createSoapBody(extensionRegistry,
-                                                                   BindingOutput.class,
-                                                                   isSoap12);
-                    body.setUse("literal");
-                    if (isRpc) {
-                        body.setNamespaceURI(b.getName().getNamespaceURI());
-                    }
-
-                    if (bodyParts != null) {
-                        body.setParts(bodyParts);
-                    }
-                    
-                    b.getOutput().addExtensor(body);
-                }
-            }
+            //soapAddress.setLocationURI(address);
+            ei.addExtensor(addresser.createExtension(isSoap12, address));
+
+            //createSoapBinding(isSoap12, extensionRegistry, bi);
             
         } catch (WSDLException e) {
             e.printStackTrace();
         }
     }
-    
+
     public EndpointInfo createEndpointInfo(ServiceInfo serviceInfo, BindingInfo b, Port port)
{
         String transportURI = "http://schemas.xmlsoap.org/wsdl/soap/";
         if (b instanceof SoapBindingInfo) {

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/wsdl11/SoapAddressPlugin.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/wsdl11/SoapAddressPlugin.java?view=diff&rev=543420&r1=543419&r2=543420
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/wsdl11/SoapAddressPlugin.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/wsdl11/SoapAddressPlugin.java
Fri Jun  1 01:03:42 2007
@@ -28,15 +28,20 @@
 import org.apache.cxf.tools.util.SOAPBindingUtil;
 import org.apache.cxf.wsdl.AbstractWSDLPlugin;
 
-public class SoapAddressPlugin extends AbstractWSDLPlugin {
+public final class SoapAddressPlugin extends AbstractWSDLPlugin {
 
     public ExtensibilityElement createExtension(Map<String, Object> args) throws WSDLException
{
+        return createExtension(optionSet(args, ToolConstants.CFG_SOAP12),
+                               getOption(args, ToolConstants.CFG_ADDRESS));
+    }
+
+    public ExtensibilityElement createExtension(final boolean isSOAP12,
+                                                final String address) throws WSDLException
{
         SoapAddress soapAddress = null;
-        boolean isSOAP12 = optionSet(args, ToolConstants.CFG_SOAP12);
 
         soapAddress = SOAPBindingUtil.createSoapAddress(registry, isSOAP12);
         
-        soapAddress.setLocationURI(getOption(args, ToolConstants.CFG_ADDRESS));
+        soapAddress.setLocationURI(address);
 
         return soapAddress;
     }

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/Hello.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/Hello.java?view=auto&rev=543420
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/Hello.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/Hello.java Fri
Jun  1 01:03:42 2007
@@ -0,0 +1,25 @@
+/**
+ * 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.jaxws;
+
+
+public interface Hello {
+    int add(int arg0, int arg1);
+}

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java?view=diff&rev=543420&r1=543419&r2=543420
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java
Fri Jun  1 01:03:42 2007
@@ -18,8 +18,24 @@
  */
 package org.apache.cxf.jaxws;
 
+import java.util.HashMap;
+import java.util.Map;
+import javax.wsdl.Definition;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.xpath.XPathConstants;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.calculator.CalculatorPortType;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.helpers.XPathUtils;
 import org.apache.cxf.jaxws.service.Hello;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 import org.apache.hello_world_doc_lit.GreeterImplDoc;
 import org.junit.Test;
 
@@ -46,5 +62,74 @@
         
         Server server = sf.create();
         assertNotNull(server);
+    }
+
+
+    @Test
+    public void testSimpleServiceClass() throws Exception {
+        ServerFactoryBean factory = new ServerFactoryBean();
+        factory.setServiceClass(Hello.class);
+        String address = "http://localhost:9001/jaxwstest";
+        factory.setAddress(address);
+        Server server = factory.create();
+        Endpoint endpoint = server.getEndpoint();
+        ServiceInfo service = endpoint.getEndpointInfo().getService();
+        assertNotNull(service);
+
+        Bus bus = factory.getBus();
+        Definition def = new ServiceWSDLBuilder(bus, service).build();
+
+        WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
+        def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtenstionRegistry());
+        Document doc = wsdlWriter.getDocument(def);
+
+        Map<String, String> ns = new HashMap<String, String>();
+        ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
+        ns.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
+        XPathUtils xpather = new XPathUtils(ns);
+        xpather.isExist("/wsdl:definitions/wsdl:binding/soap:binding",
+                        doc,
+                        XPathConstants.NODE);
+        xpather.isExist("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='add']/soap:operation",
+                        doc,
+                        XPathConstants.NODE);
+        xpather.isExist("/wsdl:definitions/wsdl:service/wsdl:port[@name='add']/soap:address[@location='"
+                        + address + "']",
+                        doc,
+                        XPathConstants.NODE);
+    }
+
+    @Test
+    public void testJaxwsServiceClass() throws Exception {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(CalculatorPortType.class);
+        String address = "http://localhost:9001/jaxwstest";
+        factory.setAddress(address);
+        Server server = factory.create();
+        Endpoint endpoint = server.getEndpoint();
+        ServiceInfo service = endpoint.getEndpointInfo().getService();
+        assertNotNull(service);
+
+        Bus bus = factory.getBus();
+        Definition def = new ServiceWSDLBuilder(bus, service).build();
+
+        WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
+        def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtenstionRegistry());
+        Document doc = wsdlWriter.getDocument(def);
+
+        Map<String, String> ns = new HashMap<String, String>();
+        ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
+        ns.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
+        XPathUtils xpather = new XPathUtils(ns);
+        xpather.isExist("/wsdl:definitions/wsdl:binding/soap:binding",
+                        doc,
+                        XPathConstants.NODE);
+        xpather.isExist("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='add']/soap:operation",
+                        doc,
+                        XPathConstants.NODE);
+        xpather.isExist("/wsdl:definitions/wsdl:service/wsdl:port[@name='add']/soap:address[@location='"
+                        + address + "']",
+                        doc,
+                        XPathConstants.NODE);
     }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?view=diff&rev=543420&r1=543419&r2=543420
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Fri Jun  1 01:03:42 2007
@@ -319,7 +319,7 @@
         File mapping = new File(apache, "mapping");
         assertTrue(mapping.exists());
         File[] files = mapping.listFiles();
-        assertEquals(7, files.length);
+        assertEquals(9, files.length);
         Class clz = classLoader.loadClass("org.apache.mapping.SomethingServer");
         Method method = clz.getMethod("doSomething", new Class[] {int.class, javax.xml.ws.Holder.class,
                                                                   javax.xml.ws.Holder.class});

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/mapping-doc-literal.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/mapping-doc-literal.wsdl?view=diff&rev=543420&r1=543419&r2=543420
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/mapping-doc-literal.wsdl
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/mapping-doc-literal.wsdl
Fri Jun  1 01:03:42 2007
@@ -44,8 +44,32 @@
                     </sequence>
                 </complexType>
             </element>
+
+	    <element name="gdocsRequest">
+		<complexType>
+		    <sequence>
+			<element name="foo1" type="string"/>
+			<element name="foo2" type="int"/>				
+		    </sequence>
+		</complexType>
+	    </element>
+	    <element name="gdocsResponse">
+		<complexType>
+		    <sequence>
+			<element name="foo2" type="int"/>
+			<element name="foo3" type="long"/>				
+		    </sequence>
+		</complexType>
+	    </element>
         </schema>
     </types>
+    <message name="gdocsRequest">
+	<part element="tns:gdocsRequest" name="parameters"/>
+    </message>
+    <message name="gdocsResponse">
+	<part element="tns:gdocsResponse" name="parameters"/>
+    </message>
+
     <message name="doSomething">
         <part element="tns:doSomething" name="parameters"/>
     </message>
@@ -57,6 +81,12 @@
             <input message="tns:doSomething" name="doSomething"/>
             <output message="tns:doSomethingResponse" name="doSomethingResponse"/>
         </operation>
+
+        <operation name="gdocsRequest">
+            <input message="tns:gdocsRequest" name="gdocsRequest"/>
+            <output message="tns:gdocsResponse" name="gdocsResponse"/>
+        </operation>
+
     </portType>
     <binding name="SomethingServerSOAPBinding" type="tns:SomethingServer">
         <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>



Mime
View raw message