You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/04/29 02:48:06 UTC

svn commit: r533450 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/rpc/ tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor...

Author: dkulp
Date: Sat Apr 28 17:48:05 2007
New Revision: 533450

URL: http://svn.apache.org/viewvc?view=rev&rev=533450
Log:
Use name attribute for Port name if portName isn't specified.
Map servlet request/response into jaxws context

Added:
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/rpc/EchoImpl.java   (with props)
Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/soap_header.wsdl

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java?view=diff&rev=533450&r1=533449&r2=533450
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java Sat Apr 28 17:48:05 2007
@@ -58,6 +58,10 @@
                           MessageContext.PATH_INFO);
         cxf2jaxwsMap.put(Message.QUERY_STRING, 
                           MessageContext.QUERY_STRING);
+        cxf2jaxwsMap.put("HTTP.REQUEST", 
+                         MessageContext.SERVLET_REQUEST);
+        cxf2jaxwsMap.put("HTTP.RESPONSE", 
+                         MessageContext.SERVLET_RESPONSE);
         
         jaxws2cxfMap.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
                          Message.ENDPOINT_ADDRESS);
@@ -71,6 +75,10 @@
         jaxws2cxfMap.put(MessageContext.QUERY_STRING,
                          Message.QUERY_STRING);
         
+        jaxws2cxfMap.put(MessageContext.SERVLET_REQUEST, 
+                         "HTTP.REQUEST"); 
+        jaxws2cxfMap.put(MessageContext.SERVLET_RESPONSE, 
+                         "HTTP.RESPONSE");
     }
     
     private ContextPropertiesMapping() {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java?view=diff&rev=533450&r1=533449&r2=533450
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java Sat Apr 28 17:48:05 2007
@@ -98,8 +98,20 @@
 
         // serviceName cannot be specified on SEI so check impl class only
         if (wsAnnotations.size() > 0) {
-            serviceName = wsAnnotations.get(0).serviceName();
-            namespace = wsAnnotations.get(0).targetNamespace();
+            int offset = 1;
+            if (seiClass == null) {
+                offset = 0;
+            }
+            //traverse up the parent impl classes for this info as well, but
+            //not the last one which would be the sei annotation
+            for (int x = 0; x < wsAnnotations.size() - offset; x++) {
+                if (StringUtils.isEmpty(serviceName)) {
+                    serviceName = wsAnnotations.get(x).serviceName();
+                }
+                if (StringUtils.isEmpty(namespace)) {
+                    namespace = wsAnnotations.get(x).targetNamespace();
+                }
+            }
         }
         
         if ((serviceName == null || namespace == null) 
@@ -127,11 +139,27 @@
     public QName getEndpointName() {
         String portName = null;
         String namespace = null;
+        String name = null;
 
         // portName cannot be specified on SEI so check impl class only
         if (wsAnnotations.size() > 0) {
-            portName = wsAnnotations.get(0).portName();
-            namespace = wsAnnotations.get(0).targetNamespace();
+            int offset = 1;
+            if (seiClass == null) {
+                offset = 0;
+            }
+            //traverse up the parent impl classes for this info as well, but
+            //not the last one which would be the sei annotation
+            for (int x = 0; x < wsAnnotations.size() - offset; x++) {
+                if (StringUtils.isEmpty(portName)) {
+                    portName = wsAnnotations.get(x).portName();
+                }
+                if (StringUtils.isEmpty(namespace)) {
+                    namespace = wsAnnotations.get(x).targetNamespace();
+                }
+                if (StringUtils.isEmpty(name)) {
+                    name = wsAnnotations.get(x).name();
+                }
+            }
         }
 
         if ((portName == null || namespace == null)
@@ -139,7 +167,10 @@
             portName = wsProviderAnnotation.portName();
             namespace = wsProviderAnnotation.targetNamespace();
         }
-
+        if (StringUtils.isEmpty(portName)
+            && !StringUtils.isEmpty(name)) {
+            portName = name + "Port";
+        }
         if (StringUtils.isEmpty(portName)) {
             portName = implementorClass.getSimpleName() + "Port";
         }
@@ -221,7 +252,7 @@
     private void initialise() {
         Class<?> cls = implementorClass;
         while (cls != null) {
-            WebService annotation = implementorClass.getAnnotation(WebService.class);
+            WebService annotation = cls.getAnnotation(WebService.class);
             if (annotation != null) {
                 wsAnnotations.add(annotation); 
             }

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/rpc/EchoImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/rpc/EchoImpl.java?view=auto&rev=533450
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/rpc/EchoImpl.java (added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/rpc/EchoImpl.java Sat Apr 28 17:48:05 2007
@@ -0,0 +1,36 @@
+/**
+ * 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.tools.fortest.withannotation.rpc;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(name = "Echo",
+            serviceName = "EchoService",
+            targetNamespace = "http://cxf.apache.org/echotest")
+@SOAPBinding(style = javax.jws.soap.SOAPBinding.Style.RPC)
+public class EchoImpl {
+    
+    @WebMethod
+    public String echoString(String str) {
+        return str;
+    }
+
+}

Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/rpc/EchoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/rpc/EchoImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java?view=diff&rev=533450&r1=533449&r2=533450
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java Sat Apr 28 17:48:05 2007
@@ -20,8 +20,10 @@
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws;
 
 import java.io.File;
+import java.io.FileInputStream;
 
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ProcessorTestBase;
 import org.apache.cxf.tools.fortest.classnoanno.docbare.Stock;
@@ -267,7 +269,27 @@
         generator.generate(file);
         assertTrue(output.exists());
     }
-   
+
+    @Test
+    public void testRpcLitNoSEI() throws Exception {
+        builder.setServiceClass(org.apache.cxf.tools.fortest.withannotation.rpc.EchoImpl.class);
+        ServiceInfo service = builder.build();
+        generator.setServiceModel(service);
+        
+        File output = getOutputFile("rpclist_no_sei.wsdl");
+        assertNotNull(output);
+        generator.generate(output);
+        assertTrue(output.exists());
+
+        String s = IOUtils.toString(new FileInputStream(output));
+        assertTrue(s.indexOf("EchoPort") != -1);
+        /*
+        String expectedFile = this.getClass()
+            .getResource("expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl").getFile();
+        assertFileEquals(expectedFile, output.getAbsolutePath());
+        */
+    }
+    
     private File getOutputFile(String fileName) {
         return new File(output, fileName);
     }

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl?view=diff&rev=533450&r1=533449&r2=533450
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl Sat Apr 28 17:48:05 2007
@@ -63,7 +63,7 @@
     </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="HelloWrappedService">
-    <wsdl:port name="HelloWrappedPort" binding="ns1:HelloWrappedServiceSoapBinding">
+    <wsdl:port name="HelloPort" binding="ns1:HelloWrappedServiceSoapBinding">
       <soap:address location="http://localhost:9090"/>
     </wsdl:port>
   </wsdl:service>

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/soap_header.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/soap_header.wsdl?view=diff&rev=533450&r1=533449&r2=533450
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/soap_header.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/soap_header.wsdl Sat Apr 28 17:48:05 2007
@@ -168,7 +168,7 @@
     </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="HeaderTesterService">
-    <wsdl:port name="HeaderTesterPort" binding="ns1:HeaderTesterServiceSoapBinding">
+    <wsdl:port name="headerTesterPort" binding="ns1:HeaderTesterServiceSoapBinding">
       <soap:address location="http://localhost:9090"/>
     </wsdl:port>
   </wsdl:service>