cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1100898 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/interceptor/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/ testutils/src/main/java/org/apache/header...
Date Mon, 09 May 2011 06:49:11 GMT
Author: ema
Date: Mon May  9 06:49:11 2011
New Revision: 1100898

URL: http://svn.apache.org/viewvc?rev=1100898&view=rev
Log:
[CXF-3502]:Fix IllegalArgumentException: wrong number of arguments with Dispatch/Provider
service

Added:
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ProviderHeaderClientServerTest.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/TestRPCHeaderProvider.java
    cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/
    cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloMsg.xml
    cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloResponseMsg.xml
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
    cxf/trunk/testutils/src/main/java/org/apache/header_test/rpc/TestRPCHeaderImpl.java
    cxf/trunk/testutils/src/main/resources/wsdl/soapheader_rpc.wsdl
    cxf/trunk/testutils/src/test/java/org/apache/cxf/testutils/header_test/rpc/TestRPCHeaderTest.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?rev=1100898&r1=1100897&r2=1100898&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
Mon May  9 06:49:11 2011
@@ -199,7 +199,13 @@ public class DocLiteralInInterceptor ext
                     }
     
                     o = dr.read(p, xmlReader);
-                    parameters.put(p, o);
+                    if (Boolean.TRUE.equals(si.getProperty("soap.force.doclit.bare")) 
+                        && parameters.isEmpty()) {
+                        // webservice provider does not need to ensure size
+                        parameters.add(o);
+                    } else {
+                        parameters.put(p, o);
+                    }
                     
                     paramNum++;
                     if (message.getContent(XMLStreamReader.class) == null || o == xmlReader)
{

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java?rev=1100898&r1=1100897&r2=1100898&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
Mon May  9 06:49:11 2011
@@ -259,7 +259,7 @@ public class HeaderClientServerTest exte
             header.setHeaderVal("header");
             
             for (int idx = 0; idx < 2; idx++) {
-                String returnVal = proxy.testHeader1("part", header);
+                String returnVal = proxy.testHeader1(header, "part");
                 assertNotNull(returnVal);
                 assertEquals("part/header", returnVal);
             }

Added: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ProviderHeaderClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ProviderHeaderClientServerTest.java?rev=1100898&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ProviderHeaderClientServerTest.java
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ProviderHeaderClientServerTest.java
Mon May  9 06:49:11 2011
@@ -0,0 +1,83 @@
+/**
+ * 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.header;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.AbstractJaxWsTest;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.header_test.rpc.SOAPRPCHeaderService;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ProviderHeaderClientServerTest extends AbstractJaxWsTest {
+
+    @Before
+    public void setUp() throws Exception {
+        BusFactory.setDefaultBus(getBus());
+
+        TestRPCHeaderProvider implementor = new TestRPCHeaderProvider();
+        String address = "http://localhost:9104/SoapHeaderRPCContext/SoapHeaderRPCPort";
+        EndpointImpl e = (EndpointImpl)Endpoint.publish(address, implementor);
+        e.getServer().getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
+        e.getServer().getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
+    }
+
+    @Test
+    public void testRPCInHeader() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/soapheader_rpc.wsdl");
+        assertNotNull(wsdl);
+
+        SOAPRPCHeaderService service = new SOAPRPCHeaderService(
+                                                                wsdl,
+                                                                new QName(
+                                                                          "http://apache.org/header_test/rpc",
+                                                                          "SOAPRPCHeaderService"));
+        assertNotNull(service);
+        Dispatch<SOAPMessage> dispatch = service
+            .createDispatch(new QName("http://apache.org/header_test/rpc", "SoapRPCHeaderPort"),
+                            javax.xml.soap.SOAPMessage.class, Service.Mode.MESSAGE);
+
+        MessageFactory factory = MessageFactory.newInstance();
+        InputStream is = getClass().getClassLoader()
+            .getResourceAsStream("./soapheader_rpc_provider/sayHelloMsg.xml");
+        SOAPMessage inMessage = factory.createMessage(null, is);
+        SOAPMessage response = dispatch.invoke(inMessage);
+        is.close();
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        response.writeTo(bout);
+        assertTrue(new String(bout.toByteArray()).contains("part/header"));
+
+    }
+
+}

Added: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/TestRPCHeaderProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/TestRPCHeaderProvider.java?rev=1100898&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/TestRPCHeaderProvider.java
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/TestRPCHeaderProvider.java
Mon May  9 06:49:11 2011
@@ -0,0 +1,57 @@
+/**
+ * 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.header;
+
+import java.io.InputStream;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+@WebServiceProvider(serviceName = "SOAPRPCHeaderService", 
+                    portName = "SoapRPCHeaderPort", 
+                    targetNamespace = "http://apache.org/header_test/rpc", 
+                    wsdlLocation = "testutils/soapheader_rpc.wsdl")
+@ServiceMode(value = Service.Mode.MESSAGE)
+public class TestRPCHeaderProvider implements Provider<SOAPMessage> {
+
+    private SOAPMessage helloResponse;
+
+    public TestRPCHeaderProvider() {
+
+        try {
+            MessageFactory factory = MessageFactory.newInstance();
+            InputStream is = getClass().getClassLoader()
+                .getResourceAsStream("./soapheader_rpc_provider/sayHelloResponseMsg.xml");
+            helloResponse = factory.createMessage(null, is);
+            is.close();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public SOAPMessage invoke(SOAPMessage request) {
+        return helloResponse;
+    }
+}

Added: cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloMsg.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloMsg.xml?rev=1100898&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloMsg.xml
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloMsg.xml
Mon May  9 06:49:11 2011
@@ -0,0 +1,30 @@
+<!--
+  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.
+-->
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+	<soap:Header>
+		<headerMessage xmlns="http://apache.org/header_test/rpc/types">
+			<headerVal>header</headerVal>
+		</headerMessage>
+	</soap:Header>
+	<soap:Body>
+		<ns1:testHeader1 xmlns:ns1="http://apache.org/header_test">
+			<in xmlns:ns2="http://apache.org/header_test/rpc/types">part</in>
+		</ns1:testHeader1>
+	</soap:Body>
+</soap:Envelope>
\ No newline at end of file

Added: cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloResponseMsg.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloResponseMsg.xml?rev=1100898&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloResponseMsg.xml
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloResponseMsg.xml
Mon May  9 06:49:11 2011
@@ -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.
+-->
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+	<soap:Body>
+		<ns1:testHeader1Response xmlns:ns1="http://apache.org/header_test">
+			<out xmlns:ns2="http://apache.org/header_test/rpc/types">part/header</out>
+		</ns1:testHeader1Response>
+	</soap:Body>
+</soap:Envelope>
\ No newline at end of file

Modified: cxf/trunk/testutils/src/main/java/org/apache/header_test/rpc/TestRPCHeaderImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/header_test/rpc/TestRPCHeaderImpl.java?rev=1100898&r1=1100897&r2=1100898&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/header_test/rpc/TestRPCHeaderImpl.java (original)
+++ cxf/trunk/testutils/src/main/java/org/apache/header_test/rpc/TestRPCHeaderImpl.java Mon
May  9 06:49:11 2011
@@ -32,7 +32,7 @@ import org.apache.header_test.rpc.types.
             
 public class TestRPCHeaderImpl implements TestRPCHeader {
 
-    public String testHeader1(String in, HeaderMessage inHeader) {
+    public String testHeader1(HeaderMessage inHeader, String in) {
         if (in == null || inHeader == null) {
             throw new IllegalArgumentException("TestHeader1 part not found.");
         }

Modified: cxf/trunk/testutils/src/main/resources/wsdl/soapheader_rpc.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/resources/wsdl/soapheader_rpc.wsdl?rev=1100898&r1=1100897&r2=1100898&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/resources/wsdl/soapheader_rpc.wsdl (original)
+++ cxf/trunk/testutils/src/main/resources/wsdl/soapheader_rpc.wsdl Mon May  9 06:49:11 2011
@@ -30,8 +30,8 @@
         </schema>
     </wsdl:types>
     <wsdl:message name="testHeader1Request">
-        <wsdl:part name="in" type="xsd:string"/>
         <wsdl:part name="inHeader" element="x1:headerMessage"/>
+        <wsdl:part name="in" type="xsd:string"/>       
     </wsdl:message>
     <wsdl:message name="testHeader1Response">
         <wsdl:part name="out" type="xsd:string"/>

Modified: cxf/trunk/testutils/src/test/java/org/apache/cxf/testutils/header_test/rpc/TestRPCHeaderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/test/java/org/apache/cxf/testutils/header_test/rpc/TestRPCHeaderTest.java?rev=1100898&r1=1100897&r2=1100898&view=diff
==============================================================================
--- cxf/trunk/testutils/src/test/java/org/apache/cxf/testutils/header_test/rpc/TestRPCHeaderTest.java
(original)
+++ cxf/trunk/testutils/src/test/java/org/apache/cxf/testutils/header_test/rpc/TestRPCHeaderTest.java
Mon May  9 06:49:11 2011
@@ -38,9 +38,9 @@ public class TestRPCHeaderTest extends A
             if ("testHeader1".equals(m.getName())) {
                 Annotation annotations[][] = m.getParameterAnnotations();
                 assertEquals(2, annotations.length);
-                assertEquals(1, annotations[1].length);
-                assertTrue(annotations[1][0] instanceof WebParam);
-                WebParam parm = (WebParam)annotations[1][0];
+                assertEquals(1, annotations[0].length);
+                assertTrue(annotations[0][0] instanceof WebParam);
+                WebParam parm = (WebParam)annotations[0][0];
                 assertEquals("http://apache.org/header_test/rpc/types", parm.targetNamespace());
                 assertEquals("inHeader", parm.partName());
                 assertEquals("headerMessage", parm.name());



Mime
View raw message