Author: jim.ma
Date: 2011-08-16 07:18:49 -0400 (Tue, 16 Aug 2011)
New Revision: 14876
Added:
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ProviderHeaderClientServerTest.java
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/TestRPCHeaderProvider.java
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloMsg.xml
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloResponseMsg.xml
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/main/java/org/apache/header_test/rpc/TestRPCHeaderImpl.java
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/main/resources/wsdl/soapheader_rpc.wsdl
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/test/java/org/apache/cxf/testutils/header_test/rpc/TestRPCHeaderTest.java
Log:
[JBPAPP-6479]:CXF 'invalid parameter' when invoking a BPEL process that uses
header based correlation
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java 2011-08-16
11:16:45 UTC (rev 14875)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java 2011-08-16
11:18:49 UTC (rev 14876)
@@ -196,7 +196,13 @@
}
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:
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java 2011-08-16
11:16:45 UTC (rev 14875)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java 2011-08-16
11:18:49 UTC (rev 14876)
@@ -259,7 +259,7 @@
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:
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ProviderHeaderClientServerTest.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ProviderHeaderClientServerTest.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ProviderHeaderClientServerTest.java 2011-08-16
11:18:49 UTC (rev 14876)
@@ -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:
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/TestRPCHeaderProvider.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/TestRPCHeaderProvider.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/TestRPCHeaderProvider.java 2011-08-16
11:18:49 UTC (rev 14876)
@@ -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:
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloMsg.xml
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloMsg.xml
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloMsg.xml 2011-08-16
11:18:49 UTC (rev 14876)
@@ -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<...
+ </ns1:testHeader1>
+ </soap:Body>
+</soap:Envelope>
\ No newline at end of file
Added:
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloResponseMsg.xml
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloResponseMsg.xml
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/test/resources/soapheader_rpc_provider/sayHelloResponseMsg.xml 2011-08-16
11:18:49 UTC (rev 14876)
@@ -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/hea...
+ </ns1:testHeader1Response>
+ </soap:Body>
+</soap:Envelope>
\ No newline at end of file
Modified:
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/main/java/org/apache/header_test/rpc/TestRPCHeaderImpl.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/main/java/org/apache/header_test/rpc/TestRPCHeaderImpl.java 2011-08-16
11:16:45 UTC (rev 14875)
+++
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/main/java/org/apache/header_test/rpc/TestRPCHeaderImpl.java 2011-08-16
11:18:49 UTC (rev 14876)
@@ -32,7 +32,7 @@
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:
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/main/resources/wsdl/soapheader_rpc.wsdl
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/main/resources/wsdl/soapheader_rpc.wsdl 2011-08-16
11:16:45 UTC (rev 14875)
+++
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/main/resources/wsdl/soapheader_rpc.wsdl 2011-08-16
11:18:49 UTC (rev 14876)
@@ -29,9 +29,9 @@
</element>
</schema>
</wsdl:types>
- <wsdl:message name="testHeader1Request">
+ <wsdl:message name="testHeader1Request">
+ <wsdl:part name="inHeader"
element="x1:headerMessage"/>
<wsdl:part name="in" type="xsd:string"/>
- <wsdl:part name="inHeader"
element="x1:headerMessage"/>
</wsdl:message>
<wsdl:message name="testHeader1Response">
<wsdl:part name="out" type="xsd:string"/>
Modified:
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/test/java/org/apache/cxf/testutils/header_test/rpc/TestRPCHeaderTest.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/test/java/org/apache/cxf/testutils/header_test/rpc/TestRPCHeaderTest.java 2011-08-16
11:16:45 UTC (rev 14875)
+++
thirdparty/cxf/branches/cxf-2.2.12/testutils/src/test/java/org/apache/cxf/testutils/header_test/rpc/TestRPCHeaderTest.java 2011-08-16
11:18:49 UTC (rev 14876)
@@ -38,9 +38,9 @@
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());