cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r753335 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws...
Date Fri, 13 Mar 2009 18:19:51 GMT
Author: dkulp
Date: Fri Mar 13 18:19:44 2009
New Revision: 753335

URL: http://svn.apache.org/viewvc?rev=753335&view=rev
Log:
[CXF-1950] If there is a binding, but no service, go ahead and try to use it to determine
headers

Added:
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld-noservice-header.wsdl
  (with props)
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

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=753335&r1=753334&r2=753335&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 Fri Mar
13 18:19:44 2009
@@ -196,6 +196,14 @@
                 PortType portType = def.getPortType((QName)entry.getKey());
                 ServiceInfo serviceInfo = this.buildMockService(def, portType);
                 serviceList.add(serviceInfo);
+                
+                for (Iterator it2 = d.getAllBindings().values().iterator(); it2.hasNext();)
{
+                    Binding b = (Binding)it2.next();
+                    if (b.getPortType() == portType) {
+                        this.buildBinding(serviceInfo, b);
+                        break;
+                    }
+                }
             }
 
             if (def.getPortTypes().size() == 0) {

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java?rev=753335&r1=753334&r2=753335&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
Fri Mar 13 18:19:44 2009
@@ -93,11 +93,12 @@
     }
 
     public void process(ServiceInfo si) throws ToolException {
+        this.service = si;
         if (si.getName() == null) {
-            return;
+            processBindings(context.get(JavaModel.class));
+        } else {
+            processService(context.get(JavaModel.class));
         }
-        this.service = si;
-        processService(context.get(JavaModel.class));
 
     }
 
@@ -281,6 +282,25 @@
         }
         return jport;
     }
+    private void processBindings(JavaModel model) {
+        for (BindingInfo binding : service.getBindings()) {
+            bindingType = getBindingType(binding);
+
+            if (bindingType == null) {
+                org.apache.cxf.common.i18n.Message msg =
+                    new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL",
+                                                           LOG,
+                                                           binding.getName());
+                throw new ToolException(msg);
+            }
+
+            Collection<BindingOperationInfo> operations = binding.getOperations();
+            for (BindingOperationInfo bop : operations) {
+                processOperation(model, bop, binding);
+            }
+        }
+    }
+
 
     private void processOperation(JavaModel model, BindingOperationInfo bop, BindingInfo
binding)
         throws ToolException {

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=753335&r1=753334&r2=753335&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Fri Mar 13 18:19:44 2009
@@ -1309,5 +1309,21 @@
         assertEquals(1, sei.getMethods().length);
         assertFalse(Void.TYPE.equals(sei.getMethods()[0].getReturnType()));
     }
+    @Test
+    public void testCXF1950()  throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/helloworld-noservice-header.wsdl"));
+
+        processor.setContext(env);
+        processor.execute();
+
+        File seif = new File(output, "org/apache/cxf/helloworld/HelloWorldServiceImpl.java");
+        assertTrue(seif.exists());
+        Class sei =  classLoader.loadClass("org.apache.cxf.helloworld.HelloWorldServiceImpl");
+        Method m[] = sei.getDeclaredMethods();
+        assertEquals(1, m.length);
+        assertTrue(m[0].getParameterAnnotations()[1][0] instanceof WebParam);
+        WebParam wp = (WebParam)m[0].getParameterAnnotations()[1][0];
+        assertTrue(wp.header());
+    }
 
 }

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld-noservice-header.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld-noservice-header.wsdl?rev=753335&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld-noservice-header.wsdl
(added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld-noservice-header.wsdl
Fri Mar 13 18:19:44 2009
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<wsdl:definitions targetNamespace="http://helloworld.cxf.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://helloworld.cxf.apache.org" xmlns:intf="http://helloworld.cxf.apache.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
+    <wsdl:types>
+        <schema elementFormDefault="qualified" targetNamespace="http://helloworld.cxf.apache.org"
xmlns="http://www.w3.org/2001/XMLSchema">
+            <element name="getGreetings" type="xsd:string"/>
+            <element name="getGreetingsResponse" type="xsd:string"/>
+            <element name="header" type="xsd:string"/>
+        </schema>
+    </wsdl:types>
+
+    <wsdl:message name="getGreetingsRequest">
+        <wsdl:part element="impl:getGreetings" name="request"/>
+        <wsdl:part element="impl:header" name="header"/>
+    </wsdl:message>
+
+    <wsdl:message name="getGreetingsResponse">
+        <wsdl:part element="impl:getGreetingsResponse" name="response"/>
+    </wsdl:message>
+
+    <wsdl:portType name="HelloWorldServiceImpl">
+        <wsdl:operation name="getGreetings">
+            <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+            <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+
+    <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="getGreetings">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="getGreetingsRequest">
+                <wsdlsoap:header part="header" use="literal" message="impl:getGreetingsRequest"/>
+                <wsdlsoap:body use="literal" parts="request"/>
+            </wsdl:input>
+            <wsdl:output name="getGreetingsResponse">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+<!--
+
+    <wsdl:service name="HelloWorldServiceImplService">
+        <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+            <wsdlsoap:address location="http://localhost:8080/axis/services/helloworld"/>
+        </wsdl:port>
+    </wsdl:service>
+-->
+</wsdl:definitions>

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld-noservice-header.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld-noservice-header.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld-noservice-header.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message