wise SVN: r541 - in webgui/trunk/src/main: webapp and 1 other directory.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-03-20 10:40:22 -0400 (Wed, 20 Mar 2013)
New Revision: 541
Added:
webgui/trunk/src/main/java/org/jboss/wise/gui/ResponseLogHandler.java
Modified:
webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
webgui/trunk/src/main/webapp/index.xhtml
Log:
[WISE-198] Adding soap response view panel
Modified: webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
===================================================================
--- webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-03-20 11:56:40 UTC (rev 540)
+++ webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-03-20 14:40:22 UTC (rev 541)
@@ -70,6 +70,7 @@
private String error;
private UITree inTree;
private String requestPreview;
+ private String responseMessage;
private String requestActiveTab;
@PostConstruct
@@ -114,6 +115,7 @@
public void parseOperationParameters() {
if (currentOperation == null) return;
outputTree = null;
+ responseMessage = null;
error = null;
try {
inputTree = ClientHelper.convertOperationParametersToGui(ClientHelper.getWSMethod(currentOperation, client), client);
@@ -126,9 +128,11 @@
public void performInvocation() {
outputTree = null;
error = null;
+ responseMessage = null;
try {
WSMethod wsMethod = ClientHelper.getWSMethod(currentOperation, client);
InvocationResult result = null;
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
Map<String, Object> params = ClientHelper.processGUIParameters(inputTree);
ClientHelper.addOUTParameters(params, wsMethod, client);
@@ -136,10 +140,16 @@
endpoint.setTargetUrl(invocationUrl);
endpoint.setPassword(invocationPwd);
endpoint.setUsername(invocationUser);
+ endpoint.addHandler(new ResponseLogHandler(os));
result = wsMethod.invoke(params);
} catch (InvocationException e) {
logException(e);
error = "Unexpected fault / error received from target endpoint";
+ } finally {
+ responseMessage = os.toString("UTF-8");
+ if (responseMessage.trim().length() == 0) {
+ responseMessage = null;
+ }
}
if (result != null) {
outputTree = ClientHelper.convertOperationResultToGui(result, client);
@@ -194,6 +204,10 @@
}
}
+ public boolean isResponseAvailable() {
+ return outputTree != null || responseMessage != null;
+ }
+
private void cleanup() {
if (client != null) {
cleanupTask.removeRef(client);
@@ -209,6 +223,7 @@
}
inputTree = null;
error = null;
+ responseMessage = null;
invocationUrl = null;
}
@@ -344,6 +359,14 @@
this.requestActiveTab = requestActiveTab;
}
+ public String getResponseMessage() {
+ return responseMessage;
+ }
+
+ public void setResponseMessage(String responseMessage) {
+ this.responseMessage = responseMessage;
+ }
+
private static void logException(Exception e) {
logger.error("", e);
}
Added: webgui/trunk/src/main/java/org/jboss/wise/gui/ResponseLogHandler.java
===================================================================
--- webgui/trunk/src/main/java/org/jboss/wise/gui/ResponseLogHandler.java (rev 0)
+++ webgui/trunk/src/main/java/org/jboss/wise/gui/ResponseLogHandler.java 2013-03-20 14:40:22 UTC (rev 541)
@@ -0,0 +1,91 @@
+/*
+ * 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.gui;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+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.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+/**
+ * Logs the client inbound response message
+ *
+ * @author alessio.soldano(a)jboss.com
+ */
+public class ResponseLogHandler implements SOAPHandler<SOAPMessageContext> {
+
+ private final OutputStream outputStream;
+
+ public ResponseLogHandler(OutputStream outStream) {
+ this.outputStream = outStream;
+ }
+
+ public Set<QName> getHeaders() {
+ return new HashSet<QName>(); // empty set
+ }
+
+ public boolean handleMessage(SOAPMessageContext smc) {
+ doLog(smc);
+ return true;
+ }
+
+ public boolean handleFault(SOAPMessageContext smc) {
+ doLog(smc);
+ return true;
+ }
+
+ // nothing to clean up
+ public void close(MessageContext messageContext) {
+ }
+
+ private void doLog(SOAPMessageContext smc) {
+ if (!(Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) {
+ try {
+ 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 = smc.getMessage().getSOAPPart().getContent();
+
+ StreamResult result = new StreamResult(outputStream);
+ tf.transform(sc, result);
+
+ } catch (Exception e) {
+ PrintWriter ps = new PrintWriter(outputStream);
+ ps.println("Exception getting response message log: ");
+ e.printStackTrace(ps);
+ }
+ }
+ }
+
+}
Modified: webgui/trunk/src/main/webapp/index.xhtml
===================================================================
--- webgui/trunk/src/main/webapp/index.xhtml 2013-03-20 11:56:40 UTC (rev 540)
+++ webgui/trunk/src/main/webapp/index.xhtml 2013-03-20 14:40:22 UTC (rev 541)
@@ -216,7 +216,7 @@
<br />
<a4j:outputPanel id="resultPanel" ajaxRendered="true">
- <rich:panel header="Response" rendered="#{not empty clientConversationBean.outputTree}">
+ <rich:panel header="Response" rendered="#{clientConversationBean.responseAvailable}">
<h:form id="resForm">
<rich:tree id="richResTree" var="node" value="#{clientConversationBean.outputTree}" nodeType="#{node.kind}" switchType="ajax">
<rich:treeNode type="simple">
@@ -259,6 +259,20 @@
<h:outputText value="#{node.type} : #{node.name} = ***NIL***" rendered="#{node.nil}" />
</rich:treeNode>
</rich:tree>
+ <br/>
+ <a4j:commandButton value="View message" render="popupView"
+ id="viewMessageButton" oncomplete="#{rich:component('popupView')}.show();">
+ </a4j:commandButton>
+ <rich:popupPanel id="popupView" modal="true" resizeable="true" onmaskclick="#{rich:component('popupView')}.hide()" minWidth="550" minHeight="450">
+ <f:facet name="header">
+ <h:outputText value="SOAP response message" />
+ </f:facet>
+ <f:facet name="controls">
+ <h:outputLink value="#" onclick="#{rich:component('popupView')}.hide(); return false;">X</h:outputLink>
+ </f:facet>
+ <p>Below is the captured SOAP response message:</p>
+ <div align="center"><h:inputTextarea value="#{clientConversationBean.responseMessage}" cols="80" rows="20" readonly="true" styleClass="preformatted"/></div>
+ </rich:popupPanel>
</h:form>
</rich:panel>
<rich:panel header="Error" rendered="#{not empty clientConversationBean.error}">
11 years, 9 months
wise SVN: r540 - in webgui/trunk/src/main: webapp and 1 other directory.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-03-20 07:56:40 -0400 (Wed, 20 Mar 2013)
New Revision: 540
Modified:
webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
webgui/trunk/src/main/webapp/index.xhtml
Log:
* [WISE-190] Target endpoint address override
* [WISE-191] Independent auth setup for wsdl retrieval and endpoint invocation
* misc UI fixes
Modified: webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
===================================================================
--- webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-03-20 11:47:24 UTC (rev 539)
+++ webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-03-20 11:56:40 UTC (rev 540)
@@ -31,6 +31,7 @@
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.builder.WSDynamicClientBuilder;
import org.jboss.wise.core.client.impl.reflection.builder.ReflectionBasedWSDynamicClientBuilder;
@@ -59,6 +60,9 @@
private String wsdlUrl;
private String wsdlUser;
private String wsdlPwd;
+ private String invocationUrl;
+ private String invocationUser;
+ private String invocationPwd;
private List<Service> services;
private String currentOperation;
private TreeNodeImpl inputTree;
@@ -66,6 +70,7 @@
private String error;
private UITree inTree;
private String requestPreview;
+ private String requestActiveTab;
@PostConstruct
public void init() {
@@ -81,12 +86,10 @@
conversation.begin();
try {
WSDynamicClientBuilder builder = new ReflectionBasedWSDynamicClientBuilder().verbose(true).messageStream(ps).keepSource(true).maxThreadPoolSize(1);
- if (wsdlUser != null && wsdlUser.length() > 0) {
- builder.userName(wsdlUser);
- }
- if (wsdlPwd != null && wsdlPwd.length() > 0) {
- builder.password(wsdlPwd);
- }
+ builder.userName(wsdlUser);
+ invocationUser = wsdlUser;
+ builder.password(wsdlPwd);
+ invocationPwd = wsdlPwd;
client = builder.wsdlURL(getWsdlUrl()).build();
cleanupTask.addRef(client, System.currentTimeMillis() + CONVERSATION_TIMEOUT, new CleanupTask.CleanupCallback<WSDynamicClient>() {
@Override
@@ -129,6 +132,10 @@
try {
Map<String, Object> params = ClientHelper.processGUIParameters(inputTree);
ClientHelper.addOUTParameters(params, wsMethod, client);
+ final WSEndpoint endpoint = wsMethod.getEndpoint();
+ endpoint.setTargetUrl(invocationUrl);
+ endpoint.setPassword(invocationPwd);
+ endpoint.setUsername(invocationUser);
result = wsMethod.invoke(params);
} catch (InvocationException e) {
logException(e);
@@ -149,6 +156,7 @@
try {
WSMethod wsMethod = ClientHelper.getWSMethod(currentOperation, client);
ByteArrayOutputStream os = new ByteArrayOutputStream();
+ wsMethod.getEndpoint().setTargetUrl(null);
wsMethod.writeRequestPreview(ClientHelper.processGUIParameters(inputTree), os);
requestPreview = os.toString("UTF-8");
} catch (Exception e) {
@@ -178,9 +186,13 @@
el.setNotNil(true);
}
- public void updateCurrentOperation(ItemChangeEvent event){
- setCurrentOperation(event.getNewItemName());
+ public void updateCurrentOperation(ItemChangeEvent event) {
+ String ev = event.getNewItemName();
+ //skip empty/null operation values as those comes from expansion/collapse of the menu panel
+ if (ev != null && ev.length() > 0) {
+ setCurrentOperation(ev);
}
+ }
private void cleanup() {
if (client != null) {
@@ -197,6 +209,7 @@
}
inputTree = null;
error = null;
+ invocationUrl = null;
}
public String getWsdlUrl() {
@@ -212,7 +225,11 @@
}
public void setWsdlUser(String wsdlUser) {
- this.wsdlUser = wsdlUser;
+ if (wsdlUser != null && wsdlUser.length() == 0) {
+ this.wsdlUser = null;
+ } else {
+ this.wsdlUser = wsdlUser;
+ }
}
public String getWsdlPwd() {
@@ -220,9 +237,49 @@
}
public void setWsdlPwd(String wsdlPwd) {
- this.wsdlPwd = wsdlPwd;
+ if (wsdlPwd != null && wsdlPwd.length() == 0) {
+ this.wsdlPwd = null;
+ } else {
+ this.wsdlPwd = wsdlPwd;
+ }
}
+ public String getInvocationUrl() {
+ return invocationUrl;
+ }
+
+ public void setInvocationUrl(String invocationUrl) {
+ if (invocationUrl != null && invocationUrl.length() == 0) {
+ this.invocationUrl = null;
+ } else {
+ this.invocationUrl = invocationUrl;
+ }
+ }
+
+ public String getInvocationUser() {
+ return invocationUser;
+ }
+
+ public void setInvocationUser(String invocationUser) {
+ if (invocationUser != null && invocationUser.length() == 0) {
+ this.invocationUser = null;
+ } else {
+ this.invocationUser = invocationUser;
+ }
+ }
+
+ public String getInvocationPwd() {
+ return invocationPwd;
+ }
+
+ public void setInvocationPwd(String invocationPwd) {
+ if (invocationPwd != null && invocationPwd.length() == 0) {
+ this.invocationPwd = null;
+ } else {
+ this.invocationPwd = invocationPwd;
+ }
+ }
+
public List<Service> getServices() {
return services;
}
@@ -279,6 +336,14 @@
this.requestPreview = requestPreview;
}
+ public String getRequestActiveTab() {
+ return requestActiveTab;
+ }
+
+ public void setRequestActiveTab(String requestActiveTab) {
+ this.requestActiveTab = requestActiveTab;
+ }
+
private static void logException(Exception e) {
logger.error("", e);
}
Modified: webgui/trunk/src/main/webapp/index.xhtml
===================================================================
--- webgui/trunk/src/main/webapp/index.xhtml 2013-03-20 11:47:24 UTC (rev 539)
+++ webgui/trunk/src/main/webapp/index.xhtml 2013-03-20 11:56:40 UTC (rev 540)
@@ -57,126 +57,139 @@
<rich:panel header="Request" rendered="#{not empty clientConversationBean.inputTree}">
<h:form id="parInput">
- <rich:tree id="richTree" var="node" value="#{clientConversationBean.inputTree}" nodeType="#{node.kind}"
- switchType="ajax" binding="#{clientConversationBean.inTree}">
- <rich:treeNode type="simple">
- <h:outputText value="#{node.type} : #{node.name} " />
- <h:selectBooleanCheckbox id="foo-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
- <f:ajax />
- </h:selectBooleanCheckbox>
- <h:inputText value="#{node.value}" id="foo" label="" rendered="#{node.type!='boolean' and node.type!='Boolean'}" columns="10" >
- <f:ajax event="valueChange" render="foo-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
- </h:inputText>
- <h:selectOneMenu value="#{node.value}" rendered="#{node.type=='boolean' or node.type=='Boolean'}">
- <f:selectItem itemValue="true" itemLabel="true" />
- <f:selectItem itemValue="false" itemLabel="false" />
- </h:selectOneMenu>
- <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
- Remove
- </a4j:commandLink>
- </rich:treeNode>
- <rich:treeNode type="group">
- <h:outputText value="[#{node.type}]" styleClass="tipoCampo" />
- <h:selectBooleanCheckbox value="#{node.notNil}" disabled="true" />
- <h:outputText value=" " />
- <a4j:commandLink name="Add" action="#{clientConversationBean.addChild(node)}" reRender="richTree">
- Add
- </a4j:commandLink>
- <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
- Remove
- </a4j:commandLink>
- </rich:treeNode>
- <rich:treeNode type="lazy">
- <h:outputText value="#{node.type} ..." />
- <h:outputText value=" " />
- <a4j:commandLink name="Load" action="#{clientConversationBean.lazyLoadChild(node)}" reRender="richTree" rendered="#{not node.resolved}">
- Load
- </a4j:commandLink>
- <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
- Remove
- </a4j:commandLink>
- </rich:treeNode>
- <rich:treeNode type="complex">
- <h:outputText value="#{node.type} : #{node.name} " />
- <h:selectBooleanCheckbox value="#{node.notNil}" disabled="#{node.notNillable}" >
- <f:ajax />
- </h:selectBooleanCheckbox>
- <h:outputText value=" " />
- <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
- Remove
- </a4j:commandLink>
- </rich:treeNode>
- <rich:treeNode type="Parameterized">
- <h:outputText value="{#{node.namespace}} " />
- <h:selectBooleanCheckbox value="#{node.notNil}" disabled="true" />
- </rich:treeNode>
- <rich:treeNode type="XMLGregorianCalendar">
- <h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
- <h:selectBooleanCheckbox id="foo2-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
- <f:ajax />
- </h:selectBooleanCheckbox>
- <rich:calendar id="foo2" value="#{node.valueDate}" popup="true" showInput="true" enableManualInput="false" >
- <f:ajax event="change" render="foo2-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
- </rich:calendar>
- <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
- Remove
- </a4j:commandLink>
- </rich:treeNode>
- <rich:treeNode type="Duration">
- <h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
- <h:selectBooleanCheckbox id="foo3-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
- <f:ajax />
- </h:selectBooleanCheckbox>
- <h:inputText id="foo3" value="#{node.value}">
- <f:ajax event="valueChange" render="foo3-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
- </h:inputText>
- <h:outputText value="(MilliSeconds)" target="_blank" />
- <h:outputText value=" " />
- <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
- Remove
- </a4j:commandLink>
- </rich:treeNode>
- <rich:treeNode type="qname">
- <h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
- <h:selectBooleanCheckbox id="foo4-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
- <f:ajax />
- </h:selectBooleanCheckbox>
- <h:inputText id="foo4" value="#{node.nameSpace}">
- <f:ajax event="valueChange" render="foo4-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
- </h:inputText>
- <h:outputText value=" : " />
- <h:inputText value="#{node.localPart}" />
- <h:outputText value=" " />
- <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
- Remove
- </a4j:commandLink>
- </rich:treeNode>
- <rich:treeNode type="Enumeration">
- <h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
- <h:selectBooleanCheckbox id="foo5-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
- <f:ajax />
- </h:selectBooleanCheckbox>
- <h:selectOneMenu id="foo5" value="#{node.value}" onfocus="document.getElementById(this.id + '-chk').checked=true">
- <f:selectItems value="#{node.validValue}" />
- </h:selectOneMenu>
- <h:outputText value=" " />
- <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
- Remove
- </a4j:commandLink>
- </rich:treeNode>
- <rich:treeNode type="byteArray">
- <h:outputText value="#{node.type} : #{node.name} " />
- <h:selectBooleanCheckbox id="foo6-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
- <f:ajax />
- </h:selectBooleanCheckbox>
- <h:inputText value="#{node.value}" id="foo6" >
- <f:ajax event="valueChange" render="foo6-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
- </h:inputText>
- <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
- Remove
- </a4j:commandLink>
- </rich:treeNode>
- </rich:tree>
+ <rich:tabPanel switchType="ajax" activeItem="#{clientConversationBean.requestActiveTab}">
+ <rich:tab header="Parameters ">
+ <rich:tree id="richTree" var="node" value="#{clientConversationBean.inputTree}" nodeType="#{node.kind}"
+ switchType="ajax" binding="#{clientConversationBean.inTree}">
+ <rich:treeNode type="simple">
+ <h:outputText value="#{node.type} : #{node.name} " />
+ <h:selectBooleanCheckbox id="foo-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
+ <f:ajax />
+ </h:selectBooleanCheckbox>
+ <h:inputText value="#{node.value}" id="foo" label="" rendered="#{node.type!='boolean' and node.type!='Boolean'}" columns="10" >
+ <f:ajax event="valueChange" render="foo-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
+ </h:inputText>
+ <h:selectOneMenu value="#{node.value}" rendered="#{node.type=='boolean' or node.type=='Boolean'}">
+ <f:selectItem itemValue="true" itemLabel="true" />
+ <f:selectItem itemValue="false" itemLabel="false" />
+ </h:selectOneMenu>
+ <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+ Remove
+ </a4j:commandLink>
+ </rich:treeNode>
+ <rich:treeNode type="group">
+ <h:outputText value="[#{node.type}]" styleClass="tipoCampo" />
+ <h:selectBooleanCheckbox value="#{node.notNil}" disabled="true" />
+ <h:outputText value=" " />
+ <a4j:commandLink name="Add" action="#{clientConversationBean.addChild(node)}" reRender="richTree">
+ Add
+ </a4j:commandLink>
+ <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+ Remove
+ </a4j:commandLink>
+ </rich:treeNode>
+ <rich:treeNode type="lazy">
+ <h:outputText value="#{node.type} ..." />
+ <h:outputText value=" " />
+ <a4j:commandLink name="Load" action="#{clientConversationBean.lazyLoadChild(node)}" reRender="richTree" rendered="#{not node.resolved}">
+ Load
+ </a4j:commandLink>
+ <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+ Remove
+ </a4j:commandLink>
+ </rich:treeNode>
+ <rich:treeNode type="complex">
+ <h:outputText value="#{node.type} : #{node.name} " />
+ <h:selectBooleanCheckbox value="#{node.notNil}" disabled="#{node.notNillable}" >
+ <f:ajax />
+ </h:selectBooleanCheckbox>
+ <h:outputText value=" " />
+ <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+ Remove
+ </a4j:commandLink>
+ </rich:treeNode>
+ <rich:treeNode type="Parameterized">
+ <h:outputText value="{#{node.namespace}} " />
+ <h:selectBooleanCheckbox value="#{node.notNil}" disabled="true" />
+ </rich:treeNode>
+ <rich:treeNode type="XMLGregorianCalendar">
+ <h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
+ <h:selectBooleanCheckbox id="foo2-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
+ <f:ajax />
+ </h:selectBooleanCheckbox>
+ <rich:calendar id="foo2" value="#{node.valueDate}" popup="true" showInput="true" enableManualInput="false" >
+ <f:ajax event="change" render="foo2-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
+ </rich:calendar>
+ <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+ Remove
+ </a4j:commandLink>
+ </rich:treeNode>
+ <rich:treeNode type="Duration">
+ <h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
+ <h:selectBooleanCheckbox id="foo3-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
+ <f:ajax />
+ </h:selectBooleanCheckbox>
+ <h:inputText id="foo3" value="#{node.value}">
+ <f:ajax event="valueChange" render="foo3-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
+ </h:inputText>
+ <h:outputText value="(MilliSeconds)" target="_blank" />
+ <h:outputText value=" " />
+ <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+ Remove
+ </a4j:commandLink>
+ </rich:treeNode>
+ <rich:treeNode type="qname">
+ <h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
+ <h:selectBooleanCheckbox id="foo4-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
+ <f:ajax />
+ </h:selectBooleanCheckbox>
+ <h:inputText id="foo4" value="#{node.nameSpace}">
+ <f:ajax event="valueChange" render="foo4-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
+ </h:inputText>
+ <h:outputText value=" : " />
+ <h:inputText value="#{node.localPart}" />
+ <h:outputText value=" " />
+ <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+ Remove
+ </a4j:commandLink>
+ </rich:treeNode>
+ <rich:treeNode type="Enumeration">
+ <h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
+ <h:selectBooleanCheckbox id="foo5-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
+ <f:ajax />
+ </h:selectBooleanCheckbox>
+ <h:selectOneMenu id="foo5" value="#{node.value}" onfocus="document.getElementById(this.id + '-chk').checked=true">
+ <f:selectItems value="#{node.validValue}" />
+ </h:selectOneMenu>
+ <h:outputText value=" " />
+ <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+ Remove
+ </a4j:commandLink>
+ </rich:treeNode>
+ <rich:treeNode type="byteArray">
+ <h:outputText value="#{node.type} : #{node.name} " />
+ <h:selectBooleanCheckbox id="foo6-chk" value="#{node.notNil}" disabled="#{node.notNillable}" >
+ <f:ajax />
+ </h:selectBooleanCheckbox>
+ <h:inputText value="#{node.value}" id="foo6" >
+ <f:ajax event="valueChange" render="foo6-chk" listener="#{clientConversationBean.onInputFocus(node)}" />
+ </h:inputText>
+ <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+ Remove
+ </a4j:commandLink>
+ </rich:treeNode>
+ </rich:tree>
+ </rich:tab>
+ <rich:tab header="Options">
+ <h:outputLabel value="Override target address:" for="invUrlInput"/>
+ <h:inputText id="invUrlInput" value="#{clientConversationBean.invocationUrl}" /><br/><br/>
+ <h:outputLabel value="User:" for="invUser"/>
+ <h:inputText id="invUser" value="#{clientConversationBean.invocationUser}" />
+ <h:outputLabel value="Password:" for="invPwd"/>
+ <h:inputSecret id="invPwd" value="#{clientConversationBean.invocationPwd}" redisplay="true" />
+ </rich:tab>
+ </rich:tabPanel>
+
<a4j:commandButton value="Perform invocation" render="opSelectionPanel" rerender="opSelectionPanel"
action="#{clientConversationBean.performInvocation}" status="perfInvStatus" />
<h:outputText value=" " />
@@ -196,6 +209,7 @@
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:panel>
11 years, 9 months
wise SVN: r539 - in core/trunk/core/src: test/java/org/jboss/wise/core/client/impl/reflection and 1 other directory.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-03-20 07:47:24 -0400 (Wed, 20 Mar 2013)
New Revision: 539
Modified:
core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodCaller.java
core/trunk/core/src/test/java/org/jboss/wise/core/client/impl/reflection/WSMethodImplTest.java
Log:
[WISE-190] Remove ENDPOINT_ADDRESS props from BindingProvider when the target url is not specified
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-03-19 17:02:41 UTC (rev 538)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/EndpointMethodCaller.java 2013-03-20 11:47:24 UTC (rev 539)
@@ -113,6 +113,8 @@
if (epInstance.getTargetUrl() != null) {
((BindingProvider)epUnderlyingObjectInstance.get()).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
epInstance.getTargetUrl());
+ } else {
+ ((BindingProvider)epUnderlyingObjectInstance.get()).getRequestContext().remove(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
}
}
Modified: core/trunk/core/src/test/java/org/jboss/wise/core/client/impl/reflection/WSMethodImplTest.java
===================================================================
--- core/trunk/core/src/test/java/org/jboss/wise/core/client/impl/reflection/WSMethodImplTest.java 2013-03-19 17:02:41 UTC (rev 538)
+++ core/trunk/core/src/test/java/org/jboss/wise/core/client/impl/reflection/WSMethodImplTest.java 2013-03-20 11:47:24 UTC (rev 539)
@@ -36,6 +36,10 @@
import javax.jws.Oneway;
import javax.jws.WebParam;
import javax.jws.WebParam.Mode;
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.EndpointReference;
+
import org.jboss.wise.core.client.InvocationResult;
import org.jboss.wise.core.client.WSEndpoint;
import org.jboss.wise.core.mapper.WiseMapper;
@@ -45,7 +49,7 @@
/**
* @author stefano.maestri(a)javalinux.it
*/
-public class WSMethodImplTest {
+public class WSMethodImplTest implements BindingProvider {
private boolean methodWorked = false;
@@ -280,4 +284,35 @@
}
+
+
+ // BindingProvider methods, required as the current class is used as test WSEndpoint here...
+ @Override
+ public Map<String, Object> getRequestContext() {
+ return new HashMap<String, Object>();
+ }
+
+ @Override
+ public Map<String, Object> getResponseContext() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Binding getBinding() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public EndpointReference getEndpointReference() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
11 years, 9 months
wise SVN: r538 - in core/trunk/integration-testsuite/common/src/test: resources and 1 other directory.
by wise-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-03-19 13:02:41 -0400 (Tue, 19 Mar 2013)
New Revision: 538
Added:
core/trunk/integration-testsuite/common/src/test/resources/basic-local.wsdl
Modified:
core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java
Log:
[WISE-190] Adding testcase
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-27 01:03:54 UTC (rev 537)
+++ core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java 2013-03-19 17:02:41 UTC (rev 538)
@@ -22,6 +22,8 @@
package org.jboss.wise.test.integration.basic;
import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.Map;
@@ -30,6 +32,7 @@
import org.jboss.wise.core.client.WSMethod;
import org.jboss.wise.core.client.builder.WSDynamicClientBuilder;
import org.jboss.wise.core.client.factories.WSDynamicClientFactory;
+import org.jboss.wise.core.exception.InvocationException;
import org.jboss.wise.core.test.WiseTest;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -61,11 +64,47 @@
Assert.assertTrue(bos.toString().contains("<arg0>from-wise-client</arg0>"));
InvocationResult result = method.invoke(args, null);
Map<String, Object> res = result.getMapRequestAndResult(null, null);
+ @SuppressWarnings("unchecked")
Map<String, Object> test = (Map<String, Object>) res.get("results");
client.close();
Assert.assertEquals("from-wise-client", test.get("result"));
}
+ @Test
+ public void shouldAllowOverridingTargetEndpoint() throws Exception {
+
+ final File targetDir = new File("target", "test-classes");
+ URL wsdlURL = new File(targetDir, "basic-local.wsdl").toURI().toURL();
+
+ WSDynamicClientBuilder clientBuilder = WSDynamicClientFactory.getJAXWSClientBuilder();
+ WSDynamicClient client = clientBuilder.tmpDir("target/temp/wise").verbose(true).keepSource(true).wsdlURL(wsdlURL
+ .toString()).build();
+ 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;
+ try {
+ result = method.invoke(args, null);
+ Assert.fail("Invocation should have failed because of invalid target endpoint address");
+ } catch (InvocationException ie) {
+ //expected
+ Assert.assertTrue(ie.getCause().getCause() instanceof InvocationTargetException);
+ }
+
+ method.getEndpoint().setTargetUrl(getServerHostAndPort() + "/basic/HelloWorld");
+ result = method.invoke(args, null);
+
+ Map<String, Object> res = result.getMapRequestAndResult(null, null);
+ @SuppressWarnings("unchecked")
+ Map<String, Object> test = (Map<String, Object>) res.get("results");
+ client.close();
+ Assert.assertEquals("from-wise-client", test.get("result"));
+ }
+
@AfterClass
public static void tearDown() throws Exception {
try {
Added: core/trunk/integration-testsuite/common/src/test/resources/basic-local.wsdl
===================================================================
--- core/trunk/integration-testsuite/common/src/test/resources/basic-local.wsdl (rev 0)
+++ core/trunk/integration-testsuite/common/src/test/resources/basic-local.wsdl 2013-03-19 17:02:41 UTC (rev 538)
@@ -0,0 +1,52 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<wsdl:definitions name="HelloService" targetNamespace="http://www.javalinux.it/helloworld" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.javalinux.it/helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+<xs:schema elementFormDefault="unqualified" targetNamespace="http://www.javalinux.it/helloworld" version="1.0" xmlns:tns="http://www.javalinux.it/helloworld" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+<xs:element name="echo" type="tns:echo"/>
+<xs:element name="echoResponse" type="tns:echoResponse"/>
+<xs:complexType name="echo">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+<xs:complexType name="echoResponse">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
+ </wsdl:types>
+ <wsdl:message name="echoResponse">
+ <wsdl:part element="tns:echoResponse" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="echo">
+ <wsdl:part element="tns:echo" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloWorldInterface">
+ <wsdl:operation name="echo">
+ <wsdl:input message="tns:echo" name="echo">
+ </wsdl:input>
+ <wsdl:output message="tns:echoResponse" name="echoResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloServiceSoapBinding" type="tns:HelloWorldInterface">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="echo">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="echo">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="echoResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port binding="tns:HelloServiceSoapBinding" name="HelloWorldBeanPort">
+ <soap:address location="http://replace.me:8976/foo/bar"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
11 years, 9 months