You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2006/11/02 15:25:08 UTC
svn commit: r470371 - in /incubator/cxf/trunk:
api/src/main/java/org/apache/cxf/service/model/
common/common/src/main/java/org/apache/cxf/common/util/
common/common/src/test/java/org/apache/cxf/common/util/
rt/core/src/main/java/org/apache/cxf/intercep...
Author: mmao
Date: Thu Nov 2 06:25:06 2006
New Revision: 470371
URL: http://svn.apache.org/viewvc?view=rev&rev=470371
Log:
HTTP GET update
* decoding only the value part
* check the parameter order, if required, re-order the parameter, and check the parameter name, if not matched throw faults.
* todo: add a configuration to enable the parameter checking.
Added:
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/CollectionUtils.java (with props)
incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/common/util/CollectionUtilsTest.java (with props)
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceModelUtilsTest.java (with props)
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLBareTest.java
incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/NotAnnotatedGreeterImplRPCLit.java
incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/RPCLitGreeterImpl.java
incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl
Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java?view=diff&rev=470371&r1=470370&r2=470371
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java Thu Nov 2 06:25:06 2006
@@ -19,11 +19,20 @@
package org.apache.cxf.service.model;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.xml.namespace.QName;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.service.Service;
+import org.apache.ws.commons.schema.XmlSchemaAnnotated;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaDatatype;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
public final class ServiceModelUtil {
@@ -71,4 +80,33 @@
}
return schemaInfo;
}
+
+ public static List<String> getOperationInputPartNames(OperationInfo operation) {
+ List<String> names = new ArrayList<String>();
+ List<MessagePartInfo> parts = operation.getInput().getMessageParts();
+ if (parts == null && parts.size() == 0) {
+ return names;
+ }
+
+ for (MessagePartInfo part : parts) {
+ XmlSchemaAnnotated schema = part.getXmlSchema();
+
+ if (schema instanceof XmlSchemaElement
+ && ((XmlSchemaElement)schema).getSchemaType() instanceof XmlSchemaComplexType) {
+ XmlSchemaElement element = (XmlSchemaElement)schema;
+ XmlSchemaComplexType cplxType = (XmlSchemaComplexType)element.getSchemaType();
+ XmlSchemaSequence seq = (XmlSchemaSequence)cplxType.getParticle();
+ if (seq == null || seq.getItems() == null) {
+ return names;
+ }
+ for (int i = 0; i < seq.getItems().getCount(); i++) {
+ XmlSchemaElement elChild = (XmlSchemaElement)seq.getItems().getItem(i);
+ names.add(elChild.getName());
+ }
+ } else {
+ names.add(part.getConcreteName().getLocalPart());
+ }
+ }
+ return names;
+ }
}
Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/CollectionUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/CollectionUtils.java?view=auto&rev=470371
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/CollectionUtils.java (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/CollectionUtils.java Thu Nov 2 06:25:06 2006
@@ -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.common.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+public final class CollectionUtils {
+ private CollectionUtils() {
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Collection diff(Collection c1, Collection c2) {
+ if (c1 == null || c1.size() == 0 || c2 == null || c2.size() == 0) {
+ return c1;
+ }
+ Collection difference = new ArrayList();
+ for (Object item : c1) {
+ if (!c2.contains(item)) {
+ difference.add(item);
+ }
+ }
+ return difference;
+ }
+
+ public static boolean isEmpty(Collection c) {
+ if (c == null || c.size() == 0) {
+ return true;
+ }
+ for (Iterator iter = c.iterator(); iter.hasNext();) {
+ if (iter.next() != null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/CollectionUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/CollectionUtils.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/common/util/CollectionUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/common/util/CollectionUtilsTest.java?view=auto&rev=470371
==============================================================================
--- incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/common/util/CollectionUtilsTest.java (added)
+++ incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/common/util/CollectionUtilsTest.java Thu Nov 2 06:25:06 2006
@@ -0,0 +1,53 @@
+/**
+ * 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.common.util;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+public class CollectionUtilsTest extends TestCase {
+
+ public void testDiff() throws Exception {
+ List l1 = Arrays.asList(new String[]{"1", "2", "3"});
+ List l2 = Arrays.asList(new String[]{"2", "4", "5"});
+ Collection l3 = CollectionUtils.diff(l1, l2);
+ assertTrue(l3.size() == 2);
+ assertTrue(l3.contains("1"));
+ assertTrue(l3.contains("3"));
+
+ l3 = CollectionUtils.diff(l1, null);
+ assertTrue(l3.size() == 3);
+ assertTrue(l3.contains("1"));
+ assertTrue(l3.contains("2"));
+ assertTrue(l3.contains("3"));
+
+ l3 = CollectionUtils.diff(null, null);
+ assertNull(l3);
+ }
+
+ public void testIsEmpty() throws Exception {
+ List l = Arrays.asList(new String[]{null, null});
+ assertNotNull(l);
+ assertTrue(CollectionUtils.isEmpty(l));
+ }
+}
Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/common/util/CollectionUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/common/util/CollectionUtilsTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties?view=diff&rev=470371&r1=470370&r2=470371
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties Thu Nov 2 06:25:06 2006
@@ -28,3 +28,4 @@
COULD_NOT_UNRWAP=Could not unrwap message parts.
COULD_NOT_SEND=Could not send Message.
NO_PART_FOUND=Message part {0} was not recognized.
+ORDERED_PARAM_REQUIRED=Parameter should be ordered in the following sequence: {0}
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java?view=diff&rev=470371&r1=470370&r2=470371
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java Thu Nov 2 06:25:06 2006
@@ -25,6 +25,8 @@
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -34,6 +36,7 @@
import javax.jws.WebParam;
import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.util.CollectionUtils;
import org.apache.cxf.common.util.PrimitiveUtils;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.message.Message;
@@ -41,6 +44,7 @@
import org.apache.cxf.service.Service;
import org.apache.cxf.service.factory.MethodDispatcher;
import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.OperationInfo;
import org.apache.cxf.service.model.ServiceModelUtil;
public class URIMappingInterceptor extends AbstractInDatabindingInterceptor {
@@ -107,11 +111,63 @@
return false;
}
+ private boolean requireCheckParameterName(Message message) {
+ // TODO add a configuration, if return false, then the parameter should be given by order.
+ Boolean order = (Boolean) message.get("HTTP_GET_CHECK_PARAM_NAME");
+ return order != null && order;
+ }
+
+ protected Map<String, String> keepInOrder(Map<String, String> params,
+ OperationInfo operation,
+ List<String> order) {
+ if (params == null || params.size() == 0) {
+ return params;
+ }
+
+ if (order == null || order.size() == 0) {
+ return params;
+ }
+
+ Map<String, String> orderedParameters = new LinkedHashMap<String, String>();
+ for (String name : order) {
+ orderedParameters.put(name, params.get(name));
+ }
+
+ if (order.size() != params.size()) {
+ LOG.info(order.size()
+ + " parameters definded in WSDL but found "
+ + params.size() + " in request!");
+ Collection rest = CollectionUtils.diff(order, params.keySet());
+ if (rest != null && rest.size() > 0) {
+ LOG.info("Set the following parameters to null: " + rest);
+ for (Iterator iter = rest.iterator(); iter.hasNext();) {
+ String key = (String)iter.next();
+ orderedParameters.put(key, null);
+ }
+ }
+ }
+
+ return orderedParameters;
+ }
+
protected List<Object> getParameters(Message message, BindingOperationInfo operation) {
List<Object> parameters = new ArrayList<Object>();
int idx = parameters.size();
- Map<String, String> queries = getQueries(message);
+ Map<String, String> queries = getQueries(message);
+
+ if (requireCheckParameterName(message)) {
+ boolean emptyQueries = CollectionUtils.isEmpty(queries.keySet());
+ List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
+ queries = keepInOrder(queries,
+ operation.getOperationInfo(),
+ names);
+ if (!emptyQueries && CollectionUtils.isEmpty(queries.keySet())) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message("ORDERED_PARAM_REQUIRED",
+ BUNDLE,
+ names.toString()));
+ }
+ }
Method method = getMethod(message, operation);
@@ -134,16 +190,14 @@
// TODO check the parameter name here
Object param = null;
- if (type != null && type.isPrimitive()) {
+ if (type != null && type.isPrimitive() && queries.get(key) != null) {
param = PrimitiveUtils.read(queries.get(key), type);
} else {
param = queries.get(key);
}
- if (param != null) {
- parameters.add(param);
- } else {
- throw new RuntimeException(type.getName() + " can not be unmarshalled");
- }
+
+ parameters.add(param);
+
idx = parameters.size();
}
return parameters;
@@ -161,12 +215,11 @@
protected Map<String, String> getQueries(Message message) {
Map<String, String> queries = new LinkedHashMap<String, String>();
String query = (String)message.get(Message.QUERY_STRING);
- if (!StringUtils.isEmpty(query)) {
- query = uriDecode(query);
+ if (!StringUtils.isEmpty(query)) {
List<String> parts = Arrays.asList(query.split("&"));
for (String part : parts) {
String[] keyValue = part.split("=");
- queries.put(keyValue[0], keyValue[1]);
+ queries.put(keyValue[0], uriDecode(keyValue[1]));
}
return queries;
}
Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceModelUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceModelUtilsTest.java?view=auto&rev=470371
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceModelUtilsTest.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceModelUtilsTest.java Thu Nov 2 06:25:06 2006
@@ -0,0 +1,148 @@
+/**
+ * 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;
+
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.calculator.CalculatorImpl;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.EndpointException;
+import org.apache.cxf.endpoint.EndpointImpl;
+import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceModelUtil;
+import org.apache.hello_world_soap_http.GreeterImpl;
+import org.apache.hello_world_soap_http.RPCLitGreeterImpl;
+
+public class ServiceModelUtilsTest extends AbstractJaxWsTest {
+
+ Message message;
+ Exchange exchange;
+ JaxWsServiceFactoryBean bean;
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ message = new MessageImpl();
+ exchange = new ExchangeImpl();
+ message.setExchange(exchange);
+
+ bean = new JaxWsServiceFactoryBean();
+ bean.setBus(getBus());
+ }
+
+ private Service getService(URL wsdl, Class implClz, QName port) throws EndpointException {
+ assertNotNull(wsdl);
+ bean.setWsdlURL(wsdl);
+ bean.setServiceClass(implClz);
+ Service service = bean.create();
+ EndpointInfo endpointInfo = service.getServiceInfo().getEndpoint(port);
+ Endpoint endpoint = new EndpointImpl(getBus(), service, endpointInfo);
+ exchange.put(Service.class, service);
+ exchange.put(Endpoint.class, endpoint);
+ return service;
+ }
+
+ public void testGetOperationInputPartNamesWrapped() throws Exception {
+ getService(getClass().getResource("/wsdl/hello_world.wsdl"),
+ GreeterImpl.class,
+ new QName("http://apache.org/hello_world_soap_http", "SoapPort"));
+
+ BindingOperationInfo operation = ServiceModelUtil.getOperation(message.getExchange(), "greetMe");
+ assertNotNull(operation);
+ List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
+ assertNotNull(names);
+ assertEquals(1, names.size());
+ assertEquals("requestType", names.get(0));
+
+ operation = ServiceModelUtil.getOperation(message.getExchange(), "sayHi");
+ assertNotNull(operation);
+ names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
+ assertNotNull(names);
+ assertEquals(0, names.size());
+ }
+
+ public void testGetOperationInputPartNamesWrapped2() throws Exception {
+ getService(getClass().getResource("/wsdl/calculator.wsdl"),
+ CalculatorImpl.class,
+ new QName("http://apache.org/cxf/calculator", "CalculatorPort"));
+
+ BindingOperationInfo operation = ServiceModelUtil.getOperation(message.getExchange(), "add");
+ assertNotNull(operation);
+ List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
+ assertNotNull(names);
+ assertEquals(2, names.size());
+ assertEquals("arg0", names.get(0));
+ assertEquals("arg1", names.get(1));
+ }
+
+ public void testGetOperationInputPartNamesBare() throws Exception {
+ getService(getClass().getResource("/wsdl/hello_world_xml_bare.wsdl"),
+ org.apache.hello_world_xml_http.bare.GreeterImpl.class,
+ new QName("http://apache.org/hello_world_xml_http/bare", "XMLPort"));
+ BindingOperationInfo operation = ServiceModelUtil.getOperation(message.getExchange(), "greetMe");
+ assertNotNull(operation);
+ List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
+ assertNotNull(names);
+ assertEquals(1, names.size());
+ assertEquals("requestType", names.get(0));
+
+ operation = ServiceModelUtil.getOperation(message.getExchange(), "sayHi");
+ assertNotNull(operation);
+ names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
+ assertNotNull(names);
+ assertEquals(0, names.size());
+ }
+
+
+ public void testGetOperationInputPartNamesRpc() throws Exception {
+ getService(getClass().getResource("/wsdl/hello_world_rpc_lit.wsdl"),
+ RPCLitGreeterImpl.class,
+ new QName("http://apache.org/hello_world_rpclit", "SoapPortRPCLit"));
+ BindingOperationInfo operation = ServiceModelUtil.getOperation(message.getExchange(), "greetMe");
+ assertNotNull(operation);
+ List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
+ assertNotNull(names);
+ assertEquals(1, names.size());
+ assertEquals("in", names.get(0));
+
+ operation = ServiceModelUtil.getOperation(message.getExchange(), "sayHi");
+ assertNotNull(operation);
+ names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
+ assertNotNull(names);
+ assertEquals(0, names.size());
+
+ operation = ServiceModelUtil.getOperation(message.getExchange(), "greetUs");
+ assertNotNull(operation);
+ names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
+ assertNotNull(names);
+ assertEquals(2, names.size());
+ System.err.println(names);
+ }
+}
Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceModelUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceModelUtilsTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java?view=diff&rev=470371&r1=470370&r2=470371
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java Thu Nov 2 06:25:06 2006
@@ -103,7 +103,7 @@
public void testGetAddFromQuery() throws Exception {
message.put(Message.PATH_INFO, "/CalculatorService/SoapPort/add");
- message.put(Message.QUERY_STRING, "?arg0=1&arg0=2");
+ message.put(Message.QUERY_STRING, "arg0=1&arg1=2");
URIMappingInterceptor interceptor = new URIMappingInterceptor();
interceptor.handleMessage(message);
@@ -114,9 +114,45 @@
assertNotNull(parameters);
assertEquals(2, ((List)parameters).size());
- Integer value = (Integer) ((List)parameters).get(0);
+ Integer value = (Integer) ((List)parameters).get(0);
assertEquals(1, value.intValue());
value = (Integer) ((List)parameters).get(1);
assertEquals(2, value.intValue());
}
+
+ public void testGetAddFromQueryOrdered() throws Exception {
+ message.put("HTTP_GET_CHECK_PARAM_NAME", Boolean.TRUE);
+ message.put(Message.PATH_INFO, "/CalculatorService/SoapPort/add");
+ message.put(Message.QUERY_STRING, "arg1=0&arg0=1");
+
+ URIMappingInterceptor interceptor = new URIMappingInterceptor();
+ interceptor.handleMessage(message);
+
+ assertNull(message.getContent(Exception.class));
+
+ Object parameters = message.getContent(List.class);
+ assertNotNull(parameters);
+ assertEquals(2, ((List)parameters).size());
+
+ Integer value = (Integer) ((List)parameters).get(0);
+ assertEquals(1, value.intValue());
+ value = (Integer) ((List)parameters).get(1);
+ assertEquals(0, value.intValue());
+ }
+
+ public void testGetAddFromQueryOrderedNull() throws Exception {
+ message.put("HTTP_GET_CHECK_PARAM_NAME", Boolean.TRUE);
+ message.put(Message.PATH_INFO, "/CalculatorService/SoapPort/add");
+ message.put(Message.QUERY_STRING, "one=1&two=2");
+
+ URIMappingInterceptor interceptor = new URIMappingInterceptor();
+ interceptor.handleMessage(message);
+ assertNull(message.getContent(Exception.class));
+ Object parameters = message.getContent(List.class);
+ assertNotNull(parameters);
+ assertEquals(2, ((List)parameters).size());
+
+ assertNull(((List)parameters).get(0));
+ assertNull(((List)parameters).get(1));
+ }
}
Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?view=diff&rev=470371&r1=470370&r2=470371
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Thu Nov 2 06:25:06 2006
@@ -517,7 +517,7 @@
public void testGetGreetMe() throws Exception {
HttpURLConnection httpConnection =
- getHttpConnection("http://localhost:9000/SoapContext/SoapPort/greetMe/me/cxf");
+ getHttpConnection("http://localhost:9000/SoapContext/SoapPort/greetMe/requestType/cxf");
httpConnection.connect();
assertEquals(200, httpConnection.getResponseCode());
@@ -544,8 +544,8 @@
}
public void testGetGreetMeFromQuery() throws Exception {
- String url = "http://localhost:9000/SoapContext/SoapPort/greetMe?"
- + URLEncoder.encode("me=cxf (was CeltixFire)", "UTF-8");
+ String url = "http://localhost:9000/SoapContext/SoapPort/greetMe?requestType="
+ + URLEncoder.encode("cxf (was CeltixFire)", "UTF-8");
HttpURLConnection httpConnection = getHttpConnection(url);
httpConnection.connect();
Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLBareTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLBareTest.java?view=diff&rev=470371&r1=470370&r2=470371
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLBareTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLBareTest.java Thu Nov 2 06:25:06 2006
@@ -119,7 +119,7 @@
public void testGetGreetMe() throws Exception {
HttpURLConnection httpConnection =
- getHttpConnection("http://localhost:9031/XMLService/XMLPort/greetMe/me/cxf");
+ getHttpConnection("http://localhost:9031/XMLService/XMLPort/greetMe/requestType/cxf");
httpConnection.connect();
assertEquals(200, httpConnection.getResponseCode());
Modified: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/NotAnnotatedGreeterImplRPCLit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/NotAnnotatedGreeterImplRPCLit.java?view=diff&rev=470371&r1=470370&r2=470371
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/NotAnnotatedGreeterImplRPCLit.java (original)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/NotAnnotatedGreeterImplRPCLit.java Thu Nov 2 06:25:06 2006
@@ -36,4 +36,8 @@
public MyComplexStruct sendReceiveData(MyComplexStruct in) {
return in;
}
+
+ public String greetUs(String you, String me) {
+ return "Hello " + you + " and " + me;
+ }
}
Modified: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/RPCLitGreeterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/RPCLitGreeterImpl.java?view=diff&rev=470371&r1=470370&r2=470371
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/RPCLitGreeterImpl.java (original)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/RPCLitGreeterImpl.java Thu Nov 2 06:25:06 2006
@@ -51,5 +51,11 @@
return in;
}
+ public String greetUs(String you, String me) {
+ System.out.println("Executing operation greetUs");
+ System.out.println("Message received: you are " + you + " I'm " + me + "\n");
+ return "Hello " + you + " and " + me;
+ }
+
}
Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl?view=diff&rev=470371&r1=470370&r2=470371
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl (original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl Thu Nov 2 06:25:06 2006
@@ -54,6 +54,15 @@
<wsdl:message name="greetMeResponse">
<wsdl:part type="xsd:string" name="out" />
</wsdl:message>
+
+ <wsdl:message name="greetUsRequest">
+ <wsdl:part type="xsd:string" name="you" />
+ <wsdl:part type="xsd:string" name="me" />
+ </wsdl:message>
+
+ <wsdl:message name="greetUsResponse">
+ <wsdl:part type="xsd:string" name="out" />
+ </wsdl:message>
<wsdl:message name="sendReceiveDataRequest">
<wsdl:part type="x1:myComplexStruct" name="in" />
@@ -81,6 +90,12 @@
<wsdl:output message="tns:sendReceiveDataResponse"
name="SendReceiveDataResponse" />
</wsdl:operation>
+ <wsdl:operation name="greetUs">
+ <wsdl:input message="tns:greetUsRequest"
+ name="greetUsRequest" />
+ <wsdl:output message="tns:greetUsResponse"
+ name="greetUsResponse" />
+ </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Greeter_SOAPBinding_RPCLit"
@@ -102,6 +117,18 @@
</wsdl:operation>
<wsdl:operation name="greetMe">
+ <soap:operation soapAction="" style="rpc" />
+ <wsdl:input>
+ <soap:body
+ namespace="http://apache.org/hello_world_rpclit" use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://apache.org/hello_world_rpclit" use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetUs">
<soap:operation soapAction="" style="rpc" />
<wsdl:input>
<soap:body