cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject git commit: [CXF-5676] IllegalArgumentException: wrong number of arguments while invoking operation with only an implicit header parameter
Date Tue, 15 Apr 2014 12:14:42 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 0e3b153fb -> 8a9cd932d


[CXF-5676] IllegalArgumentException: wrong number of arguments while invoking operation with
only an implicit header parameter


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8a9cd932
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8a9cd932
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8a9cd932

Branch: refs/heads/2.7.x-fixes
Commit: 8a9cd932d76dd40b583e63ec110ea270a607d22f
Parents: 0e3b153
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Mon Apr 14 19:46:31 2014 +0200
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Tue Apr 15 14:12:35 2014 +0200

----------------------------------------------------------------------
 .../cxf/binding/soap/SoapBindingFactory.java    |  31 ++--
 systests/uncategorized/pom.xml                  |   4 +
 .../ExtSoapHeaderClientServerTest.java          | 163 +++++++++++++++++++
 .../soapheader_ext/SamplePortTypeImpl.java      |  38 +++++
 .../resources/wsdl_systest/soap_ext_header.wsdl | 104 ++++++++++++
 5 files changed, 323 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/8a9cd932/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
index 8438474..aa4e0a5 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
@@ -593,29 +593,26 @@ public class SoapBindingFactory extends AbstractBindingFactory {
         }
         
         nextId = 0;
-        minfo = unwrapped.getInput();
-        if (minfo != null) {
-            for (MessagePartInfo part : minfo.getMessageParts()) {
-                if (part.getIndex() >= nextId) {
-                    nextId = part.getIndex() + 1;
-                }
-            }
-        }
-        minfo = unwrapped.getOutput();
-        if (minfo != null) {
-            for (MessagePartInfo part : minfo.getMessageParts()) {
-                if (part.getIndex() >= nextId) {
-                    nextId = part.getIndex() + 1;
-                }
-            }
-        }
-        
         if (isInput) {
             minfo = unwrapped.getInput();
             type = MessageInfo.Type.INPUT;
+            if (minfo != null) {
+                for (MessagePartInfo part : minfo.getMessageParts()) {
+                    if (part.getIndex() >= nextId) {
+                        nextId = part.getIndex() + 1;
+                    }
+                }
+            }
         } else {
             minfo = unwrapped.getOutput();
             type = MessageInfo.Type.OUTPUT;
+            if (minfo != null) {
+                for (MessagePartInfo part : minfo.getMessageParts()) {
+                    if (part.getIndex() >= nextId) {
+                        nextId = part.getIndex() + 1;
+                    }
+                }
+            }
         }
 
         if (minfo == null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/8a9cd932/systests/uncategorized/pom.xml
----------------------------------------------------------------------
diff --git a/systests/uncategorized/pom.xml b/systests/uncategorized/pom.xml
index ff91995..ea24653 100644
--- a/systests/uncategorized/pom.xml
+++ b/systests/uncategorized/pom.xml
@@ -58,6 +58,10 @@
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest/soap_fault.wsdl</wsdl>
                                     <catalog>${basedir}/src/test/resources/wsdl_systest/catalog.xml</catalog>
                                 </wsdlOption>
+                                <wsdlOption>
+                                    <wsdl>${basedir}/src/test/resources/wsdl_systest/soap_ext_header.wsdl</wsdl>
+                                    <ExtendedSoapHeaders>true</ExtendedSoapHeaders>
+                                </wsdlOption>
                             </wsdlOptions>
                         </configuration>
                         <goals>

http://git-wip-us.apache.org/repos/asf/cxf/blob/8a9cd932/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader_ext/ExtSoapHeaderClientServerTest.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader_ext/ExtSoapHeaderClientServerTest.java
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader_ext/ExtSoapHeaderClientServerTest.java
new file mode 100644
index 0000000..dcffe3f
--- /dev/null
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader_ext/ExtSoapHeaderClientServerTest.java
@@ -0,0 +1,163 @@
+/**
+ * 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.soapheader_ext;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceClient;
+
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.soap_ext_header.audit.Audit;
+import org.apache.cxf.soap_ext_header.ws.SamplePortType;
+import org.apache.cxf.soap_ext_header.ws.SampleService;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ExtSoapHeaderClientServerTest extends AbstractBusClientServerTestBase {    
+    public static final String PORT0 = allocatePort(Server.class, 0);
+    public static final String PORT1 = allocatePort(Server.class, 1);
+    
+    private static SamplePortType client;
+    private static org.apache.cxf.endpoint.Server extserver;
+    
+    private static final QName SERVIVE_NAME = new QName("http://cxf.apache.org/soap_ext_header/ws",
"SampleService");
+    
+    public static class Server extends AbstractBusTestServerBase {
+        
+        protected void run() {
+            String address0 = "http://localhost:" + PORT0 + "/SoapExtHeader/SampleService";
+
+            Object implementor1 = new SamplePortTypeImpl();
+            Endpoint.publish(address0, implementor1);
+            
+            String address1 = "http://localhost:" + PORT1 + "/SoapExtHeader/SampleService";
+            JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
+            sf.setServiceClass(SamplePortTypeImpl.class);
+            
+            WebServiceClient webService = SampleService.class.getAnnotation(WebServiceClient.class);
+            sf.setServiceName(new QName(webService.targetNamespace(), webService.name()));
+            sf.setWsdlLocation(webService.wsdlLocation());
+            sf.setAddress(address1);
+
+            extserver = sf.create();
+        }
+
+        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 {
+        createStaticBus();
+        assertTrue("server did not launch correctly", launchServer(Server.class, true));
+        
+        initClient();
+    }
+    
+    @AfterClass
+    public static void tearDownExtServer() throws Exception {
+        if (extserver != null) {
+            extserver.stop();
+            extserver.destroy();
+        }
+    }
+
+    private static void initClient() {
+        URL wsdl = ExtSoapHeaderClientServerTest.class.getResource("/wsdl_systest/soap_ext_header.wsdl");
+        assertNotNull("WSDL is null", wsdl);
+
+        SampleService service = new SampleService(wsdl, SERVIVE_NAME);
+        
+        assertNotNull("Service is null ", service);
+        client = service.getSamplePort();
+    }
+
+    @Test
+    public void testWithArg() throws Exception {
+        testWithArg(PORT0);
+    }
+
+    @Test
+    public void testWithArgWSDL() throws Exception {
+        testWithArg(PORT1);
+    }
+
+    @Test
+    public void testWithNoArg() throws Exception {
+        testWithNoArg(PORT0);
+    }
+    
+    @Test
+    public void testWithNoArgWSDL() throws Exception {
+        testWithNoArg(PORT1);
+    }
+
+    private void testWithArg(String port) throws Exception {
+
+        updateAddressPort(client, port);
+
+        Audit audit = createAudit();
+        
+        List<String> res = client.singleArg(Arrays.asList("Hello"), audit);
+        assertEquals(1, res.size());
+
+        assertEquals("jerry", res.get(0));
+    }
+
+    private void testWithNoArg(String port) throws Exception {
+
+        updateAddressPort(client, port);
+
+        Audit audit = createAudit();
+        
+        List<String> res = client.noArgs(audit);
+        assertEquals(1, res.size());
+
+        assertEquals("george", res.get(0));
+    }
+    
+    private Audit createAudit() {
+        Audit audit = new Audit();
+        audit.setMessageId("m1");
+        audit.setSender("s1");
+        return audit;
+    }
+    
+}
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/8a9cd932/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader_ext/SamplePortTypeImpl.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader_ext/SamplePortTypeImpl.java
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader_ext/SamplePortTypeImpl.java
new file mode 100644
index 0000000..c67ed0c
--- /dev/null
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader_ext/SamplePortTypeImpl.java
@@ -0,0 +1,38 @@
+/**
+ * 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.soapheader_ext;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.cxf.soap_ext_header.audit.Audit;
+import org.apache.cxf.soap_ext_header.ws.SamplePortType;
+
+
+public class SamplePortTypeImpl implements SamplePortType {
+    public List<String> singleArg(List<String> foo, Audit auditHeader) {
+        return Arrays.asList("jerry");
+    }
+
+    public List<String> noArgs(Audit auditHeader) {
+        return Arrays.asList("george");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/8a9cd932/systests/uncategorized/src/test/resources/wsdl_systest/soap_ext_header.wsdl
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/resources/wsdl_systest/soap_ext_header.wsdl b/systests/uncategorized/src/test/resources/wsdl_systest/soap_ext_header.wsdl
new file mode 100644
index 0000000..1393aea
--- /dev/null
+++ b/systests/uncategorized/src/test/resources/wsdl_systest/soap_ext_header.wsdl
@@ -0,0 +1,104 @@
+<?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 xmlns:types="http://cxf.apache.org/soap_ext_header/types" xmlns:audit="http://cxf.apache.org/soap_ext_header/audit"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://cxf.apache.org/soap_ext_header/ws"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://cxf.apache.org/soap_ext_header/ws" name="SampleService">
+    <wsdl:types>
+        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://cxf.apache.org/soap_ext_header/audit">
+            <xsd:element name="Audit">
+	<xsd:complexType>
+	    <xsd:sequence>
+	        <xsd:element name="messageId" type="xsd:string"/>
+	        <xsd:element name="sender" type="xsd:string"/>
+	    </xsd:sequence>
+	</xsd:complexType>
+            </xsd:element>
+        </xsd:schema>
+        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://cxf.apache.org/soap_ext_header/types">
+            <xsd:element name="NoArgsResponse" type="types:BarType"/>
+            <xsd:element name="NoArgs">
+	<xsd:complexType>
+	    <xsd:sequence />
+	</xsd:complexType>
+            </xsd:element>
+            
+            <xsd:element name="SingleArgResponse" type="types:BarType"/>
+            <xsd:element name="SingleArg" type="types:FooType"/>
+            <xsd:complexType name="BarType">
+	<xsd:sequence>
+	    <xsd:element name="Bar" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+	</xsd:sequence>
+            </xsd:complexType>
+            <xsd:complexType name="FooType">
+	<xsd:sequence>
+	    <xsd:element name="Foo" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+	</xsd:sequence>
+            </xsd:complexType>
+        </xsd:schema>
+    </wsdl:types>
+    <wsdl:message name="AuditHeader">
+        <wsdl:part name="AuditHeader" element="audit:Audit"/>
+    </wsdl:message>
+    <wsdl:message name="NoArgs">
+        <wsdl:part name="NoArgs" element="types:NoArgs"/>
+    </wsdl:message>
+    <wsdl:message name="NoArgsResponse">
+        <wsdl:part name="NoArgsResponse" element="types:NoArgsResponse"/>
+    </wsdl:message>
+    <wsdl:message name="SingleArg">
+        <wsdl:part name="SingleArg" element="types:SingleArg"/>
+    </wsdl:message>
+    <wsdl:message name="SingleArgResponse">
+        <wsdl:part name="SingleArgResponse" element="types:SingleArgResponse"/>
+    </wsdl:message>
+    <wsdl:portType name="SamplePortType">
+        <wsdl:operation name="NoArgs">
+            <wsdl:input message="tns:NoArgs"/>
+            <wsdl:output message="tns:NoArgsResponse"/>
+        </wsdl:operation>
+        <wsdl:operation name="SingleArg">
+            <wsdl:input message="tns:SingleArg"/>
+            <wsdl:output message="tns:SingleArgResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="SampleSoapBinding" type="tns:SamplePortType">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="NoArgs">
+            <soap:operation soapAction="http://cxf.apache.org/soap_ext_header/ws/NoArgs"
style="document"/>
+            <wsdl:input>
+	<soap:header message="tns:AuditHeader" part="AuditHeader" use="literal"/>
+	<soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output />
+        </wsdl:operation>
+        <wsdl:operation name="SingleArg">
+            <soap:operation
+		soapAction="http://cxf.apache.org/soap_ext_header/ws/SingleArg" style="document"/>
+            <wsdl:input>
+	<soap:header message="tns:AuditHeader" part="AuditHeader" use="literal"/>
+	<soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output />
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="SampleService">
+        <wsdl:port name="SamplePort" binding="tns:SampleSoapBinding">
+            <soap:address location="http://localhost:9013/SoapExtHeader/SampleService"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>


Mime
View raw message