Author: ema
Date: Thu May 17 01:28:45 2007
New Revision: 538832

URL: http://svn.apache.org/viewvc?view=rev&rev=538832
Log:
Fixed issue CXF-656

Added:
    
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java
    
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Hello.java
    
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
    
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloService.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello.wsdl
Modified:
    
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/header_rpc_lit.wsdl

Modified: 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?view=diff&rev=538832&r1=538831&r2=538832
==============================================================================
--- 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
 (original)
+++ 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
 Thu May 17 01:28:45 2007
@@ -174,7 +174,7 @@
             return null;
         }
                 
-        return getPartName(op, method, paramNumber, op.getInput(), "arg");
+        return getPartName(op, method, paramNumber, op.getInput(), "arg", 
true);
     }
 
     @Override
@@ -187,8 +187,8 @@
     }
 
     private QName getPartName(OperationInfo op, Method method,
-                              int paramNumber, MessageInfo mi, String prefix) {
-        int curSize = mi.size();
+                              int paramNumber, MessageInfo mi, String prefix, 
boolean isIn) {
+        int partIndex = getPartIndex(method, paramNumber, isIn);
         
         method = getDeclaredMethod(method);
         WebParam param = getWebParam(method, paramNumber);
@@ -204,14 +204,35 @@
                 local = param.name();
             }
             if (local.length() == 0) {
-                local = getDefaultLocalName(op, method, paramNumber, curSize, 
prefix);
+                local = getDefaultLocalName(op, method, paramNumber, 
partIndex, prefix);
             }
             ret = new QName(tns, local);
         } else {
-            ret = new QName(tns, getDefaultLocalName(op, method, paramNumber, 
curSize, prefix));
+            ret = new QName(tns, getDefaultLocalName(op, method, paramNumber, 
partIndex, prefix));
         }
         return ret;
     }
+    
+    private int getPartIndex(Method method, int paraNumber, boolean isIn) {
+        int ret = 0;
+        if (isIn && isInParam(method, paraNumber)) {
+            for (int i = 0; i < paraNumber; i++) {
+                if (isInParam(method, i)) {
+                    ret++;
+                }
+            }
+        }
+        if (!isIn && isOutParam(method, paraNumber)) {
+            for (int i = 0; i < paraNumber; i++) {
+                if (isOutParam(method, i)) {
+                    ret++;
+                }
+            }
+        }
+        return ret;
+        
+        
+    }
 
     private QName getParameterName(OperationInfo op, Method method, int 
paramNumber, 
                                    int curSize, String prefix) {
@@ -236,10 +257,10 @@
     }
 
     private String getDefaultLocalName(OperationInfo op, Method method, int 
paramNumber, 
-                                       int curSize, String prefix) {
+                                       int partIndex, String prefix) {
         String paramName = null;        
         if (paramNumber != -1) {
-            paramName = prefix + curSize;
+            paramName = prefix + partIndex;
         } else {
             paramName = prefix;
         }
@@ -299,7 +320,7 @@
         method = getDeclaredMethod(method);
         
         if (paramNumber >= 0) {
-            return getPartName(op, method, paramNumber, op.getOutput(), 
"return");
+            return getPartName(op, method, paramNumber, op.getOutput(), 
"return", false);
         } else {
             WebResult webResult = getWebResult(method);
             String tns = op.getOutput().getName().getNamespaceURI();

Modified: 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?view=diff&rev=538832&r1=538831&r2=538832
==============================================================================
--- 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
 (original)
+++ 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
 Thu May 17 01:28:45 2007
@@ -353,9 +353,7 @@
         Type[] genericTypes = method.getGenericParameterTypes();
         for (int i = 0; i < paramTypes.length; i++) {
             Class paramType = paramTypes[i];
-            Type genericType = genericTypes[i];
-
-            
+            Type genericType = genericTypes[i];            
             initializeParameter(o, method, i, paramType, genericType);
         }
 
@@ -386,12 +384,13 @@
             initializeParameter(part, paramType, genericType);
             part.setIndex(i);
         } else if (isIn && isOut) {
-            QName name = getOutPartName(o, method, i);
+            QName name = getInPartName(o, method, i);
             part = o.getInput().getMessagePart(name);
             part.setProperty(ReflectionServiceFactoryBean.MODE_INOUT, 
Boolean.TRUE);
             initializeParameter(part, paramType, genericType);
             part.setIndex(i);
-
+            
+            name = getOutPartName(o, method, i); 
             part = o.getOutput().getMessagePart(name);
             part.setProperty(ReflectionServiceFactoryBean.MODE_INOUT, 
Boolean.TRUE);
             initializeParameter(part, paramType, genericType);

Added: 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java?view=auto&rev=538832
==============================================================================
--- 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java
 (added)
+++ 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java
 Thu May 17 01:28:45 2007
@@ -0,0 +1,67 @@
+/**
+ * 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.systest.jaxws;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ClientServerRPCLitDefatulAnnoTest extends 
AbstractClientServerTestBase {
+
+    public static class Server extends AbstractBusTestServerBase {
+
+        protected void run() {
+            Object implementor = new HelloImpl();
+            String address = "http://localhost:9090/hello";;
+            Endpoint.publish(address, implementor);
+        }
+
+        public static void main(String[] args) {
+            try {
+                Server s = new Server();
+                s.start();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                System.exit(-1);
+            } finally {
+                System.out.println("done!");
+            }
+        }
+    }
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", 
launchServer(Server.class));
+    }
+
+    @Test
+    public void testBasicConnection() throws Exception {
+        QName serviceName = new QName("http://cxf.apache.org/systest/jaxws/";, 
"HelloService");
+        HelloService service = new 
HelloService(getClass().getResource("/wsdl/hello.wsdl"), serviceName);
+        assertNotNull(service);
+        Hello hello = service.getHelloPort();
+        assertEquals("getSayHi", hello.sayHi("SayHi"));
+
+    }
+}

Added: 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Hello.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Hello.java?view=auto&rev=538832
==============================================================================
--- 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Hello.java
 (added)
+++ 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Hello.java
 Thu May 17 01:28:45 2007
@@ -0,0 +1,34 @@
+/**
+ * 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.systest.jaxws;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * This class was generated by the CXF 2.0-incubator-SNAPSHOT Thu May 17
+ * 12:06:33 CST 2007 Generated source version: 2.0-incubator-SNAPSHOT
+ */
[EMAIL PROTECTED](style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
[EMAIL PROTECTED](name = "Hello", targetNamespace = 
"http://http://cxf.apache.org/systest/jaxws";)
+public interface Hello {
+    @WebMethod(operationName = "sayHi", exclude = false)
+    String sayHi(String value);
+}

Added: 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java?view=auto&rev=538832
==============================================================================
--- 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
 (added)
+++ 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
 Thu May 17 01:28:45 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.systest.jaxws;
+import javax.jws.WebService;
+
+/**
+ * This class was generated by the CXF 2.0-incubator-SNAPSHOT Thu May 17
+ * 12:06:33 CST 2007 Generated source version: 2.0-incubator-SNAPSHOT
+ */
+
[EMAIL PROTECTED](name = "Hello", serviceName = "HelloService", portName = 
"HelloPort", 
+            targetNamespace = "http://cxf.apache.org/systest/jaxws/";, 
+            wsdlLocation = "testutils/hello.wsdl", 
+            endpointInterface = "org.apache.cxf.systest.jaxws.Hello")
+public class HelloImpl implements Hello {
+    public String sayHi(String arg0) {
+        return "get" + arg0;
+    }
+
+}

Added: 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloService.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloService.java?view=auto&rev=538832
==============================================================================
--- 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloService.java
 (added)
+++ 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloService.java
 Thu May 17 01:28:45 2007
@@ -0,0 +1,49 @@
+/**
+ * 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.systest.jaxws;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+/**
+ * This class was generated by the CXF 2.0-incubator-SNAPSHOT Thu May 17
+ * 12:06:33 CST 2007 Generated source version: 2.0-incubator-SNAPSHOT
+ */
+
[EMAIL PROTECTED](name = "HelloService", 
+                  targetNamespace = "http://cxf.apache.org/systest/jaxws/";, 
+                  wsdlLocation = "testutils/hello.wsdl")
+public class HelloService extends Service {
+    static final QName SERVICE = new 
QName("http://cxf.apache.org/systest/jaxws";, "HelloService");
+    static final QName HELLO_PORT = 
+        new QName("http://cxf.apache.org/systest/jaxws/";, "HelloPort");
+    public HelloService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    @WebEndpoint(name = "HelloPort")
+    public Hello getHelloPort() {
+        return (Hello)super.getPort(HELLO_PORT, Hello.class);
+    }
+
+}

Modified: 
incubator/cxf/trunk/testutils/src/main/resources/wsdl/header_rpc_lit.wsdl
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/header_rpc_lit.wsdl?view=diff&rev=538832&r1=538831&r2=538832
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/header_rpc_lit.wsdl 
(original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/header_rpc_lit.wsdl 
Thu May 17 01:28:45 2007
@@ -1,4 +1,22 @@
 <?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.
+-->
 <definitions name="soap_header" 
targetNamespace="http://apache.org/headers/rpc_lit"; 
xmlns="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:jms="http://cxf.apache.org/transports/jms"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:xformat="http://cxf.apache.org/bindings/xformat"; 
xmlns:tns="http://apache.org/headers/rpc_lit"; 
xmlns:x1="http://apache.org/headers/coloc/types"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
     <types>
         <schema targetNamespace="http://apache.org/headers/rpc_lit"; 
xmlns="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified">

Added: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello.wsdl
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello.wsdl?view=auto&rev=538832
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello.wsdl (added)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello.wsdl Thu May 17 
01:28:45 2007
@@ -0,0 +1,54 @@
+<?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 name="HelloService" 
targetNamespace="http://cxf.apache.org/systest/jaxws/"; 
xmlns:ns1="http://cxf.apache.org/systest/jaxws/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
+  <wsdl:message name="sayHi">
+    <wsdl:part name="arg0" type="xsd:string">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="sayHiResponse">
+    <wsdl:part name="return" type="xsd:string">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="Hello">
+    <wsdl:operation name="sayHi">
+      <wsdl:input name="sayHi" message="ns1:sayHi">
+    </wsdl:input>
+      <wsdl:output name="sayHiResponse" message="ns1:sayHiResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="HelloServiceSoapBinding" type="ns1:Hello">
+    <soap:binding style="rpc" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="sayHi">
+      <soap:operation soapAction="" style="rpc"/>
+      <wsdl:input name="sayHi">
+        <soap:body use="literal" 
namespace="http://cxf.apache.org/systest/jaxws/"/>
+      </wsdl:input>
+      <wsdl:output name="sayHiResponse">
+        <soap:body use="literal" 
namespace="http://cxf.apache.org/systest/jaxws/"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="HelloService">
+    <wsdl:port name="HelloPort" binding="ns1:HelloServiceSoapBinding">
+      <soap:address location="http://localhost:9090/hello"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions> 
\ No newline at end of file


Reply via email to