wise SVN: r527 - core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-24 13:16:31 -0500 (Sun, 24 Feb 2013)
New Revision: 527
Modified:
core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/WSMethodImpl.java
Log:
Minor logging issue
Modified: core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/WSMethodImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/WSMethodImpl.java 2013-02-19 15:52:17 UTC (rev 526)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/WSMethodImpl.java 2013-02-24 18:16:31 UTC (rev 527)
@@ -34,6 +34,8 @@
import javax.jws.WebParam;
import net.jcip.annotations.Immutable;
import net.jcip.annotations.ThreadSafe;
+
+import org.apache.log4j.Logger;
import org.jboss.wise.core.client.InvocationResult;
import org.jboss.wise.core.client.WSEndpoint;
import org.jboss.wise.core.client.WSMethod;
@@ -89,8 +91,7 @@
}
} catch (Exception ite) {
- System.out.print("error invoking:" + this.getMethod());
- System.out.print("error invoking:" + args.values().toArray());
+ Logger.getLogger(WSMethodImpl.class).info("Error invoking method " + this.getMethod() + ", arguments: " + args != null ? args.values().toArray() : null);
// if (methodPointer != null && methodPointer.getExceptionTypes() != null) {
// for (int i = 0; i < methodPointer.getExceptionTypes().length; i++) {
// Class<?> excType = methodPointer.getExceptionTypes()[i];
11 years, 10 months
wise SVN: r526 - webgui/trunk/src/main/java/org/jboss/wise/gui.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-19 10:52:17 -0500 (Tue, 19 Feb 2013)
New Revision: 526
Modified:
webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
webgui/trunk/src/main/java/org/jboss/wise/gui/ClientHelper.java
Log:
[WISE-184] Do not show input elements for Mode.OUT webmethod params
Modified: webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
===================================================================
--- webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-02-19 15:10:22 UTC (rev 525)
+++ webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-02-19 15:52:17 UTC (rev 526)
@@ -20,6 +20,7 @@
import java.io.PrintStream;
import java.io.Serializable;
import java.util.List;
+import java.util.Map;
import javax.annotation.PostConstruct;
import javax.enterprise.context.Conversation;
@@ -126,7 +127,9 @@
WSMethod wsMethod = ClientHelper.getWSMethod(currentOperation, client);
InvocationResult result = null;
try {
- result = wsMethod.invoke(ClientHelper.processGUIParameters(inputTree));
+ Map<String, Object> params = ClientHelper.processGUIParameters(inputTree);
+ ClientHelper.addOUTParameters(params, wsMethod, client);
+ result = wsMethod.invoke(params);
} catch (InvocationException e) {
logException(e);
error = "Unexpected fault / error received from target endpoint";
Modified: webgui/trunk/src/main/java/org/jboss/wise/gui/ClientHelper.java
===================================================================
--- webgui/trunk/src/main/java/org/jboss/wise/gui/ClientHelper.java 2013-02-19 15:10:22 UTC (rev 525)
+++ webgui/trunk/src/main/java/org/jboss/wise/gui/ClientHelper.java 2013-02-19 15:52:17 UTC (rev 526)
@@ -27,6 +27,7 @@
import java.util.StringTokenizer;
import java.util.Map.Entry;
+import javax.jws.WebParam;
import javax.jws.soap.SOAPBinding;
import org.jboss.wise.core.client.InvocationResult;
@@ -64,13 +65,15 @@
rpcLit = style != null && SOAPBinding.Style.RPC.equals(style);
}
for (WebParameter parameter : parameters) {
- WiseTreeElement wte = builder.buildTreeFromType(parameter.getType(), parameter.getName(), null, !rpcLit);
- rootElement.addChild(wte.getId(), wte);
+ if (parameter.getMode() != WebParam.Mode.OUT) {
+ WiseTreeElement wte = builder.buildTreeFromType(parameter.getType(), parameter.getName(), null, !rpcLit);
+ rootElement.addChild(wte.getId(), wte);
+ }
}
return rootElement;
}
- public static TreeNodeImpl convertOperationResultToGui(InvocationResult result, WSDynamicClient client) {
+ public static TreeNodeImpl convertOperationResultToGui(InvocationResult result, WSDynamicClient client) {
WiseTreeElementBuilder builder = new WiseTreeElementBuilder(client, false);
TreeNodeImpl rootElement = new TreeNodeImpl();
Map<String, Type> resTypes = new HashMap<String, Type>();
@@ -141,6 +144,20 @@
}
return params;
}
+
+ public static void addOUTParameters(Map<String, Object> params, WSMethod wsMethod, WSDynamicClient client) {
+ WiseTreeElementBuilder builder = null;
+ final Collection<? extends WebParameter> parameters = wsMethod.getWebParams().values();
+ for (WebParameter parameter : parameters) {
+ if (parameter.getMode() == WebParam.Mode.OUT) {
+ if (builder == null) {
+ builder = new WiseTreeElementBuilder(client, true);
+ }
+ WiseTreeElement wte = builder.buildTreeFromType(parameter.getType(), parameter.getName(), null, true);
+ params.put(wte.getName(), wte.isNil() ? null : wte.toObject());
+ }
+ }
+ }
public static String toErrorMessage(Exception e) {
StringBuilder sb = new StringBuilder();
11 years, 10 months
wise SVN: r525 - webgui/trunk/src/main/java/org/jboss/wise/gui.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-19 10:10:22 -0500 (Tue, 19 Feb 2013)
New Revision: 525
Added:
webgui/trunk/src/main/java/org/jboss/wise/gui/ClientHelper.java
Modified:
webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
Log:
Minor refactoring
Modified: webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
===================================================================
--- webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-02-19 14:11:37 UTC (rev 524)
+++ webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-02-19 15:10:22 UTC (rev 525)
@@ -19,39 +19,25 @@
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.Serializable;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.StringTokenizer;
import javax.annotation.PostConstruct;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Inject;
import javax.inject.Named;
-import javax.jws.soap.SOAPBinding;
import org.jboss.logging.Logger;
import org.jboss.wise.core.client.InvocationResult;
import org.jboss.wise.core.client.WSDynamicClient;
-import org.jboss.wise.core.client.WSEndpoint;
import org.jboss.wise.core.client.WSMethod;
-import org.jboss.wise.core.client.WSService;
-import org.jboss.wise.core.client.WebParameter;
import org.jboss.wise.core.client.builder.WSDynamicClientBuilder;
import org.jboss.wise.core.client.impl.reflection.builder.ReflectionBasedWSDynamicClientBuilder;
import org.jboss.wise.core.exception.InvocationException;
-import org.jboss.wise.core.exception.WiseRuntimeException;
import org.jboss.wise.core.utils.JBossLoggingOutputStream;
import org.jboss.wise.gui.treeElement.GroupWiseTreeElement;
import org.jboss.wise.gui.treeElement.LazyLoadWiseTreeElement;
import org.jboss.wise.gui.treeElement.WiseTreeElement;
-import org.jboss.wise.gui.treeElement.WiseTreeElementBuilder;
import org.richfaces.component.UITree;
import org.richfaces.event.ItemChangeEvent;
import org.richfaces.model.TreeNodeImpl;
@@ -60,7 +46,7 @@
@ConversationScoped
public class ClientConversationBean implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -3778997821476776895L;
private static final int CONVERSATION_TIMEOUT = 15 * 60 * 1000; //15 mins instead of default 30 mins
private static CleanupTask<WSDynamicClient> cleanupTask = new CleanupTask<WSDynamicClient>(true);
@@ -113,7 +99,7 @@
}
if (client != null) {
try {
- services = convertServicesToGui(client.processServices());
+ services = ClientHelper.convertServicesToGui(client.processServices());
} catch (Exception e) {
error = "Could not parse WSDL from specified URL. Please check logs for further information.";
logException(e);
@@ -125,14 +111,10 @@
if (currentOperation == null) return;
outputTree = null;
error = null;
- StringTokenizer st = new StringTokenizer(currentOperation, ";");
- String serviceName = st.nextToken();
- String portName = st.nextToken();
- String operationName = st.nextToken();
try {
- inputTree = convertOperationParametersToGui(client.getWSMethod(serviceName, portName, operationName), client);
+ inputTree = ClientHelper.convertOperationParametersToGui(ClientHelper.getWSMethod(currentOperation, client), client);
} catch (Exception e) {
- error = toErrorMessage(e);
+ error = ClientHelper.toErrorMessage(e);
logException(e);
}
}
@@ -140,52 +122,34 @@
public void performInvocation() {
outputTree = null;
error = null;
- StringTokenizer st = new StringTokenizer(currentOperation, ";");
- String serviceName = st.nextToken();
- String portName = st.nextToken();
- String operationName = st.nextToken();
try {
- WSMethod wsMethod = client.getWSMethod(serviceName, portName, operationName);
- Map<String, Object> params = new HashMap<String, Object>();
- for (Iterator<Object> it = inputTree.getChildrenKeysIterator(); it.hasNext(); ) {
- WiseTreeElement wte = (WiseTreeElement)inputTree.getChild(it.next());
- params.put(wte.getName(), wte.isNil() ? null : wte.toObject());
- }
+ WSMethod wsMethod = ClientHelper.getWSMethod(currentOperation, client);
InvocationResult result = null;
try {
- result = wsMethod.invoke(params);
+ result = wsMethod.invoke(ClientHelper.processGUIParameters(inputTree));
} catch (InvocationException e) {
logException(e);
error = "Unexpected fault / error received from target endpoint";
}
if (result != null) {
- outputTree = convertOperationResultToGui(result, client);
+ outputTree = ClientHelper.convertOperationResultToGui(result, client);
error = null;
}
} catch (Exception e) {
- error = toErrorMessage(e);
+ error = ClientHelper.toErrorMessage(e);
logException(e);
}
}
public void generateRequestPreview() {
requestPreview = null;
- StringTokenizer st = new StringTokenizer(currentOperation, ";");
- String serviceName = st.nextToken();
- String portName = st.nextToken();
- String operationName = st.nextToken();
try {
- WSMethod wsMethod = client.getWSMethod(serviceName, portName, operationName);
- Map<String, Object> params = new HashMap<String, Object>();
- for (Iterator<Object> it = inputTree.getChildrenKeysIterator(); it.hasNext(); ) {
- WiseTreeElement wte = (WiseTreeElement)inputTree.getChild(it.next());
- params.put(wte.getName(), wte.isNil() ? null : wte.toObject());
- }
+ WSMethod wsMethod = ClientHelper.getWSMethod(currentOperation, client);
ByteArrayOutputStream os = new ByteArrayOutputStream();
- wsMethod.writeRequestPreview(params, os);
+ wsMethod.writeRequestPreview(ClientHelper.processGUIParameters(inputTree), os);
requestPreview = os.toString("UTF-8");
} catch (Exception e) {
- requestPreview = toErrorMessage(e);
+ requestPreview = ClientHelper.toErrorMessage(e);
logException(e);
}
}
@@ -202,7 +166,7 @@
try {
el.resolveReference();
} catch (Exception e) {
- error = toErrorMessage(e);
+ error = ClientHelper.toErrorMessage(e);
logException(e);
}
}
@@ -211,86 +175,6 @@
el.setNotNil(true);
}
- private static TreeNodeImpl convertOperationParametersToGui(WSMethod wsMethod, WSDynamicClient client) {
- WiseTreeElementBuilder builder = new WiseTreeElementBuilder(client, true);
- TreeNodeImpl rootElement = new TreeNodeImpl();
- Collection<? extends WebParameter> parameters = wsMethod.getWebParams().values();
- SOAPBinding soapBindingAnn = wsMethod.getEndpoint().getUnderlyingObjectClass().getAnnotation(SOAPBinding.class);
- boolean rpcLit = false;
- if (soapBindingAnn != null) {
- SOAPBinding.Style style = soapBindingAnn.style();
- rpcLit = style != null && SOAPBinding.Style.RPC.equals(style);
- }
- for (WebParameter parameter : parameters) {
- WiseTreeElement wte = builder.buildTreeFromType(parameter.getType(), parameter.getName(), null, !rpcLit);
- rootElement.addChild(wte.getId(), wte);
- }
- return rootElement;
- }
-
- private static TreeNodeImpl convertOperationResultToGui(InvocationResult result, WSDynamicClient client) {
- WiseTreeElementBuilder builder = new WiseTreeElementBuilder(client, false);
- TreeNodeImpl rootElement = new TreeNodeImpl();
- Map<String, Type> resTypes = new HashMap<String, Type>();
- for (Entry<String, Object> res : result.getResult().entrySet()) {
- String key = res.getKey();
- if (key.startsWith(WSMethod.TYPE_PREFIX)) {
- resTypes.put(key, (Type)res.getValue());
- }
- }
- for (Entry<String, Object> res : result.getResult().entrySet()) {
- final String key = res.getKey();
- if (!key.startsWith(WSMethod.TYPE_PREFIX)) {
- Type type = resTypes.get(WSMethod.TYPE_PREFIX + key);
- if (type != void.class && type != Void.class) {
- WiseTreeElement wte = builder.buildTreeFromType(type, key, res.getValue(), true);
- rootElement.addChild(wte.getId(), wte);
- }
- }
- }
- return rootElement;
- }
-
- private static List<Service> convertServicesToGui(Map<String, WSService> servicesMap) {
- List<Service> services = new LinkedList<Service>();
- for (Entry<String, WSService> serviceEntry : servicesMap.entrySet()) {
- Service service = new Service();
- services.add(service);
- service.setName(serviceEntry.getKey());
- List<Port> ports = new LinkedList<Port>();
- service.setPorts(ports);
- for (Entry<String, WSEndpoint> endpointEntry : serviceEntry.getValue().processEndpoints().entrySet()) {
- Port port = new Port();
- port.setName(endpointEntry.getKey());
- ports.add(port);
- List<Operation> operations = new LinkedList<Operation>();
- port.setOperations(operations);
- for (Entry<String, WSMethod> methodEntry : endpointEntry.getValue().getWSMethods().entrySet()) {
- Operation operation = new Operation();
- operation.setName(methodEntry.getKey());
- StringBuilder sb = new StringBuilder();
- sb.append(methodEntry.getKey());
- sb.append("(");
- Iterator<? extends WebParameter> paramIt = methodEntry.getValue().getWebParams().values().iterator();
- while (paramIt.hasNext()) {
- WebParameter param = paramIt.next();
- Type type = param.getType();
- sb.append(type instanceof Class<?> ? ((Class<?>)type).getSimpleName() : type.toString());
- sb.append(" ");
- sb.append(param.getName());
- if (paramIt.hasNext()) {
- sb.append(", ");
- }
- }
- sb.append(")");
- operation.setFullName(sb.toString());
- operations.add(operation);
- }
- }
- }
- return services;
- }
-
public void updateCurrentOperation(ItemChangeEvent event){
setCurrentOperation(event.getNewItemName());
}
@@ -392,21 +276,6 @@
this.requestPreview = requestPreview;
}
- private static String toErrorMessage(Exception e) {
- StringBuilder sb = new StringBuilder();
- if (e instanceof WiseRuntimeException) {
- sb.append(e.getMessage());
- } else {
- sb.append(e.toString());
- }
- if (e.getCause() != null) {
- sb.append(", caused by ");
- sb.append(e.getCause());
- }
- sb.append(". Please check logs for further information.");
- return sb.toString();
- }
-
private static void logException(Exception e) {
logger.error("", e);
}
Added: webgui/trunk/src/main/java/org/jboss/wise/gui/ClientHelper.java
===================================================================
--- webgui/trunk/src/main/java/org/jboss/wise/gui/ClientHelper.java (rev 0)
+++ webgui/trunk/src/main/java/org/jboss/wise/gui/ClientHelper.java 2013-02-19 15:10:22 UTC (rev 525)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.wise.gui;
+
+import java.io.Serializable;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Map.Entry;
+
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.wise.core.client.InvocationResult;
+import org.jboss.wise.core.client.WSDynamicClient;
+import org.jboss.wise.core.client.WSEndpoint;
+import org.jboss.wise.core.client.WSMethod;
+import org.jboss.wise.core.client.WSService;
+import org.jboss.wise.core.client.WebParameter;
+import org.jboss.wise.core.exception.ResourceNotAvailableException;
+import org.jboss.wise.core.exception.WiseRuntimeException;
+import org.jboss.wise.gui.treeElement.WiseTreeElement;
+import org.jboss.wise.gui.treeElement.WiseTreeElementBuilder;
+import org.richfaces.model.TreeNodeImpl;
+
+public class ClientHelper implements Serializable {
+
+ private static final long serialVersionUID = 4838483183941121581L;
+
+ public static WSMethod getWSMethod(String currentOperation, WSDynamicClient client) throws ResourceNotAvailableException {
+ StringTokenizer st = new StringTokenizer(currentOperation, ";");
+ String serviceName = st.nextToken();
+ String portName = st.nextToken();
+ String operationName = st.nextToken();
+ return client.getWSMethod(serviceName, portName, operationName);
+ }
+
+ public static TreeNodeImpl convertOperationParametersToGui(WSMethod wsMethod, WSDynamicClient client) {
+ WiseTreeElementBuilder builder = new WiseTreeElementBuilder(client, true);
+ TreeNodeImpl rootElement = new TreeNodeImpl();
+ Collection<? extends WebParameter> parameters = wsMethod.getWebParams().values();
+ SOAPBinding soapBindingAnn = wsMethod.getEndpoint().getUnderlyingObjectClass().getAnnotation(SOAPBinding.class);
+ boolean rpcLit = false;
+ if (soapBindingAnn != null) {
+ SOAPBinding.Style style = soapBindingAnn.style();
+ rpcLit = style != null && SOAPBinding.Style.RPC.equals(style);
+ }
+ for (WebParameter parameter : parameters) {
+ WiseTreeElement wte = builder.buildTreeFromType(parameter.getType(), parameter.getName(), null, !rpcLit);
+ rootElement.addChild(wte.getId(), wte);
+ }
+ return rootElement;
+ }
+
+ public static TreeNodeImpl convertOperationResultToGui(InvocationResult result, WSDynamicClient client) {
+ WiseTreeElementBuilder builder = new WiseTreeElementBuilder(client, false);
+ TreeNodeImpl rootElement = new TreeNodeImpl();
+ Map<String, Type> resTypes = new HashMap<String, Type>();
+ for (Entry<String, Object> res : result.getResult().entrySet()) {
+ String key = res.getKey();
+ if (key.startsWith(WSMethod.TYPE_PREFIX)) {
+ resTypes.put(key, (Type)res.getValue());
+ }
+ }
+ for (Entry<String, Object> res : result.getResult().entrySet()) {
+ final String key = res.getKey();
+ if (!key.startsWith(WSMethod.TYPE_PREFIX)) {
+ Type type = resTypes.get(WSMethod.TYPE_PREFIX + key);
+ if (type != void.class && type != Void.class) {
+ WiseTreeElement wte = builder.buildTreeFromType(type, key, res.getValue(), true);
+ rootElement.addChild(wte.getId(), wte);
+ }
+ }
+ }
+ return rootElement;
+ }
+
+ public static List<Service> convertServicesToGui(Map<String, WSService> servicesMap) {
+ List<Service> services = new LinkedList<Service>();
+ for (Entry<String, WSService> serviceEntry : servicesMap.entrySet()) {
+ Service service = new Service();
+ services.add(service);
+ service.setName(serviceEntry.getKey());
+ List<Port> ports = new LinkedList<Port>();
+ service.setPorts(ports);
+ for (Entry<String, WSEndpoint> endpointEntry : serviceEntry.getValue().processEndpoints().entrySet()) {
+ Port port = new Port();
+ port.setName(endpointEntry.getKey());
+ ports.add(port);
+ List<Operation> operations = new LinkedList<Operation>();
+ port.setOperations(operations);
+ for (Entry<String, WSMethod> methodEntry : endpointEntry.getValue().getWSMethods().entrySet()) {
+ Operation operation = new Operation();
+ operation.setName(methodEntry.getKey());
+ StringBuilder sb = new StringBuilder();
+ sb.append(methodEntry.getKey());
+ sb.append("(");
+ Iterator<? extends WebParameter> paramIt = methodEntry.getValue().getWebParams().values().iterator();
+ while (paramIt.hasNext()) {
+ WebParameter param = paramIt.next();
+ Type type = param.getType();
+ sb.append(type instanceof Class<?> ? ((Class<?>)type).getSimpleName() : type.toString());
+ sb.append(" ");
+ sb.append(param.getName());
+ if (paramIt.hasNext()) {
+ sb.append(", ");
+ }
+ }
+ sb.append(")");
+ operation.setFullName(sb.toString());
+ operations.add(operation);
+ }
+ }
+ }
+ return services;
+ }
+
+ public static Map<String, Object> processGUIParameters(TreeNodeImpl inputTree) {
+ Map<String, Object> params = new HashMap<String, Object>();
+ for (Iterator<Object> it = inputTree.getChildrenKeysIterator(); it.hasNext();) {
+ WiseTreeElement wte = (WiseTreeElement) inputTree.getChild(it.next());
+ params.put(wte.getName(), wte.isNil() ? null : wte.toObject());
+ }
+ return params;
+ }
+
+ public static String toErrorMessage(Exception e) {
+ StringBuilder sb = new StringBuilder();
+ if (e instanceof WiseRuntimeException) {
+ sb.append(e.getMessage());
+ } else {
+ sb.append(e.toString());
+ }
+ if (e.getCause() != null) {
+ sb.append(", caused by ");
+ sb.append(e.getCause());
+ }
+ sb.append(". Please check logs for further information.");
+ return sb.toString();
+ }
+}
11 years, 10 months
wise SVN: r524 - in core/trunk: core and 4 other directories.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-19 09:11:37 -0500 (Tue, 19 Feb 2013)
New Revision: 524
Modified:
core/trunk/core-cxf/pom.xml
core/trunk/core-cxf/src/main/java/org/jboss/wise/core/client/consumer/WiseCXFConsumerImpl.java
core/trunk/core/pom.xml
core/trunk/distribution/pom.xml
core/trunk/integration-testsuite/pom.xml
core/trunk/pom.xml
Log:
* [WISE-189] Slimming down dependencies a bit by moving to JBossWS 4.1 series
* adding testsuite profile for running against AS 8.0.0.Alpha1-SNAPSHOT
* adding workaround for CXF-4833
Modified: core/trunk/core/pom.xml
===================================================================
--- core/trunk/core/pom.xml 2013-02-19 13:58:08 UTC (rev 523)
+++ core/trunk/core/pom.xml 2013-02-19 14:11:37 UTC (rev 524)
@@ -111,12 +111,6 @@
</dependency>
<dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
Modified: core/trunk/core-cxf/pom.xml
===================================================================
--- core/trunk/core-cxf/pom.xml 2013-02-19 13:58:08 UTC (rev 523)
+++ core/trunk/core-cxf/pom.xml 2013-02-19 14:11:37 UTC (rev 524)
@@ -81,12 +81,6 @@
</dependency>
<dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
Modified: core/trunk/core-cxf/src/main/java/org/jboss/wise/core/client/consumer/WiseCXFConsumerImpl.java
===================================================================
--- core/trunk/core-cxf/src/main/java/org/jboss/wise/core/client/consumer/WiseCXFConsumerImpl.java 2013-02-19 13:58:08 UTC (rev 523)
+++ core/trunk/core-cxf/src/main/java/org/jboss/wise/core/client/consumer/WiseCXFConsumerImpl.java 2013-02-19 14:11:37 UTC (rev 524)
@@ -36,6 +36,7 @@
* A WSContractConsumer for CXF stack; this is basically a copy of the JBossWS-CXF 4.1.0
* implementation, to early consume the fix for JBWS-3520 which is blocking for Wise 2.0
* on AS 7 as it's the only workaround for WISE-179.
+ * This currently also include a workaround for CXF-4833.
*
* @author alessio.soldano(a)jboss.com
*/
@@ -259,15 +260,16 @@
}
catch (Throwable t)
{
- if (messageStream != null)
- {
- messageStream.println("Failed to invoke WSDLToJava");
- t.printStackTrace(messageStream);
- }
- else
- {
- t.printStackTrace();
- }
- }
+ try {
+ if (messageStream != null) {
+ messageStream.println("Failed to invoke WSDLToJava");
+ t.printStackTrace(messageStream);
+ } else {
+ t.printStackTrace();
+ }
+ } catch (IndexOutOfBoundsException iobe) {
+ //ignore, caused by CXF-4833
+ }
+ }
}
}
Modified: core/trunk/distribution/pom.xml
===================================================================
--- core/trunk/distribution/pom.xml 2013-02-19 13:58:08 UTC (rev 523)
+++ core/trunk/distribution/pom.xml 2013-02-19 14:11:37 UTC (rev 524)
@@ -29,6 +29,11 @@
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+ <version>1.0.0.Final</version>
+ </dependency>
</dependencies>
<build>
Modified: core/trunk/integration-testsuite/pom.xml
===================================================================
--- core/trunk/integration-testsuite/pom.xml 2013-02-19 13:58:08 UTC (rev 523)
+++ core/trunk/integration-testsuite/pom.xml 2013-02-19 14:11:37 UTC (rev 524)
@@ -50,11 +50,6 @@
</dependency>
<dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<scope>test</scope>
@@ -145,11 +140,42 @@
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-webservices-tests-integration</artifactId>
<version>7.1.1.Final</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-clustering-infinispan</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-transactions</artifactId>
+ </exclusion>
+ </exclusions>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
+ <id>jboss800</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-webservices-tests-integration</artifactId>
+ <version>8.0.0.Alpha1-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-clustering-infinispan</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-transactions</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
<id>use.endorsed.dir</id>
<activation>
<property>
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2013-02-19 13:58:08 UTC (rev 523)
+++ core/trunk/pom.xml 2013-02-19 14:11:37 UTC (rev 524)
@@ -58,7 +58,11 @@
<surefire.usefile>false</surefire.usefile>
<compile.flags>-Xlint:unchecked,deprecation,fallthrough,finally</compile.flags>
<checkstyle.extension />
- <cxf.version>2.4.6</cxf.version> <!-- This should stay in synch with the one used within the jbossws-cxf being pulled in wise-core-cxf -->
+ <milyn.version>1.2.1</milyn.version>
+ <!-- Following should stay in synch with the one used within the jbossws-cxf being pulled in wise-core-cxf -->
+ <cxf.version>2.6.4</cxf.version>
+ <jaxb.impl.version>2.2.5</jaxb.impl.version>
+ <!-- -->
<compiler.fork>false</compiler.fork>
</properties>
@@ -136,7 +140,19 @@
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>${jaxb.impl.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ <version>${jaxb.impl.version}</version>
+ </dependency>
+
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
@@ -153,14 +169,14 @@
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
- <version>3.1.0.GA</version>
+ <version>3.1.2.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-common</artifactId>
- <version>2.0.2.GA</version>
+ <version>2.1.1.Final</version>
<exclusions>
<exclusion>
<groupId>jboss.jaxbintros</groupId>
@@ -172,13 +188,13 @@
<dependency>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-spi</artifactId>
- <version>2.0.3.GA</version>
+ <version>2.1.1.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.ws.cxf</groupId>
<artifactId>jbossws-cxf-client</artifactId>
- <version>4.0.2.GA</version>
+ <version>4.1.1.Final</version>
<exclusions>
<exclusion>
<groupId>org.apache.cxf</groupId>
@@ -197,10 +213,6 @@
<artifactId>woodstox-core-asl</artifactId>
</exclusion>
<exclusion>
- <groupId>org.opensaml</groupId>
- <artifactId>opensaml</artifactId>
- </exclusion>
- <exclusion>
<groupId>com.sun.xml.fastinfoset</groupId>
<artifactId>FastInfoset</artifactId>
</exclusion>
@@ -212,13 +224,29 @@
<groupId>gnu-getopt</groupId>
<artifactId>getopt</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-jms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.santuario</groupId>
+ <artifactId>xmlsec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.spec.javax.xml.rpc</groupId>
+ <artifactId>jboss-jaxrpc-api_1.1_spec</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.milyn</groupId>
<artifactId>milyn-smooks-core</artifactId>
- <version>1.2.1</version>
+ <version>${milyn.version}</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
@@ -230,19 +258,19 @@
<dependency>
<groupId>org.milyn</groupId>
<artifactId>milyn-smooks-validation</artifactId>
- <version>1.2.1</version>
+ <version>${milyn.version}</version>
</dependency>
<dependency>
<groupId>org.milyn</groupId>
<artifactId>milyn-commons</artifactId>
- <version>1.2.1</version>
+ <version>${milyn.version}</version>
</dependency>
<dependency>
<groupId>org.milyn</groupId>
<artifactId>milyn-smooks-javabean</artifactId>
- <version>1.2.1</version>
+ <version>${milyn.version}</version>
</dependency>
<dependency>
@@ -263,23 +291,23 @@
<version>1.2.16</version>
</dependency>
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <version>2.7.1</version>
- </dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.1</version>
+ </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.8.0</version>
- </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.8.0</version>
+ </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <version>1.1</version>
- </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-all</artifactId>
+ <version>1.1</version>
+ </dependency>
<dependency>
<groupId>javax.ejb</groupId>
11 years, 10 months
wise SVN: r523 - core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-19 08:58:08 -0500 (Tue, 19 Feb 2013)
New Revision: 523
Modified:
core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/WiseIntegrationInContainerTest.java
Log:
Fixing broken testcase
Modified: core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/WiseIntegrationInContainerTest.java
===================================================================
--- core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/WiseIntegrationInContainerTest.java 2013-02-18 11:45:45 UTC (rev 522)
+++ core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/WiseIntegrationInContainerTest.java 2013-02-19 13:58:08 UTC (rev 523)
@@ -51,7 +51,7 @@
if (result.startsWith("[FIXME]")) {
System.out.println(result);
} else {
- Assert.assertEquals("WS return: foo", br.readLine());
+ Assert.assertEquals("WS return: foo", result);
}
}
11 years, 10 months
wise SVN: r522 - webgui/trunk/src/main/webapp.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-18 06:45:45 -0500 (Mon, 18 Feb 2013)
New Revision: 522
Modified:
webgui/trunk/src/main/webapp/index.xhtml
Log:
[WISE-186] Fixing indentation and moving panel into form
Modified: webgui/trunk/src/main/webapp/index.xhtml
===================================================================
--- webgui/trunk/src/main/webapp/index.xhtml 2013-02-15 18:58:25 UTC (rev 521)
+++ webgui/trunk/src/main/webapp/index.xhtml 2013-02-18 11:45:45 UTC (rev 522)
@@ -183,19 +183,20 @@
<a4j:commandButton value="Preview message" render="popupPreview" action="#{clientConversationBean.generateRequestPreview}"
id="previewButton" oncomplete="#{rich:component('popupPreview')}.show();">
- </a4j:commandButton>
+ </a4j:commandButton>
+
+ <rich:popupPanel id="popupPreview" modal="true" resizeable="true" onmaskclick="#{rich:component('popupPreview')}.hide()" minWidth="550" minHeight="450">
+ <f:facet name="header">
+ <h:outputText value="SOAP request message preview" />
+ </f:facet>
+ <f:facet name="controls">
+ <h:outputLink value="#" onclick="#{rich:component('popupPreview')}.hide(); return false;">X</h:outputLink>
+ </f:facet>
+ <p>Below is a preview of the SOAP message that will be generated upon invocation. The actual message going on the wire might be different
+ depending on the selected service policy (security, addressing, reliable-messaging, etc.), if any.</p>
+ <div align="center"><h:inputTextarea value="#{clientConversationBean.requestPreview}" cols="80" rows="20" readonly="true" styleClass="preformatted"/></div>
+ </rich:popupPanel>
</h:form>
- <rich:popupPanel id="popupPreview" modal="true" resizeable="true" onmaskclick="#{rich:component('popupPreview')}.hide()" minWidth="550" minHeight="450">
- <f:facet name="header">
- <h:outputText value="SOAP request message preview" />
- </f:facet>
- <f:facet name="controls">
- <h:outputLink value="#" onclick="#{rich:component('popupPreview')}.hide(); return false;">X</h:outputLink>
- </f:facet>
- <p>Below is a preview of the SOAP message that will be generated upon invocation. The actual message going on the wire might be different
- depending on the selected service policy (security, addressing, reliable-messaging, etc.), if any.</p>
- <div align="center"><h:inputTextarea value="#{clientConversationBean.requestPreview}" cols="80" rows="20" readonly="true" styleClass="preformatted"/></div>
- </rich:popupPanel>
</rich:panel>
<br />
11 years, 10 months
wise SVN: r521 - in webgui/trunk/src/main: webapp and 3 other directories.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-15 13:58:25 -0500 (Fri, 15 Feb 2013)
New Revision: 521
Added:
webgui/trunk/src/main/webapp/resources/
webgui/trunk/src/main/webapp/resources/css/
webgui/trunk/src/main/webapp/resources/css/styles.css
Modified:
webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
webgui/trunk/src/main/webapp/index.xhtml
webgui/trunk/src/main/webapp/templates/template.xhtml
Log:
[WISE-186] Add popup panel for request message preview + add css file
Modified: webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
===================================================================
--- webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-02-15 18:57:03 UTC (rev 520)
+++ webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-02-15 18:58:25 UTC (rev 521)
@@ -16,6 +16,7 @@
*/
package org.jboss.wise.gui;
+import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.Serializable;
import java.lang.reflect.Type;
@@ -77,7 +78,8 @@
private TreeNodeImpl outputTree;
private String error;
private UITree inTree;
-
+ private String requestPreview;
+
@PostConstruct
public void init() {
//this is called each time a new browser tab is used and whenever the conversation expires (hence a new bean is created)
@@ -166,6 +168,28 @@
}
}
+ public void generateRequestPreview() {
+ requestPreview = null;
+ StringTokenizer st = new StringTokenizer(currentOperation, ";");
+ String serviceName = st.nextToken();
+ String portName = st.nextToken();
+ String operationName = st.nextToken();
+ try {
+ WSMethod wsMethod = client.getWSMethod(serviceName, portName, operationName);
+ Map<String, Object> params = new HashMap<String, Object>();
+ for (Iterator<Object> it = inputTree.getChildrenKeysIterator(); it.hasNext(); ) {
+ WiseTreeElement wte = (WiseTreeElement)inputTree.getChild(it.next());
+ params.put(wte.getName(), wte.isNil() ? null : wte.toObject());
+ }
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ wsMethod.writeRequestPreview(params, os);
+ requestPreview = os.toString("UTF-8");
+ } catch (Exception e) {
+ requestPreview = toErrorMessage(e);
+ logException(e);
+ }
+ }
+
public void addChild(GroupWiseTreeElement el) {
el.incrementChildren();
}
@@ -359,7 +383,15 @@
public void setError(String error) {
this.error = error;
}
+
+ public String getRequestPreview() {
+ return requestPreview;
+ }
+ public void setRequestPreview(String requestPreview) {
+ this.requestPreview = requestPreview;
+ }
+
private static String toErrorMessage(Exception e) {
StringBuilder sb = new StringBuilder();
if (e instanceof WiseRuntimeException) {
Modified: webgui/trunk/src/main/webapp/index.xhtml
===================================================================
--- webgui/trunk/src/main/webapp/index.xhtml 2013-02-15 18:57:03 UTC (rev 520)
+++ webgui/trunk/src/main/webapp/index.xhtml 2013-02-15 18:58:25 UTC (rev 521)
@@ -179,7 +179,23 @@
</rich:tree>
<a4j:commandButton value="Perform invocation" render="opSelectionPanel" rerender="opSelectionPanel"
action="#{clientConversationBean.performInvocation}" status="perfInvStatus" />
+ <h:outputText value=" " />
+
+ <a4j:commandButton value="Preview message" render="popupPreview" action="#{clientConversationBean.generateRequestPreview}"
+ id="previewButton" oncomplete="#{rich:component('popupPreview')}.show();">
+ </a4j:commandButton>
</h:form>
+ <rich:popupPanel id="popupPreview" modal="true" resizeable="true" onmaskclick="#{rich:component('popupPreview')}.hide()" minWidth="550" minHeight="450">
+ <f:facet name="header">
+ <h:outputText value="SOAP request message preview" />
+ </f:facet>
+ <f:facet name="controls">
+ <h:outputLink value="#" onclick="#{rich:component('popupPreview')}.hide(); return false;">X</h:outputLink>
+ </f:facet>
+ <p>Below is a preview of the SOAP message that will be generated upon invocation. The actual message going on the wire might be different
+ depending on the selected service policy (security, addressing, reliable-messaging, etc.), if any.</p>
+ <div align="center"><h:inputTextarea value="#{clientConversationBean.requestPreview}" cols="80" rows="20" readonly="true" styleClass="preformatted"/></div>
+ </rich:popupPanel>
</rich:panel>
<br />
Added: webgui/trunk/src/main/webapp/resources/css/styles.css
===================================================================
--- webgui/trunk/src/main/webapp/resources/css/styles.css (rev 0)
+++ webgui/trunk/src/main/webapp/resources/css/styles.css 2013-02-15 18:58:25 UTC (rev 521)
@@ -0,0 +1,3 @@
+.preformatted {
+ white-space: pre;
+}
Modified: webgui/trunk/src/main/webapp/templates/template.xhtml
===================================================================
--- webgui/trunk/src/main/webapp/templates/template.xhtml 2013-02-15 18:57:03 UTC (rev 520)
+++ webgui/trunk/src/main/webapp/templates/template.xhtml 2013-02-15 18:58:25 UTC (rev 521)
@@ -5,6 +5,7 @@
<h:head>
<title>wise-gui</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <h:outputStylesheet name="css/styles.css" />
</h:head>
<h:body>
11 years, 10 months
wise SVN: r520 - webgui/trunk.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-15 13:57:03 -0500 (Fri, 15 Feb 2013)
New Revision: 520
Modified:
webgui/trunk/pom.xml
Log:
Move to latest core snapshot
Modified: webgui/trunk/pom.xml
===================================================================
--- webgui/trunk/pom.xml 2013-02-15 18:56:15 UTC (rev 519)
+++ webgui/trunk/pom.xml 2013-02-15 18:57:03 UTC (rev 520)
@@ -52,7 +52,7 @@
<version.org.jboss.spec.jboss.javaee.6.0>3.0.0.Final</version.org.jboss.spec.jboss.javaee.6.0>
<version.org.richfaces>4.3.0.Final</version.org.richfaces>
- <version.wise.core>2.0.0.Final</version.wise.core>
+ <version.wise.core>2.0.1-SNAPSHOT</version.wise.core>
<!-- other plugin versions -->
<version.compiler.plugin>2.3.1</version.compiler.plugin>
11 years, 10 months
wise SVN: r519 - core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-15 13:56:15 -0500 (Fri, 15 Feb 2013)
New Revision: 519
Modified:
core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodPreview.java
Log:
[WISE-185] Indent req message
Modified: core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodPreview.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodPreview.java 2013-02-15 14:14:38 UTC (rev 518)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodPreview.java 2013-02-15 18:56:15 UTC (rev 519)
@@ -30,6 +30,11 @@
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.Handler;
@@ -82,8 +87,16 @@
@Override
public boolean handleMessage(SOAPMessageContext context) {
try {
- SOAPMessage soapMessage = context.getMessage();
- soapMessage.writeTo(os);
+ TransformerFactory tff = TransformerFactory.newInstance();
+ Transformer tf = tff.newTransformer();
+ tf.setOutputProperty(OutputKeys.INDENT, "yes");
+ tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+
+ Source sc = context.getMessage().getSOAPPart().getContent();
+
+ StreamResult result = new StreamResult(os);
+ tf.transform(sc, result);
+
} catch (Exception e) {
e.printStackTrace(new PrintStream(os));
}
11 years, 10 months
wise SVN: r518 - in core/trunk: core/src/main/java/org/jboss/wise/core/client/impl/reflection and 1 other directories.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-02-15 09:14:38 -0500 (Fri, 15 Feb 2013)
New Revision: 518
Added:
core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodPreview.java
Modified:
core/trunk/core/src/main/java/org/jboss/wise/core/client/WSMethod.java
core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodCaller.java
core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/WSMethodImpl.java
core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java
Log:
[WISE-185] Request message preview + minor improvement in EndpointMethodCaller
Modified: core/trunk/core/src/main/java/org/jboss/wise/core/client/WSMethod.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/client/WSMethod.java 2013-02-10 16:32:46 UTC (rev 517)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/client/WSMethod.java 2013-02-15 14:14:38 UTC (rev 518)
@@ -21,6 +21,7 @@
*/
package org.jboss.wise.core.client;
+import java.io.OutputStream;
import java.util.Map;
import net.jcip.annotations.ThreadSafe;
import org.jboss.wise.core.exception.InvocationException;
@@ -84,6 +85,16 @@
* @throws MappingException
*/
public InvocationResult invoke(Object args) throws InvocationException, IllegalArgumentException, MappingException;
+
+ /**
+ * Generates and writes a preview of the request message for invoking this
+ * method with the provided arguments.
+ *
+ * @param args
+ * @param os
+ * @throws InvocationException
+ */
+ public void writeRequestPreview(Map<String, Object> args, OutputStream os) throws InvocationException;
/**
* Gets the map of {@link WebParameter} for the webserice method represented
Modified: core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodCaller.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodCaller.java 2013-02-10 16:32:46 UTC (rev 517)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodCaller.java 2013-02-15 14:14:38 UTC (rev 518)
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.concurrent.Callable;
+import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.Handler;
@@ -33,7 +34,7 @@
public class EndpointMethodCaller implements Callable<Object> {
- private final ThreadLocal<Object> epUnderlyingObjectInstance = new ThreadLocal<Object>() {
+ protected final ThreadLocal<Object> epUnderlyingObjectInstance = new ThreadLocal<Object>() {
@Override
protected Object initialValue() {
return epInstance.createInstance();
@@ -74,21 +75,23 @@
public void visitEnabler() {
if (epInstance.getExtensions() != null) {
+ Object obj = epUnderlyingObjectInstance.get();
for (WSExtensionEnabler enabler : epInstance.getExtensions()) {
- enabler.enable(epUnderlyingObjectInstance.get());
+ enabler.enable(obj);
}
}
}
public void addHandlers() {
- if (epInstance.getHandlers() != null) {
-
- for (Handler<?> handler : epInstance.getHandlers()) {
- @SuppressWarnings("rawtypes")
- List<Handler> handlerChain = ((BindingProvider)epUnderlyingObjectInstance.get()).getBinding().getHandlerChain();
+ List<Handler<?>> handlers = epInstance.getHandlers();
+ if (handlers != null && !handlers.isEmpty()) {
+ Binding binding = ((BindingProvider)epUnderlyingObjectInstance.get()).getBinding();
+ @SuppressWarnings("rawtypes")
+ List<Handler> handlerChain = binding.getHandlerChain();
+ for (Handler<?> handler : handlers) {
handlerChain.add(handler);
- ((BindingProvider)epUnderlyingObjectInstance.get()).getBinding().setHandlerChain(handlerChain);
}
+ binding.setHandlerChain(handlerChain);
}
}
Added: core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodPreview.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodPreview.java (rev 0)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodPreview.java 2013-02-15 14:14:38 UTC (rev 518)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wise.core.client.impl.reflection;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.wise.core.client.WSEndpoint;
+
+public class EndpointMethodPreview extends EndpointMethodCaller {
+
+ private final PreviewHandler handler;
+
+ public EndpointMethodPreview( WSEndpoint epInstance,
+ Method methodPointer,
+ Object[] args,
+ OutputStream previewOutputStream) {
+ super(epInstance, methodPointer, args);
+ this.handler = new PreviewHandler(previewOutputStream);
+ }
+
+ @Override
+ public Object call() throws Exception {
+ try {
+ super.call();
+ } catch (Exception e) {
+ //ignore, here we only need to start the invocation so that our handler is executed
+ }
+ return handler.os;
+ }
+
+ @Override
+ public void addHandlers() {
+ super.addHandlers();
+ Binding binding = ((BindingProvider) epUnderlyingObjectInstance.get()).getBinding();
+ @SuppressWarnings("rawtypes")
+ List<Handler> handlerChain = binding.getHandlerChain();
+ handlerChain.add(handler);
+ binding.setHandlerChain(handlerChain);
+ }
+
+ private class PreviewHandler implements SOAPHandler<SOAPMessageContext> {
+
+ private OutputStream os;
+
+ public PreviewHandler(OutputStream os) {
+ this.os = os;
+ }
+
+ @Override
+ public boolean handleMessage(SOAPMessageContext context) {
+ try {
+ SOAPMessage soapMessage = context.getMessage();
+ soapMessage.writeTo(os);
+ } catch (Exception e) {
+ e.printStackTrace(new PrintStream(os));
+ }
+ return false; //to stop processing handler chain, reverse direction and eventually get back to caller
+ }
+
+ @Override
+ public boolean handleFault(SOAPMessageContext context) {
+ return true;
+ }
+
+ @Override
+ public void close(MessageContext context) {
+ }
+
+ @Override
+ public Set<QName> getHeaders() {
+ return new HashSet<QName>(); // empty set
+ }
+ }
+}
Modified: core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/WSMethodImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/WSMethodImpl.java 2013-02-10 16:32:46 UTC (rev 517)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/WSMethodImpl.java 2013-02-15 14:14:38 UTC (rev 518)
@@ -21,6 +21,7 @@
*/
package org.jboss.wise.core.client.impl.reflection;
+import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
@@ -72,7 +73,7 @@
* received
*/
InvocationResultImpl invoke(Map<String, Object> args) throws InvocationException, IllegalArgumentException {
- Method methodPointer = null;
+// Method methodPointer = null;
InvocationResultImpl result = null;
Map<String, Object> emptyHolder = Collections.emptyMap();
@@ -90,15 +91,15 @@
} catch (Exception ite) {
System.out.print("error invoking:" + this.getMethod());
System.out.print("error invoking:" + args.values().toArray());
- if (methodPointer != null && methodPointer.getExceptionTypes() != null) {
- for (int i = 0; i < methodPointer.getExceptionTypes().length; i++) {
- Class<?> excType = methodPointer.getExceptionTypes()[i];
- if (ite.getCause().getClass().isAssignableFrom(excType)) {
- result = new InvocationResultImpl("exception", excType, ite.getCause(), emptyHolder);
- return result;
- }
- }
- }
+// if (methodPointer != null && methodPointer.getExceptionTypes() != null) {
+// for (int i = 0; i < methodPointer.getExceptionTypes().length; i++) {
+// Class<?> excType = methodPointer.getExceptionTypes()[i];
+// if (ite.getCause().getClass().isAssignableFrom(excType)) {
+// result = new InvocationResultImpl("exception", excType, ite.getCause(), emptyHolder);
+// return result;
+// }
+// }
+// }
throw new InvocationException("Unknown exception received: " + ite.getMessage(), ite);
} catch (Throwable e) {
throw new InvocationException("Generic Error during method invocation!", e);
@@ -106,6 +107,19 @@
return result;
}
+ @Override
+ public void writeRequestPreview(Map<String, Object> args, OutputStream os) throws InvocationException {
+ try {
+ EndpointMethodPreview caller = new EndpointMethodPreview(this.getEndpoint(), this.getMethod(), this
+ .getParmeterInRightPositionArray(args), os);
+ ((WSEndpointImpl) this.getEndpoint()).getService().submit(caller).get();
+ } catch (Exception ite) {
+ throw new InvocationException("Unknown exception received: " + ite.getMessage(), ite);
+ } catch (Throwable e) {
+ throw new InvocationException("Generic Error during method invocation!", e);
+ }
+ }
+
/**
* Invokes this method with the provided arguments applying provided mapper
*
Modified: core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java
===================================================================
--- core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java 2013-02-10 16:32:46 UTC (rev 517)
+++ core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java 2013-02-15 14:14:38 UTC (rev 518)
@@ -21,6 +21,7 @@
*/
package org.jboss.wise.test.integration.basic;
+import java.io.ByteArrayOutputStream;
import java.net.URL;
import java.util.Map;
@@ -55,6 +56,9 @@
WSMethod method = client.getWSMethod("HelloService", "HelloWorldBeanPort", "echo");
Map<String, Object> args = new java.util.HashMap<String, Object>();
args.put("arg0", "from-wise-client");
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ method.writeRequestPreview(args, bos);
+ Assert.assertTrue(bos.toString().contains("<arg0>from-wise-client</arg0>"));
InvocationResult result = method.invoke(args, null);
Map<String, Object> res = result.getMapRequestAndResult(null, null);
Map<String, Object> test = (Map<String, Object>) res.get("results");
11 years, 10 months