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>
Show replies by date