This commit was manufactured by cvs2svn to create branch
'R1_5_maintenance_patches'.
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.consumption.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..1d6f177
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,78 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %PLUGIN_NAME
+Bundle-SymbolicName: org.eclipse.jst.ws.consumption.ui; singleton:=true
+Bundle-Version: 1.0.106.qualifier
+Bundle-Activator: org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin
+Bundle-Vendor: %PLUGIN_PROVIDER
+Bundle-Localization: plugin
+Export-Package: org.eclipse.jst.ws.internal.consumption.ui;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.action;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.ant;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.command;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.command.data;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.common;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.extension;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.plugin;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.preferences;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.selection;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.server;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.widgets;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.widgets.binding;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.widgets.object;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.widgets.test;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.widgets.test.explorer;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.wizard;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.wsil;x-internal:=true,
+ org.eclipse.jst.ws.internal.consumption.ui.wsrt;x-internal:=true
+Require-Bundle: org.eclipse.wst.ws.parser;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.wst.command.env;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.wst.command.env.ui;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.wst.command.env.core;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.jst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.ws.explorer;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.jst.ws;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.jst.ws.ui;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.jst.ws.consumption;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.jem;bundle-version="[1.2.0,1.3.0)",
+ org.eclipse.jem.workbench;bundle-version="[1.2.0,1.3.0)",
+ org.eclipse.emf.common;bundle-version="[2.2.0,2.3.0)",
+ org.eclipse.emf.ecore;bundle-version="[2.2.0,2.3.0)",
+ org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,3.3.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,3.3.0)",
+ org.eclipse.wst.ws;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.jem.workbench;bundle-version="[1.2.0,1.3.0)",
+ org.eclipse.emf.ecore.xmi;bundle-version="[2.2.0,2.3.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.102,1.1.0)",
+ org.eclipse.wst.server.ui;bundle-version="[1.0.102,1.1.0)",
+ org.eclipse.wst.wsdl;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.jst.j2ee;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.core;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.ejb;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.web;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.emf;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.webservice;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.webservice.ui;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.modulecore;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.ws.ui;bundle-version="[1.0.103,1.1.0)",
+ org.wsdl4j;bundle-version="[1.4.0,1.5.0)",
+ org.eclipse.jem.util;bundle-version="[1.2.0,1.3.0)",
+ org.eclipse.wst.wsdl.validation;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.frameworks.ui;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.environment;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.wst.common.project.facet.core;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.server.core;bundle-version="[1.0.102,1.1.0)",
+ org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
+ com.ibm.icu;bundle-version="[3.4.4,3.5.0)",
+ org.apache.xerces;bundle-version="[2.8.0,2.9.0)",
+ org.eclipse.ui.forms;bundle-version="[3.2.0,3.3.0)"
+Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties
new file mode 100644
index 0000000..1508ab9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties
@@ -0,0 +1,636 @@
+###############################################################################
+# Copyright (c) 2004, 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+# yyyymmdd bug      Email and other contact information
+# -------- -------- -----------------------------------------------------------
+#  20060204 124143   rsinha@ca.ibm.com - Rupam Kuehner
+#  20060204 124408   rsinha@ca.ibm.com - Rupam Kuehner     
+# 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
+# 20060321   128827 joan - Joan Haggarty
+# 20060329   128069 rsinha@ca.ibm.com - Rupam Kuehner
+# 20060407   135443 joan@ca.ibm.com - Joan Haggarty
+# 20060411   136134 kathy@ca.ibm.com - Kathy Chan
+# 20060417   136390 joan@ca.ibm.com - Joan Haggarty
+# 20060413   135581 rsinha@ca.ibm.com - Rupam Kuehner
+# 20060418   136335 joan@ca.ibm.com - Joan Haggarty
+# 20060420   136158 rsinha@ca.ibm.com - Rupam Kuehner
+# 20060420   120714 kathy@ca.ibm.com - Kathy Chan
+# 20060420   135912 joan@ca.ibm.com - Joan Haggarty
+# 20060510   141115 rsinha@ca.ibm.com - Rupam Kuehner
+# 20060509   119296 pmoogk@ca.ibm.com - Peter Moogk
+# 20060602   145054 kathy@ca.ibm.com - Kathy Chan
+# 20070424   177360 pmoogk@ca.ibm.com - Peter Moogk
+###############################################################################
+
+#
+# Messages in plugin.xml.
+#
+
+PLUGIN_NEW_WIZARD_NAME_WS_CLIENT=Web Service Client
+#
+# Web services "Internet" preferences extension.
+#
+
+#
+# Web Samples IDs
+#
+
+#
+# Pop-up actions
+#
+ACTION_GENERATE_JAVA_PROXY=Generate Client
+
+#
+# Dialogs
+#
+CHECKBOX_SHOW_GENERATE_JAVA_PROXY_DIALOG=Show Generate Java bean Proxy Dialog
+TOOLTIP_PPAD_CHECKBOX_WSDL2PROXY=Show the dialog for generating the Java bean proxy action.
+
+#
+#       Web Services Preferance Pages
+#
+# Categories
+#
+
+#
+# Preferences Tooltips
+#
+
+#
+#Server Runtime Preferences
+#
+TOOLTIP_SRPF_COMBO_SERVER=The preferred server type
+TOOLTIP_SRPF_COMBO_RUNTIME=The preferred Web service runtime
+TOOLTIP_SRPF_COMBO_J2EE=The preferred J2EE version
+
+#
+# General messages.
+#
+MSG_ERROR_TASK_EXCEPTED=IWAB0234E An internal error occurred. Details: {0}
+MSG_ERROR_NO_SERVER_RUNTIME=No suitable server can be found for the {0} Web service runtime. Go to Window > Preferences. Select Server > Installed Runtimes and configure a server runtime.
+
+
+#
+# Wizard page task labels and descriptions
+# (used only for progress indication).
+#
+
+#
+# Common wizard strings.
+#
+LABEL_FOLDER_NAME=Folder:
+LABEL_JSP_FOLDER_NAME=JSP folder:
+LABEL_WEB_PROJECT_NAME=Web project:
+LABEL_WEBSERVICETYPE=&Web service type:
+LABEL_WEBSERVICEIMPL=Service implementation:
+LABEL_WEBSERVICEDEF=Service definition:
+LABEL_J2EE_VERSION=J2EE version:
+LABEL_NA=N/A
+
+BUTTON_BROWSE=B&rowse...
+BUTTON_BROWSE_FILES=Browse files...
+
+BOTTOMUP_LABEL=Bottom up
+TOPDOWN_LABEL=Top down
+CLIENT_LABEL=Client
+COMBINED_TYPE_AND_RUNTIME_LABEL={0} {1}
+
+#
+# Wizards.
+#
+WIZARD_TITLE_WSC=Web Service Client
+
+#
+# WebServiceProjectPage
+#
+PAGE_TITLE_WS_PROJECT=Web Services
+PAGE_DESC_WS_PROJECT=Review your Web service options and make any necessary changes before proceeding to the next page.
+BUTTON_START_WEB_PROJECT=&Start Web service in Web project
+#BUTTON_DEPLOY_WEB_PROJECT=Deploy Web service to a server type
+BUTTON_INSTALL_SERVICE_WEB_PROJECT=&Install Web service on server
+BUTTON_INSTALL_CLIENT_WEB_PROJECT=Install Web service &client on server (managed clients only)
+GROUP_SCENARIO_SERVICE=Service
+GROUP_SCENARIO_CLIENT=Client proxy
+LABEL_WEBSERVICECLIENTTYPE=&Client type:
+
+TOOLTIP_WSWSCEN_SERVICEPROJECT_LINK=Click on the link to edit service project and EAR settings.
+TOOLTIP_WSWSCEN_CLIENTPROJECT_LINK=Click on the link to edit client project and EAR settings.
+
+DIALOG_TITILE_SERVICE_IMPL_SELECTION=Select Service Implementation
+DIALOG_TITILE_SERVICE_DEF_SELECTION=Select Service Definition
+DIALOG_TITILE_SERVICE_PROJECT_SETTINGS=Specify Service Project Settings
+DIALOG_TITILE_CLIENT_PROJECT_SETTINGS=Specify Client Project Settings
+
+# Items common to WebServiceRuntimeSelectionPage and WebServiceClientRuntimeSelectionPage
+# WebServiceRuntimeSelectionPage
+LABEL_SUMMARY=Configuration:
+LABEL_SUMMARY_NO_CLIENT=Configuration: No client generation.
+PAGE_TITLE_WS_RUNTIME_SELECTION=Service Deployment Configuration
+PAGE_DESC_WS_RUNTIME_SELECTION=Choose from the list of runtimes and deployment servers, or use the default settings.
+LABEL_RUNTIMES_LIST=Web service runtime:
+LABEL_SERVERS_LIST=Server:
+LABEL_EDIT_BUTTON=Edit...
+LABEL_SERVICE_EAR_MODULE=Service EAR module:
+LABEL_CLIENT_EAR_MODULE=Client EAR module:
+LABEL_CLIENT_MODULE=Client module:
+LABEL_SERVICE_MODULE=Service module:
+LABEL_CLIENT_PROJECT=Client project:
+LABEL_SERVICE_PROJECT=Service project:
+LABEL_CLIENT_EAR_PROJECT=Client EAR project:
+LABEL_SERVICE_EAR_PROJECT=Service EAR project:
+
+#
+# Client component type labels
+#
+LABEL_CLIENT_COMP_TYPE_WEB=Web
+LABEL_CLIENT_COMP_TYPE_EJB=EJB
+LABEL_CLIENT_COMP_TYPE_APP_CLIENT=Application Client
+LABEL_CLIENT_COMP_TYPE_CONTAINERLESS=Java
+
+
+TOOLTIP_PWRS_TEXT_RUNTIME=Click on the link to specify the web service runtime.
+TOOLTIP_PWRS_TEXT_SERVER=Click on the link to specify a server.
+TOOLTIP_PWRS_J2EE_VERSION=J2EE version to be used.
+
+LABEL_SELECTION_VIEW_TITLE=Server-Side Deployment Selection:
+LABEL_SELECTION_VIEW_RUNTIME=Choose Web service runtime first
+LABEL_SELECTION_VIEW_SERVER=Choose server first
+LABEL_SELECTION_VIEW_EXPLORE=Explore options
+
+LABEL_TREE_EXISTING_SERVERS=Existing Servers
+LABEL_TREE_SERVER_TYPES=Server Types
+
+MSG_NO_OBJECT_SELECTION=Select a service implementation.
+MSG_NO_SERVICE_SELECTION=Select a service definition.
+MSG_INVALID_SERVICE_IMPL=The service implementation selected is invalid.
+MSG_INVALID_SERVICE_DEF=The service definition selected is invalid.
+MSG_INVALID_SRT_SELECTIONS={0} does not support the {1} Web service runtime. Choose a different server or runtime to proceed through the Web services wizard.
+MSG_NO_RUNTIME=No runtime specified for the {0} scenario.
+MSG_NO_SERVER=No server specified for the {0} scenario.
+MSG_ERROR_STUB_ONLY={0} has only stub runtimes associated with it. Choose a different server or configure a non-stub runtime in the server preferences. 
+MSG_WARN_STUB_ONLY={0} has only stub runtimes associated with it so the server will not be created or started.
+MSG_WARN_NO_SERVICE_SERVER=No server has been selected. The Web service will not be deployed, installed, or run.
+MSG_WARN_NO_CLIENT_SERVER=No server has been selected. The Web service client will not be deployed, installed, or run.
+
+MSG_SERVER_TARGET_MISMATCH=The project, {0}, has a server target which is not compatible with the selected server type
+MSG_J2EE_MISMATCH=The project, {0}, has a different J2EE level from the selected J2EE level
+MSG_SERVICE_PROJECT_EMPTY=The service project {0} cannot be empty. Select a service project {0}.
+MSG_SERVICE_PROJECT_TYPE_EMPTY=Select a service project type.
+MSG_SERVICE_EAR_EMPTY=The service EAR {0} cannot be empty. Select a service EAR {0}.
+MSG_CLIENT_PROJECT_EMPTY=The client project {0} cannot be empty. Select a client project {0}.
+MSG_CLIENT_PROJECT_TYPE_EMPTY=Select a client project type.
+MSG_CLIENT_EAR_EMPTY=The client EAR {0} cannot be empty. Select a client EAR {0}.
+
+MSG_INVALID_EJB_PROJECT={0} is not an EJB project. Choose an EJB project, or enter a new EJB project name.
+MSG_INVALID_WEB_PROJECT={0} is not a Web project. Choose a Web project, or enter a new Web project name.
+MSG_INVALID_PROJECT_TYPE={0} is not a {1} project. Choose a {1} project, or enter a new project name.
+MSG_MODULE=module
+MSG_MODULE_NAME_AND_PROJECT_NAME_NOT_THE_SAME=The flexible project preference is off. Therefore, project names and module names must be the same for new modules.
+
+MSG_SERVICE_RUNTIME_DOES_NOT_SUPPORT_PROJECT=The {0} Web service runtime does not support the service project {1}.
+MSG_SERVICE_SERVER_DOES_NOT_SUPPORT_PROJECT=The {0} server does not support the service project {1}. 
+MSG_SERVICE_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE=The {0} Web service runtime does not support the service project type {1}.
+MSG_SERVICE_SERVER_DOES_NOT_SUPPORT_TEMPLATE=The {0} server does not support the service project type {1}.
+
+MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_PROJECT=The {0} Web service runtime does not support the client project {1}.
+MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_PROJECT=The {0} server does not support the client project {1}.
+MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE=The {0} Web service runtime does not support the client project type {1}.
+MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_TEMPLATE=The {0} server does not support the client project type {1}.
+
+MSG_SAME_CLIENT_AND_SERVICE_EARS=Your selected service and client {0} modules have the same name.  Proceeding with this configuration may result in runtime errors.
+MSG_SAME_CLIENT_AND_SERVICE_COMPONENTS=Your selected service and client {0} modules have the same name.  Proceeding with this configuration will result in runtime errors.
+MSG_SAME_CLIENT_AND_SERVICE_PROJECTS=Your selected service and client projects are the same.  Proceeding with this configuration will result in errors.
+MSG_WRONG_CLIENT_PROJECT_TYPE=The selected client project, {0}, is not a {1} project. Please select a {1} project or enter a new project name.
+MSG_CLIENT_SUB=client
+MSG_SERVICE_SUB=service
+MSG_GENERAL_PROJECT_AND_EAR=Select the {0} project and the EAR project with which you want it to be associated.
+MSG_EAR_PROJECT_WILL_BE_CREATED=If an EAR or project does not exist or is currently unassociated, it will be created and \nassociated as required when you click Next.
+
+MSG_EAR_WILL_BE_ASSOCIATED=The selected {0} project will be associated with the EAR project.
+MSG_PROJECT_WILL_BE_CREATED=The {0} project will be created and associated with the EAR project.
+MSG_EAR_WILL_BE_CREATED=The {0} EAR project will be created and associated with the project.
+MSG_PROJECT_AND_EAR_CREATED=The {0} project and EAR project will be created and associated with one another.
+
+MSG_CLIENT_CANNOT_ASSOCIATE=The client project, {0}, cannot be associated with the EAR, {1}. Choose an EAR with a J2EE level of {2} or higher.
+MSG_SERVICE_CANNOT_ASSOCIATE=The service project, {0}, cannot be associated with the EAR, {1}. Choose an EAR with a J2EE level of {2} or higher.
+
+MSG_PROJECT_MUST_EXIST=No server can be found and {0} does not exist. Choose an existing project or use the preferences to configure a server runtime.  
+
+
+# WebServiceClientRuntimeSelectionPage
+PAGE_TITLE_WS_CLIENT_RUNTIME_SELECTION=Client Environment Configuration
+PAGE_DESC_WS_CLIENT_RUNTIME_SELECTION=Choose from the list of supported runtimes and servers for the client environment, or use the default settings.
+
+LABEL_CLIENT_SELECTION_VIEW_TITLE=Client-Side Environment Selection:
+LABEL_CLIENT_TYPE=Client Project type:
+LABEL_SERVICE_TYPE=Service Project type:
+LABEL_WEB=Web
+LABEL_EJB=EJB
+LABEL_NO_LABEL=
+
+#
+# Items common to WebServiceMappingsPage, WebServiceMappingsPage (client), and WebServiceSOAPBindingPage
+#
+PAGE_MSG_VALIDATION_INTERNAL_ERROR=An internal error occurred during page validation. See logs for details.
+
+#
+# WebServiceMappingsPage
+#
+PAGE_TITLE_WS_XML2BEAN=Web Service Skeleton XML to Java Mappings
+PAGE_DESC_N2P_MAPPINGS=Define custom mapping for namespace to package.
+MSG_MAPPING_DUPLICATE_ENTRIES=Duplicate {0} mapped to the same {1}.
+
+
+#
+# The two ITEM_* strings are entries in a list box of mappings.
+# There are two forms, one when the page is in Java-to-XML mode:
+#   <java-bean-name>, <encoding-style>
+# and one when the page is in XML-to-Java mode:
+#   <xml-namespace-uri>:<xml-short-name>, <encoding-style>
+# where:
+#   <java-bean-name> is a fully-qualified Java class name
+#   <xml-namespace-uri> is the namespace of an XML type
+#   <xml-short-name> is the XML type name within the namespace
+#   <encoding-style> is the encoding style (SOAP or Literal XML)
+#
+
+#
+# WebServiceProxyPage
+#
+BUTTON_GENERATE_PROXY=&Generate a proxy
+
+#
+# WebServiceSkeletonConfigPage
+#
+PAGE_DESC_WSSKEL_CONFIG=Define a skeleton Java bean as a Web service.
+PAGE_TITLE_WSSKEL_CONFIG=Web Service Skeleton Java Bean Configuration
+TOOLTIP_PBSC_TEXT_SKELETON_FOLDER=Folder for generated Java skeleton.
+TOOLTIP_PBSC_BUTTON_SKELETON_FOLDER_BROWSE=Browse folders.
+LABEL_SKELETON_ROOT_NAME=Skeleton folder:
+
+#
+# WebServiceBeanClassPage
+#
+LABEL_BEAN_CLASS_NAME=Bean:
+PAGE_MSG_BEAN_CANNOT_BE_EMPTY=Please select a Java bean class.
+BUTTON_BROWSE_CLASSES=Browse classes...
+
+
+#
+# WebServiceTestPage
+#
+PAGE_TITLE_WSTEST=Test Web Service
+PAGE_DESC_WSTEST=Select a test facility
+CHECKBOX_TEST_WEBSERVICE=&Test the Web service
+CHECKBOX_MONITOR_WEBSERVICE=&Monitor the Web service
+CHECKBOX_OVERWRITE_FILES=&Overwrite files without warning
+MSG_ERROR_UNABLE_TO_LAUNCH_WSDL_TEST=An error occurred. Unable to launch WSDL test facility.
+
+#
+# WebServiceExplorerPage
+#
+BUTTON_LAUNCH_SERVICE_TEST=Launch
+
+#
+# WebServiceClientTestPage
+#
+PAGE_TITLE_WS_SAMPLE=Web Service Client Test
+PAGE_DESC_WS_SAMPLE=Do you want to test the generated proxy?
+BUTTON_TEST=Test the generated proxy
+LABEL_TEST_TYPES=Test facility
+BUTTON_RUN_TEST=Run test on server
+LABEL_METHODS=Methods
+LABEL_JSP_PROJECT_NAME=JSP project:
+MSG_ERROR_JTS_PROXY_NOT_COMPILED=IWAB0357E The Generated proxy was not found. WebService sample jsps cannot be generated.
+MSG_ERROR_MALFORMED_URL=IWAB0358E Test client URL is malformed.
+MSG_ERROR_MODULE_DEPENDENCY=Unable to establish module dependency from {0} to {1}.
+
+#
+# WebServiceBeanMethodsPage
+#
+BUTTON_SELECT_ALL=Select All
+BUTTON_DESELECT_ALL=Deselect All
+TOOLTIP_PBME_BUTTON_SELECT_ALL=Select all methods
+TOOLTIP_PBME_BUTTON_DESELECT_ALL=Deselect all methods
+
+#
+# WebServiceWSDLSelectionPage
+#
+PAGE_TITLE_WSDL_SELECTION=Web Service WSDL File Selection
+PAGE_DESC_WSDL_SELECTION=Select a WSDL file.
+
+#
+# WebServicePublishPage
+#
+PAGE_TITLE_WS_PUBLISH=Web Service Publication
+PAGE_DESC_WS_PUBLISH=Do you want to publish your Web service?
+PAGE_TITLE_WS_FIND=Find a Web service
+PAGE_DESC_WS_FIND=Do you want to find a Web service?
+BUTTON_WS_PUBLISH=&Launch the Web Services Explorer to publish this Web service to a UDDI Registry
+BUTTON_WS_PUBLISH_PRIVATE_UDDI=Launch the Web Services Explorer to publish this Web service to the Unit Test UDDI Registry
+BUTTON_WS_FIND=Launch the Web Services Explorer to find a Web service from a UDDI Registry
+BUTTON_WS_FIND_PRIVATE_UDDI=Launch the Web Services Explorer to find a Web service from the Unit Test UDDI Registry
+LABEL_PUBLIC_UDDI_REGISTRIES=Public UDDI Registry
+
+#
+# EJB UI strings
+#
+LABEL_EJB_BEAN_NAME=EJB bean
+TABLE_TITLE_EJB_BEAN_NAMES=Stateless EJB beans
+TABLE_TITLE_EJB_PROJECT_NAME=EJB project
+LABEL_EAR_PROJECTS=EAR projects
+TOOLTIP_EAR_PROJECTS=Enterprise application projects.
+TOOLTIP_TABLE_BEAN_NAMES=Select an EJB.
+LABEL_SHOW_ALL_STATELESS_SESSION_EJBS=<<Show all stateless session EJBs>>
+
+#
+# Tooltips for WebServiceWSDLSelectionPage
+#
+TOOLTIP_PWWS_PAGE=
+
+#
+# Tooltips for Web Service Wizard Scenario Page
+#
+BUTTON_WSWSCEN_PUBLISH=&Publish the Web service
+TOOLTIP_WSWSCEN_SCALE_DEVELOP=Develop
+TOOLTIP_WSWSCEN_SCALE_ASSEMBLE=Assemble
+TOOLTIP_WSWSCEN_SCALE_DEPLOY=Deploy
+TOOLTIP_WSWSCEN_SCALE_INSTALL=Install
+TOOLTIP_WSWSCEN_SCALE_RUN=Start
+TOOLTIP_WSWSCEN_SCALE_TEST=Test
+TOOLTIP_WSWSCEN_SCALE_SERVICE=Move the slider to set the level of service generation.
+TOOLTIP_WSWSCEN_SCALE_CLIENT=Move the slider to set the level of client generation. Service must be started to enable client generation.
+TOOLTIP_WSWSCEN_SCALE_CLIENT_ONLY=Move the slider to set the level of client generation. 
+TOOLTIP_WSWSCEN_TEXT_IMPL=Implementation for the web service.
+TOOLTIP_WSWSCEN_BUTTON_BROWSE_IMPL=Browse implementation files for specified service type.
+TOOLTIP_WSWSCEN_BUTTON_OVERWRITE_FILES=Existing files will be overwritten with no warning during generation.
+
+#
+# Tooltips for beans.WebServiceBeanClassPage
+#
+TOOLTIP_PBCL_PAGE=
+TOOLTIP_PBCL_TEXT_BEAN_CLASS=Selected Java bean.
+TOOLTIP_PBCL_BUTTON_BEAN_CLASS_BROWSE=Browse classes.
+TOOLTIP_PBCL_BUTTON_BEAN_RESOURCE_BROWSE=Browse Java files.
+
+#
+# Tooltips for beans.WebServiceTestPage
+#
+TOOLTIP_PSTP_COMBOBOX_TEST=Test facilities available to test the service.
+TOOLTIP_PSTP_LAUNCH_BUTTON=Launch the selected test facility.
+
+#
+# Tooltips for WebServiceRuntimeSelectionPage
+#
+TOOLTIP_PWRS_PAGE=
+TOOLTIP_PWRS_LIST_RUNTIMES=Select from the following deployment runtime(s).
+TOOLTIP_PWRS_LIST_SERVERS=Select from application server(s).
+TOOLTIP_PWRS_RADIO_SERVER=Server oriented selection.
+TOOLTIP_PWRS_RADIO_RUNTIME=Runtime oriented selection.
+TOOLTIP_PWRS_RADIO_EXPLORE=Explore combinations.
+
+#
+# Tooltips for WebServiceClientRuntimeSelectionPage
+#
+TOOLTIP_PWCR_COMBO_CLIENT_TYPE=Client project type.
+TOOLTIP_PWCR_COMBO_SERVICE_TYPE=Service project type.
+
+#
+# Tooltips for WebServiceProjectPage
+#
+TOOLTIP_PWPR_COMBO_TYPE=Web service implementation type.
+TOOLTIP_PWPR_GROUP_SCENARIO_SERVICE=Service defaults for this wizard scenario.
+TOOLTIP_PWPR_CHECKBOX_GENERATE_PROXY=Enable/disable proxy generation for this scenario.
+TOOLTIP_PWPR_CHECKBOX_START_WEB_PROJECT=Start Web service in Web project for this scenario.
+TOOLTIP_PWPR_CHECKBOX_INSTALL_SERVICE_WEB_PROJECT=Install the Web service on the server for this scenario.
+TOOLTIP_PWPR_CHECKBOX_INSTALL_CLIENT_WEB_PROJECT=Install the Web service client on the server for this scenario (managed client only). 
+TOOLTIP_PWPR_CHECKBOX_LAUNCH_WS=Launch the Web Services Explorer to publish the Web service in this scenario to a UDDI Registry.
+TOOLTIP_PWPR_CHECKBOX_TEST_SERVICE=Select this to explore the Web service created.
+TOOLTIP_PWPR_CHECKBOX_MONITOR_SERVICE=Select this to monitor the SOAP traffic of this Web service.
+TOOLTIP_PWPR_GROUP_SCENARIO_CLIENT=Client proxy defaults for this wizard scenario.
+TOOLTIP_PWPR_COMBO_CLIENTTYPE=Client proxy selection type.
+
+#
+# Tooltips for WebServicePublishPage
+#
+TOOLTIP_PWPB_PAGE=
+TOOLTIP_PWPB_CHECKBOX_WS_LAUNCH=Publish the Web service.
+
+#
+# WSIL proxy
+#
+PAGE_WSIL_IMPORT=WSIL Import Page
+TITLE_WSIL_IMPORT=WSIL Import
+DESC_WSIL_IMPORT=Import WSDL references to a WSIL document
+PAGE_TITLE_WS_SELECTION=Web Service Selection Page
+PAGE_DESC_WS_SELECTION=Enter a web service URI.
+
+PAGE_MSG_LOADING_WEB_SERVICE_URI=Loading Web service URI...
+PAGE_MSG_INVALID_WEB_SERVICE_URI=Invalid Web service URI.  Enter a URI to a WSDL, WSIL or HTML document.
+PAGE_MSG_NO_SUCH_FILE=File "{0}" does not exist.
+PAGE_MSG_SELECTION_MUST_BE_WSDL=Selection must be WSDL.
+PAGE_MSG_INVALID_WSIL_FILE_NAME=Invalid WSIL file name.  WSIL file name must end with .wsil
+
+MSG_ERROR_URI_NOT_RESOLVABLE=IWAB0469E "{0}" is not resolvable.
+MSG_ERROR_WSDL_HAS_NO_SERVICE_ELEMENT=IWAB0551E WSDL file at {0} has no service element.
+
+LABEL_WSIL_URI=WSIL URI:
+LABEL_BROWSE=Browse
+LABEL_WSDL=WSDL:
+LABEL_WSDL_URI=WSDL URI
+LABEL_IMPORT=Import...
+LABEL_ADD=Add
+LABEL_REMOVE=Remove
+LABEL_WS_SELECTION=Enter a URI to a WSDL, WSIL or HTML document:
+LABEL_SELECT_WSDL=Select a WSDL
+LABEL_VALIDATE_MESSAGES=WSDL validation messages:
+
+TOOLTIP_WSIL_IMPORT_PAGE=This page allows you to add WSDL references to a WSIL document.
+TOOLTIP_WSIL_TEXT_WSIL=Enter the location of a new or existing WSIL document.
+TOOLTIP_WSIL_BUTTON_BROWSE_WSIL=Browse for a WSIL document.
+TOOLTIP_WSIL_TABLE_WSDL=Enter the URIs of the WSDLs that are going to be added as service references.
+TOOLTIP_PCON_PAGE=Select a web service for consumption.
+TOOLTIP_PCON_TEXT_WS=Enter a URI to a WSDL, WSIL or HTML document.
+TOOLTIP_PCON_BUTTON_BROWSE_WS=Browse for a web service resource.
+TOOLTIP_VALIDATE_TEXT_MESSAGE=Messages from WSDL validation.
+TOOLTIP_TABLE_VALIDATE_MESSAGE=Use the Web Service Profile Compliance and Validation preference to enable or disable WSDL validation.
+
+#
+# Table column heading for ValidationMessageViewerWidget
+#
+TABLE_COLUMN_VALIDATION_SEVERITY=Severity
+TABLE_COLUMN_VALIDATION_LINE=Line
+TABLE_COLUMN_VALIDATION_COLUMN=Column
+TABLE_COLUMN_VALIDATION_MESSAGE=Message
+#
+# Tooltips for client.WebServiceClienTestPage
+#
+TOOLTIP_PWSM_PAGE=
+TOOLTIP_PWSM_CHECKBOX_TEST=Enable/disable Test.
+TOOLTIP_PWSM_COMBOBOX_TEST=Select the test type.
+TOOLTIP_PWSM_CHECKBOX_LAUNCH=Run test on a server.
+TOOLTIP_PWSM_TEXT_JSP_FOLDER=Destination folder of generated sample files.
+TOOLTIP_PWSM_BUTTON_JSP_FOLDER_BROWSE=Browse folders.
+TOOLTIP_PWSM_BUTTON_SELECT_ALL=Select all methods.
+TOOLTIP_PWSM_BUTTON_DESELECT_ALL=Deselect all methods.
+TOOLTIP_PWSM_COMBO_PROJECT=Web project for generated sample.
+TOOLTIP_PWSM_TEXT_SAMPLE_FOLDER=Destination folder of generated sample files.
+TOOLTIP_PWSM_TREE_METHODS=Methods to generate into the sample.
+TOOLTIP_PWSM_EAR_PROJECT=EAR project for the generated sample.
+
+#
+# HTTP Basic Auth
+#
+DIALOG_TITLE_HTTP_BASIC_AUTH=HTTP Basic Authentication
+LABEL_URL=URL:
+LABEL_HTTP_BASIC_AUTH_USERNAME=User name:
+LABEL_HTTP_BASIC_AUTH_PASSWORD=Password:
+
+TOOLTIP_HTTP_BASIC_AUTH_USERNAME=Enter your HTTP basic authentication user name.
+TOOLTIP_HTTP_BASIC_AUTH_PASSWORD=Enter your HTTP basic authentication password.
+
+#
+# Generate Handler Skeleton
+#
+MSG_ERROR_GENERATE_HANDLER_SKELETON=IWAB0359E Error in generating handler skeleton.
+MSG_ERROR_WRITE_FILE=IWAB0360E Error in writing file {0}.
+
+#
+# Handlers Configuration wizard page
+#
+LABEL_HANDLERS_CONFIG=Handler configuration
+LABEL_BUTTON_ADD=Add
+LABEL_BUTTON_REMOVE=Remove
+LABEL_BUTTON_MOVE_UP=Move up
+LABEL_BUTTON_MOVE_DOWN=Move down
+LABEL_BUTTON_GEN_SKELETON=Generate skeleton classes for new handlers
+LABEL_COMBO_SOURCE_LOC=Output folder:
+LABEL_COMBO_WS_CLIENT_REF=Client Service References:
+LABEL_COMBO_WS_SERVICE_DESC=Service Descriptions:
+MSG_TEXT_NUM_OF_SERVICES=You have selected {0} services.
+MSG_TEXT_NUM_OF_CLIENTS=You have selected {0} client services.
+ 
+LABEL_HANDLER_NAME=Name
+LABLE_HANDLER_CLASS=Class name
+LABEL_HANDLER_PORT=Port name
+ 
+DIALOG_TITLE_WS_ADD_HANDLER=Add New Handler
+LABEL_TEXT_HANDLER_NAME=Name:
+LABEL_TEXT_HANDLER_CLASS=Class name:
+LABEL_TEXT_HANDLER_PORT=Port name:
+ 
+PAGE_TITLE_SERVICE_HDLR_CONFIG=Service Handlers Configuration
+PAGE_DESC_SERVICE_HDLR_CONFIG=Configure service-side handlers
+PAGE_TITLE_CLIENT_HDLR_CONFIG=Client Handlers Configuration
+PAGE_DESC_CLIENT_HDLR_CONFIG=Configure client-side handlers
+PAGE_DESC_MULTIPLE_SERVICES_CONFIG=Add handlers to multiple Web services.
+PAGE_DESC_MULTIPLE_CLIENTS_CONFIG=Add handlers to multiple Web service clients.
+ 
+TOOLTIP_EDIT_WS_HANDLERS=Configure Web Service Handlers
+TOOLTIP_BUTTON_GEN_SKELETON=Select to generate skeleton classes for new handlers.
+TOOLTIP_COMBO_SOURCE_LOC=Select the output location for file generation.
+TOOLTIP_TEXT_HANDLER_NAME=Handler name
+TOOLTIP_TEXT_HANDLER_CLASS=Handler class name
+TOOLTIP_TEXT_HANDLER_PORT=Handler port component name
+TOOLTIP_WS_CLIENT_REF=Select a client service-reference to show its handlers.
+TOOLTIP_WS_SERVICE_DESC=Select a service description to show its handlers.
+ 
+#
+# ClientHandlersWidgetDefaultingCommand
+#
+MSG_ERROR_WEB_SERVICE_CLIENTS_NOT_FOUND=No Web service clients were found. Create a Web service client before configuring Web service client handlers.
+ 
+#
+# ServiceHandlersWidgetDefaultingCommand
+#
+MSG_ERROR_WEB_SERVICES_NOT_FOUND=No Web services were found.  Create a Web service before configuring Web service handlers.
+MSG_ERROR_WSDD_NOT_FOUND=Unable to launch handler wizard.  No deployment descriptor was found for this Web service.
+MSG_ERROR_INVALID_MULTIPLE_SERVICE_SELECT=Invalid multiple selection of Services.  Ensure all selections are Services.#
+
+# OpenJavaEditorCommand
+#
+MSG_ERROR_UNABLE_TO_OPEN_JAVA_EDITOR=IWAB0029E Unable to open class {0} from project {1} in the Java editor.
+
+#
+# CheckIfServiceProject
+#
+MSG_WARN_IS_SERVICE_PROJECT=The selected client project, {0}, contains the Web service. Proceeding with this configuration may result in runtime errors when invoking the Web service. Would you like to proceed?
+MSG_USER_ABORTED=User pressed cancel in warning dialog which warned about the selected client project being the service project.
+
+#
+# Missing third party file error message
+#
+MSG_MISSING_THIRD_PARTY_FILES=Missing third party files.  Refer to http://www.eclipse.org/webtools/wst/components/ws/download_instructions_for_jars.html
+
+#
+# WSDLSelectionOutputCommand
+#
+MSG_WARNING_NO_SERVICE_ELEMENT=The WSDL file does not contain a Service element.  Therefore a service interface and Java proxy will not be generated and as a result, a Java test client will not be launched.  Click OK to proceed, or click Cancel to select another WSDL file.  Alternately, exit the wizard and use the WSDL editor to create a Service WSDL document.
+
+#
+# CheckWSDLValidationCommand
+#
+STILL_VALIDATING_WSDL=Wizard WSDL validation in Progress.  \n- Click Cancel to cancel the current WSDL validation and continue. \n- Click Cancel and Update to update the preference to always cancel incomplete WSDL validation while traversing the wizard.  \n- Click Wait to wait for WSDL validation to complete.
+CANCEL_VALIDATION_LABEL=Cancel
+CANCEL_VALIDATION_DESCRIPTION=Cancel the current WSDL validation and continue
+CANCEL_ALL_VALIDATION_LABEL=Cancel and Update
+CANCEL_ALL_VALIDATION_DESCRIPTION=Update the preference to always cancel incomplete WSDL validation while traversing the wizard.
+WAIT_VALIDATION_LABEL=Wait
+WAIT_VALIDATION_DESCRIPTION=Wait for WSDL validation to complete
+TASK_LABEL_CHECK_WSDL_VALIDATION=Check for WSDL validation
+TASK_DESC_CHECK_WSDL_VALIDATION=Check if WSDL validation has completed
+
+#
+# WSDLValidation messages
+#
+MESSAGE_VALIDATE_NO_WSDL=Wizard WSDL validation is disabled.
+MESSAGE_VALIDATE_REMOTE_WSDL=Wizard WSDL validation is only enabled for remote files.
+MESSAGE_VALIDATE_ALL_WSDL=Wizard WSDL validation is enabled.
+MESSAGE_VALIDATE_IN_PROGRESS=WSDL validation in progress ...
+ERROR_MESSAGES_IN_VALIDATION=The WSDL file contains validation error(s).
+WARNING_MESSAGES_IN_VALIDATION=The WSDL file contains validation warning(s).
+WARNING_IF_CONTINUE=Continuing with the wizard may result in generation or runtime problem.
+VALIDATION_COMPLETED=WSDL validation completes with no warning or error.
+TOOLTIP_VALIDATE_TEXT_MESSAGE_SUMMARY=WSDL validation preference can be changed using the Web Services Profile Compliance and Validation preference.
+
+LABEL_BUTTON_STOP_WSDL_VALIDATION=Stop Validation
+TOOLTIP_STOP_VALIDATION_BUTTON=Stops the current WSDL validation operation.
+
+
+#
+# Start server page
+#
+PAGE_TITLE_WS_START_SERVER=Start Server
+PAGE_DESC_WS_START_SERVER=Start the server from this page.
+LABEL_START_SERVER_TEXT1=In order to proceed the server "{0}" must be started.
+LABEL_START_SERVER_TEXT2=Once the server is started the "next" button will be enabled.
+LABEL_START_SERVER_TEXT3=The "back" button can be used while the server is starting to
+LABEL_START_SERVER_TEXT4=change any previous settings in this wizard.
+LABEL_START_SERVER_BUTTON=&Start server
+TOOLTIP_START_SERVER_BUTTON=Start the server
+TEXT_SERVER_STATUS=Currently the server is {0}.
+TEXT_SERVER_MSG=Server {0}
+TEXT_SERVER_STARTED=started
+TEXT_SERVER_STARTING=starting
+TEXT_SERVER_STOPPED=stopped
+
+#
+# Ant task List options
+#
+
+# Note to translation do not translate keyword RuntimeId
+MSG_INFO_ANT_RUNTIME_HEADING=Web Service Runtime IDs (RuntimeId)
+MSG_INFO_ANT_SERVER_RUNTIME=Server runtime: {0}
+MSG_INFO_ANT_CLIENT_RUNTIME=Client runtime: {0} 
+
+# Note to translation do not translate keyword ServerId
+MSG_INFO_ANT_SERVER_HEADING=Server IDs (ServerId)
+MSG_INFO_ANT_SERVER=Server: {0}
+
+MSG_INFO_WSDL_OPERATION_TIMED_OUT=Could not retrieve the WSDL file {0}.  Do you want to continue to wait for this file?
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/DefaultingUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/DefaultingUtils.java
new file mode 100644
index 0000000..bba32af
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/DefaultingUtils.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060427   138058 joan@ca.ibm.com - Joan Haggarty
+ * 20070723   194434 kathy@ca.ibm.com - Kathy Chan, Check for non-existing EAR with content not deleted
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.common;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jst.ws.internal.common.J2EEUtils;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+public class DefaultingUtils {
+	
+	public DefaultingUtils()
+	{
+			
+	}
+	
+	/**
+	 * 
+	 * Uses the following steps to determine a valid default EAR project name:
+	 *  
+	 * 1. If project does exist:
+	 * 		a - look for an existing, referencing EAR component, if one exists return that EAR name
+	 * 		b - look for an existing EAR component with the same J2EE version as the project
+	 * 2. If can't find an appropriate existing EAR component or project does not exist in the 
+	 *     workspace, return a new EAR name of form projectNameEAR
+	 * 3. If project name is null or an empty string return the default EAR name
+	 * 
+	 * @param projectName a string representing the name of the project for the service
+	 * @return a string to be used as the default EAR project name for the project name provided
+	 */
+	public static String getDefaultEARProjectName(String projectName)
+	{
+
+		if (projectName != null && projectName.length() > 0) {
+			
+			IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+
+			if (proj.exists()) {
+				
+				//Step 1a - return a referencing EAR project
+				IVirtualComponent[] ears = J2EEUtils.getReferencingEARComponents(proj);
+				if (ears != null && ears.length > 0) {
+					return ears[0].getName();
+				}
+				
+				//Step 1b - return an appropriate existing EAR project
+			    IVirtualComponent[] allEarComps = J2EEUtils.getAllEARComponents();			      
+
+			    if (allEarComps.length > 0)
+			    {			      
+			        for (int i=0; i < allEarComps.length; i++)
+			        {
+			          IProject earProject = allEarComps[i].getProject();
+			          IStatus associationStatus = J2EEUtils.canAssociateProjectToEAR(proj, earProject);
+			          if (associationStatus.getSeverity()==IStatus.OK)
+			          {
+			            return allEarComps[i].getName(); 
+			          }
+			        }			      			      
+			    }
+			}
+			
+			
+			String baseEARName = projectName + ResourceUtils.getDefaultEARExtension();
+			String earName = baseEARName;
+
+			boolean foundEAR = false;
+			int i = 1;
+			
+			while (!foundEAR) {
+				// 194434 - Check for non-existing EAR with contents that's not deleted previously
+				IStatus canCreateEARStatus = J2EEUtils.canCreateEAR(ProjectUtilities.getProject(earName));
+				if (canCreateEARStatus.isOK()) {
+					foundEAR = true;
+				} else {
+					earName = baseEARName + i;
+					i++;
+				}
+			}
+			
+			
+			//Step 2 - return project name with EAR on the end
+			return earName;			
+		}
+		
+		//Step 3 - return the default EAR project name
+		return ResourceUtils.getDefaultServiceEARProjectName();		
+	}
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java
new file mode 100644
index 0000000..02886f1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060324   116750 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20070119   159458 mahutch@ca.ibm.com - Mark Hutchinson
+ *******************************************************************************/
+
+package org.eclipse.jst.ws.internal.consumption.ui.common;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jst.ws.internal.consumption.common.IServerDefaulter;
+import org.eclipse.jst.ws.internal.consumption.common.ServerInfo;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+
+
+public class ServerSelectionUtils
+{
+
+  public static IRuntime getRuntimeTarget(String projectName)
+  {
+  	if( projectName != null && projectName.length() > 0 ){ //$NON-NLS-1$
+  		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+  		if( project != null && project.exists() ){
+  			return ServerCore.getProjectProperties(project).getRuntimeTarget(); 
+  		}
+  	}
+  	return null;
+  }
+  
+  public static IServer getFirstExistingServerFromFactoryId(String factoryId)
+  {
+  	IServer[] servers = ServerCore.getServers();
+  	if (servers==null || servers.length!=0)
+        return null;
+  	else
+  	{
+  	  for (int i=0; i<servers.length; i++)
+  	  {
+  	    IServer server = (IServer)servers[i];
+  	    if (server.getServerType().getId().equals(factoryId))
+  	    {
+  	      return server;
+  	    }
+  	  }
+  	}
+    return null;
+  }
+  
+  public static IServer[] getCompatibleExistingServers(IRuntime runtime)
+  {
+    if (runtime == null)
+      return null;
+    
+    IServer[] servers = ServerCore.getServers();
+    if (servers==null || servers.length==0)
+      return null;
+    
+    ArrayList compatibleServersList = new ArrayList();
+    IRuntimeType runtimeType = runtime.getRuntimeType();
+    if (runtimeType != null)
+    {
+    	String runtimeId = runtimeType.getId();
+		for (int i=0; i<servers.length; i++)
+		{
+		  IServer server = (IServer)servers[i];
+		  IRuntimeType runtimeType2 = server.getRuntime().getRuntimeType();
+		  if (runtimeType2 != null)
+		  {
+			  String serverRuntimeId = runtimeType2.getId();
+			  if (serverRuntimeId.equals(runtimeId))
+			    compatibleServersList.add(server);
+		  }
+		  
+		}
+    }
+    if (compatibleServersList.size()<1)
+      return null;
+    
+    
+    Object[] compatibleServersArray = compatibleServersList.toArray();
+    IServer[] compatibleServers = new IServer[compatibleServersArray.length];
+    for (int j=0; j<compatibleServersArray.length; j++)
+    {
+      compatibleServers[j] = (IServer)compatibleServersArray[j];
+    }
+    
+    return compatibleServers;
+  }
+    
+  public static ServerInfo getExtenderRecommendation(IProject project)
+  {
+    try
+    {
+    IExtensionRegistry reg = Platform.getExtensionRegistry();
+    IConfigurationElement[] elements = reg.getConfigurationElementsFor("org.eclipse.jst.ws.consumption", "serverDefaulter");
+    for (int i=0; i<elements.length; i++)
+    {
+      Object serverDefaulterObject = elements[i].createExecutableExtension("class");
+      if (serverDefaulterObject instanceof IServerDefaulter)
+      {
+        IServerDefaulter serverDefaulter = (IServerDefaulter)serverDefaulterObject;
+        ServerInfo serverInfo = serverDefaulter.recommendDefaultServer(project);
+        if (serverInfo != null)
+          return serverInfo;
+      }
+      
+    }
+    } catch (CoreException ce)
+    {
+      return null;
+    }
+    
+    return null;
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java
new file mode 100644
index 0000000..fe9ab22
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java
@@ -0,0 +1,1051 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060222   115834 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060413   135581 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060420   136158 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060420   136705 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060421   136761 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060425   137831 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060427   126780 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060427   138058 joan@ca.ibm.com - Joan Haggarty
+ * 20060905   156230 kathy@ca.ibm.com - Kathy Chan, Handling projects with no target runtime
+ * 20070119   159458 mahutch@ca.ibm.com - Mark Hutchinson
+ * 20070723   194434 kathy@ca.ibm.com - Kathy Chan, Check for non-existing EAR with content not deleted
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.common;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.webservice.internal.WebServiceConstants;
+import org.eclipse.jst.j2ee.webservice.wsdd.PortComponent;
+import org.eclipse.jst.j2ee.webservice.wsdd.WSDLPort;
+import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription;
+import org.eclipse.jst.j2ee.webservice.wsdd.WebServices;
+import org.eclipse.jst.j2ee.webservice.wsdd.WsddResource;
+import org.eclipse.jst.server.core.FacetUtil;
+import org.eclipse.jst.ws.internal.common.J2EEUtils;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.common.ServerUtils;
+import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.context.ScenarioContext;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.eclipse.wst.command.internal.env.core.selection.SelectionListChoices;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.VersionFormatException;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+
+/**
+ *
+ */
+public class ValidationUtils
+{
+	//Constants to help decide how much validation to do.
+	public static final int VALIDATE_NONE = 0;
+	public static final int VALIDATE_ALL = 1;
+	public static final int VALIDATE_SERVER_RUNTIME_CHANGES = 2;
+	public static final int VALIDATE_PROJECT_CHANGES = 3;
+	public static final int VALIDATE_SCALE_CHANGES = 4;
+
+  /**
+   * 
+   */
+  public ValidationUtils()
+  {
+  }
+  
+  /**
+   * Returns a new validation state based on the current validation state
+   * and the requested validation state. If the requested validation state
+   * does not cover all the validation covered by the current validation
+   * state, VALIDATE_ALL is returned. Otherwise, the requested validation
+   * state is returned.
+   * 
+   * @param currentValidationState the validaton state at the time the caller's requests a change
+   * @param requestedValidationState the validation state being requested by the caller.
+   * @return Returns VALIDATE_ALL if the requested validation state
+   * does not cover all the validation covered by the current validation
+   * state. Returned requestedValidationState otherwise.
+   */
+  public int getNewValidationState(int currentValidationState, int requestedValidationState) {
+		int newValidationState;
+		if (currentValidationState == VALIDATE_NONE
+				|| currentValidationState == requestedValidationState) {
+			newValidationState = requestedValidationState;
+		} else {
+			newValidationState = VALIDATE_ALL;
+		}
+
+		return newValidationState;
+
+	}
+  
+  /**
+   * Returns IStatus resulting from checking for empty fields. Used for validation of page 1 of the
+   * Web service/client wizards.
+   * @param validationState one of VALIDATE_NONE, VALIDATE_ALL, VALIDATE_SERVER_RUNTIME_CHANGES, VALIDATE_PROJECT_CHANGES, VALIDATE_SCALE_CHANGES
+   * @param typeId Web service type id (isClient=false) or Web service client implementation type id (isClient=true) 
+   * @param serviceImpl String representation of the object selection from page 1
+   * @param runtimeId Web service runtime id
+   * @param serverId server type id
+   * @param projectName name of project
+   * @param needEar boolean <code>true</code> if EAR is required, <code>false</code> if not.
+   * @param earProjectName name of EAR project
+   * @param projectTypeId template id
+   * @param isClient boolean <code>true</code> if the method is being called for client side validation, 
+   * <code>false</code> for service side validation.
+   * @return IStatus with severity IStatus.OK if all mandatory fields are non-null and non-empty. 
+   * IStatus with severity IStatus.ERROR otherwise.
+   */
+  public IStatus checkMissingFieldStatus(int validationState, String typeId, String serviceImpl, String runtimeId, String serverId,
+			String projectName, boolean needEar, String earProjectName, String projectTypeId,
+			boolean isClient)
+  {
+		// Object selection	  
+	  if (validationState==VALIDATE_ALL && !isClient)
+	  {
+		if (serviceImpl.length() == 0) {
+			int scenario = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(typeId);
+			if (scenario == WebServiceScenario.BOTTOMUP)
+			{
+			  return StatusUtils
+					.errorStatus(ConsumptionUIMessages.MSG_NO_OBJECT_SELECTION);
+			}
+			else
+			{
+			  return StatusUtils
+					.errorStatus(ConsumptionUIMessages.MSG_NO_SERVICE_SELECTION);				
+			}
+		}
+	  }
+
+		// Web service runtime
+	    if (validationState == VALIDATE_ALL || validationState == VALIDATE_SERVER_RUNTIME_CHANGES) {
+			if (runtimeId == null || runtimeId.length() == 0) {
+				if (isClient) {
+					return StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_RUNTIME,
+							new String[] { ConsumptionUIMessages.MSG_CLIENT_SUB }));
+				} else {
+					return StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_RUNTIME,
+							new String[] { ConsumptionUIMessages.MSG_SERVICE_SUB }));
+				}
+			}
+		}
+
+	    if (validationState == VALIDATE_ALL || validationState == VALIDATE_PROJECT_CHANGES) {
+			// Project
+			if (projectName == null || projectName.length() == 0) {
+				if (isClient) {
+					return StatusUtils.errorStatus(NLS.bind(
+							ConsumptionUIMessages.MSG_CLIENT_PROJECT_EMPTY, new String[] { "" }));
+				} else {
+					return StatusUtils.errorStatus(NLS.bind(
+							ConsumptionUIMessages.MSG_SERVICE_PROJECT_EMPTY, new String[] { "" }));
+				}
+			}
+
+			// Project type (if project does not exist)
+			IProject project = ProjectUtilities.getProject(projectName);
+			if (!project.exists()) {
+				if (projectTypeId == null || projectTypeId.length() == 0) {
+
+					if (isClient) {
+						return StatusUtils
+								.errorStatus(ConsumptionUIMessages.MSG_CLIENT_PROJECT_TYPE_EMPTY);
+					} else {
+						return StatusUtils
+								.errorStatus(ConsumptionUIMessages.MSG_SERVICE_PROJECT_TYPE_EMPTY);
+					}
+				}
+			}
+
+			// Ear (if need ear)
+			if (needEar) {
+				if (earProjectName == null || earProjectName.length() == 0) {
+					if (isClient) {
+						return StatusUtils.errorStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_CLIENT_EAR_EMPTY, new String[] { "" }));
+					} else {
+						return StatusUtils.errorStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_SERVICE_EAR_EMPTY, new String[] { "" }));
+					}
+				}
+			}
+		}
+	    
+		// Server (if Web service runtime requires a server or project does not
+		// exist)
+	    if (validationState == VALIDATE_ALL || validationState == VALIDATE_SERVER_RUNTIME_CHANGES
+				|| validationState == VALIDATE_PROJECT_CHANGES) {
+			if (serverId == null || serverId.length() == 0) {
+				RuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getRuntimeById(runtimeId);
+				if (desc.getServerRequired()) {
+					if (isClient) {
+						StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER,
+								new String[] { ConsumptionUIMessages.MSG_CLIENT_SUB }));
+					} else {
+						StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER,
+								new String[] { ConsumptionUIMessages.MSG_SERVICE_SUB }));
+					}
+				} else {
+					IProject project = ProjectUtilities.getProject(projectName);
+					if (!project.exists()) {
+						return StatusUtils.errorStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_PROJECT_MUST_EXIST,
+								new String[] { projectName }));
+
+					}
+				}
+			}
+		}
+		
+		return Status.OK_STATUS;
+  }
+  
+  /**
+   * Returns IStatus resulting from checking for errors. Used for validation of page 1 of the
+   * Web service/client wizards.
+   * @param validationState one of VALIDATE_NONE, VALIDATE_ALL, VALIDATE_SERVER_RUNTIME_CHANGES, VALIDATE_PROJECT_CHANGES, VALIDATE_SCALE_CHANGES
+   * @param typeId Web service type id (isClient=false) or Web service client implementation type id (isClient=true)
+   * @param runtimeId Web service runtime id
+   * @param serverId server type id
+   * @param projectName name of project
+   * @param needEar boolean <code>true</code> if EAR is required, <code>false</code> if not.
+   * @param earProjectName name of EAR project
+   * @param projectTypeId template id
+   * @param isClient boolean <code>true</code> if the method is being called for client side validation, 
+   * <code>false</code> for service side validation.
+   * @return IStatus with severity IStatus.OK if no errors are present,
+   * IStatus with severity IStatus.ERROR otherwise.
+   */
+  public IStatus checkErrorStatus(int validationState, String typeId, String runtimeId, String serverId,
+			String projectName, boolean needEar, String earProjectName, String projectTypeId,
+			boolean isClient) {
+	
+	  	// Ensure server, Web service runtime, and Web service type are
+		// compatible
+
+		// Labels
+	    String serverLabel = "";
+	    if (serverId != null && serverId.length()>0)
+	    {
+	    	serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId);
+	    }
+		String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId);
+		
+	    if (validationState == VALIDATE_ALL || validationState == VALIDATE_SERVER_RUNTIME_CHANGES) {
+	    	if (serverId != null && serverId.length() > 0) {
+				if (isClient) {
+					if (!WebServiceRuntimeExtensionUtils2
+							.isServerClientRuntimeTypeSupported(serverId,
+									runtimeId, typeId)) {
+						return StatusUtils
+								.errorStatus(NLS
+										.bind(
+												ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS,
+												new String[] { serverLabel,
+														runtimeLabel }));
+					}
+				} else {
+					if (!WebServiceRuntimeExtensionUtils2
+							.isServerRuntimeTypeSupported(serverId, runtimeId,
+									typeId)) {
+						return StatusUtils
+								.errorStatus(NLS
+										.bind(
+												ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS,
+												new String[] { serverLabel,
+														runtimeLabel }));
+					}
+				}
+			}
+		}
+	    
+		// If the project exists, ensure it supports the Web service type, Web
+		// service runtime, and server. If the Ear also exists and the project
+		// and Ear are not already associated, ensure they can be.
+		// If the project does not exist, ensure the project type supports the
+		// Web service type, Web service runtime, and server
+		if (validationState == VALIDATE_ALL || validationState == VALIDATE_SERVER_RUNTIME_CHANGES
+				|| validationState == VALIDATE_PROJECT_CHANGES) {
+			ValidationUtils valUtils = new ValidationUtils();
+			IProject project = ProjectUtilities.getProject(projectName);
+			if (project.exists()) {
+
+				if (isClient) {
+					// Check if the runtime supports it.
+					if (!WebServiceRuntimeExtensionUtils2.doesClientTypeAndRuntimeSupportProject(
+							typeId, runtimeId, projectName)) {
+						return StatusUtils.errorStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_PROJECT,
+								new String[] { runtimeLabel, projectName }));
+					}
+
+					// Check if the server supports it.
+					if (serverId != null && serverId.length() > 0) {
+						if (!valUtils.doesServerSupportProject(serverId, projectName)) {
+							return StatusUtils.errorStatus(NLS.bind(
+													ConsumptionUIMessages.MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_PROJECT,
+													new String[] { serverLabel, projectName }));
+						}
+					}
+				} else {
+					// Check if the runtime supports it.
+					if (!WebServiceRuntimeExtensionUtils2.doesServiceTypeAndRuntimeSupportProject(
+							typeId, runtimeId, projectName)) {
+						return StatusUtils.errorStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_SERVICE_RUNTIME_DOES_NOT_SUPPORT_PROJECT,
+								new String[] { runtimeLabel, projectName }));
+					}
+
+					// Check if the server supports it.
+					if (serverId != null && serverId.length() > 0)
+					{
+					  if (!valUtils.doesServerSupportProject(serverId, projectName)) {
+						return StatusUtils.errorStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_SERVICE_SERVER_DOES_NOT_SUPPORT_PROJECT,
+								new String[] { serverLabel, projectName }));
+					  }
+					}
+				}
+			} else {
+				// Look at the project type to ensure that it is suitable for
+				// the
+				// selected runtime and server.
+				String templateId = projectTypeId;
+				String templateLabel = FacetUtils.getTemplateLabelById(templateId);
+
+				if (isClient) {
+					// Check if the runtime supports it.
+					if (!WebServiceRuntimeExtensionUtils2.doesClientTypeAndRuntimeSupportTemplate(
+							typeId, runtimeId, templateId)) {
+
+						return StatusUtils.errorStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE,
+								new String[] { runtimeLabel, templateLabel }));
+					}
+
+					// Check if the server supports it.
+					if (serverId != null && serverId.length()>0)
+					{
+					  if (!valUtils.doesServerSupportTemplate(serverId, templateId)) {
+						return StatusUtils.errorStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_TEMPLATE,
+								new String[] { serverLabel, templateLabel }));
+					  }
+					}
+
+				} else {
+					// Check if the runtime supports it.
+					if (!WebServiceRuntimeExtensionUtils2.doesServiceTypeAndRuntimeSupportTemplate(
+							typeId, runtimeId, templateId)) {
+						return StatusUtils
+								.errorStatus(NLS
+										.bind(
+												ConsumptionUIMessages.MSG_SERVICE_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE,
+												new String[] { runtimeLabel, templateLabel }));
+					}
+
+					// Check if the server supports it.
+					if (serverId != null && serverId.length()>0)
+					{
+					  if (!valUtils.doesServerSupportTemplate(serverId, templateId)) {
+						return StatusUtils.errorStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_SERVICE_SERVER_DOES_NOT_SUPPORT_TEMPLATE,
+								new String[] { serverLabel, templateLabel }));
+					  }
+					}
+				}
+
+			}						
+			
+		}
+		
+	    if (validationState == VALIDATE_ALL || validationState == VALIDATE_PROJECT_CHANGES) {
+			// Check if project/EAR association is good.
+			if (needEar) {
+				IProject project = ProjectUtilities.getProject(projectName);
+				IProject ep = ProjectUtilities.getProject(earProjectName);
+				
+				// 194434 - Check for non-existing EAR with contents that's not deleted previously
+				IStatus canCreateEARStatus = J2EEUtils.canCreateEAR(ep);
+				if (!canCreateEARStatus.isOK()) {
+					return canCreateEARStatus;
+				}
+			
+				if (project.exists() && ep.exists()) {
+					if (!J2EEUtils.isComponentAssociated(ep, project)) {
+						IStatus associateStatus = J2EEUtils.canAssociateProjectToEAR(project, ep);
+						if (associateStatus.getSeverity() == IStatus.ERROR) {
+							if (isClient) {
+								return StatusUtils.errorStatus(NLS.bind(
+										ConsumptionUIMessages.MSG_CLIENT_CANNOT_ASSOCIATE,
+										new String[] { projectName, ep.getName(),
+												associateStatus.getMessage() }));
+							} else {
+								return StatusUtils.errorStatus(NLS.bind(
+										ConsumptionUIMessages.MSG_SERVICE_CANNOT_ASSOCIATE,
+										new String[] { projectName, ep.getName(),
+												associateStatus.getMessage() }));
+							}
+
+						}
+					}
+				}
+			}
+		}		
+
+		return Status.OK_STATUS;
+
+	}
+  
+  /**
+   * Returns IStatus resulting from checking for warnings. Used for validation of page 1 of the
+   * Web service/client wizards. 
+   * @param validationState one of VALIDATE_NONE, VALIDATE_ALL, VALIDATE_SERVER_RUNTIME_CHANGES, VALIDATE_PROJECT_CHANGES, VALIDATE_SCALE_CHANGES
+   * @param scaleSetting one of <BR/>
+   * ScenarioContext.WS_TEST<BR/>
+   * ScenarioContext.WS_START<BR/>
+   * ScenarioContext.WS_INSTALL<BR/>
+   * ScenarioContext.WS_DEPLOY<BR/>
+   * ScenarioContext.WS_ASSEMBLE<BR/>
+   * ScenarioContext.WS_DEVELOP<BR/>
+   * ScenarioContext.WS_NONE
+   * @param serverId server type id
+   * @param isClient boolean <code>true</code> if the method is being called for client side validation, 
+   * <code>false</code> for service side validation.
+   * @return IStatus with severity IStatus.OK if no errors are present,
+   * IStatus with severity IStatus.WARNING otherwise.
+   */
+  public IStatus checkWarningStatus(int validationState, int scaleSetting, String serverId,
+			boolean isClient) {
+		// Return a warning if there is no server selection and scale setting is
+		// anything beyond assemble.
+		if (validationState == VALIDATE_ALL || validationState == VALIDATE_SCALE_CHANGES
+				|| validationState == VALIDATE_SERVER_RUNTIME_CHANGES) {
+			if (serverId == null || serverId.length() == 0) {
+				if (scaleSetting < ScenarioContext.WS_ASSEMBLE) {
+					if (isClient) {
+						return StatusUtils.warningStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_WARN_NO_CLIENT_SERVER, new String[0]));
+					} else {
+						return StatusUtils.warningStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_WARN_NO_SERVICE_SERVER, new String[0]));
+					}
+				}
+			} else {
+				// Return a warning if the selected server has only stub
+				// runtimes
+				// and the scale setting is anything beyond deploy.
+				IServerType serverType = ServerCore.findServerType(serverId);
+				if (serverType != null) {
+					// Find a Runtime which is not a stub
+					IRuntime nonStubRuntime = ServerUtils.getNonStubRuntime(serverId);
+					if ((scaleSetting < ScenarioContext.WS_DEPLOY) && nonStubRuntime == null) {
+						String servertypeLabel = WebServiceRuntimeExtensionUtils2
+								.getServerLabelById(serverId);
+						return StatusUtils.warningStatus(NLS.bind(
+								ConsumptionUIMessages.MSG_WARN_STUB_ONLY,
+								new String[] { servertypeLabel }));
+					}
+				}
+
+			}
+		}
+
+		return Status.OK_STATUS;
+
+	}
+  
+  /**
+   * Returns whether or not the provided server type supports the facet versions on the provided project
+   * @param serverFactoryId server type id
+   * @param projectName name of a project that may or may not exist.
+   * @return boolean <code>true</code>
+   * <ul> 
+   * <li>if the server type supports the facet versions on the project or</li>
+   * <li>if the project is not a faceted project or</li>
+   * <li>if the project does not exist.</li>
+   * </ul>
+   * Returns <code>false</code> otherwise.
+   */
+  public boolean doesServerSupportProject(String serverFactoryId, String projectName)
+  {
+    IProject project = ProjectUtilities.getProject(projectName);
+    IFacetedProject fProject = null;
+    if (project.exists())
+    {
+      try
+      {
+        fProject = ProjectFacetsManager.create(project);
+      } catch (CoreException ce)
+      {
+
+      }
+      
+      if (fProject != null)
+      {
+        Set facets = fProject.getProjectFacets();
+        return doesServerSupportFacets(serverFactoryId, facets);
+      }
+      else
+      {
+        //If it's not a faceted project, we have nothing to compare to - assume it's good.
+        return true;
+      }
+    }
+    else
+    {
+      //If the project doesn't exist, we have nothing to compare to - assume it's good.
+      return true;      
+    }
+    
+  }
+
+  /**
+   * Returns whether or not the provided server type supports the facet versions in the provided set.
+   * @param serverFactoryId server type id
+   * @param facets set containing elements of type {@link IProjectFacetVersion}
+   * @return boolean <code>true</code> if the server type supports the facet versions in the provided set,
+   * <code>false</code> otherwise.
+   */
+  public boolean doesServerSupportFacets(String serverFactoryId, Set facets)
+  {
+    Set runtimes = FacetUtils.getRuntimes(new Set[]{facets});
+    Iterator itr = runtimes.iterator();
+    IServerType st = ServerCore.findServerType(serverFactoryId);        
+    String runtimeTypeId = st.getRuntimeType().getId();
+    while (itr.hasNext())
+    {
+      org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)itr.next();
+      IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+      if (sRuntime != null)
+      {
+	      IRuntimeType runtimeType = sRuntime.getRuntimeType();
+	      if (runtimeType != null && runtimeTypeId.equals(runtimeType.getId()))
+	      {
+	        //found a match
+	        return true;
+	      }
+      }
+    }
+    
+    return false;    
+  }
+  
+  /**
+   * Returns whether or not the provided server type supports at least one version of
+   * each of the fixed facets on the provided template
+   * @param serverFactoryId server type id
+   * @param templateId id of a {@link IFacetedProjectTemplate}
+   * @return boolean <code>true</code> if the server type supports at least one version of
+   * each of the fixed facets on the provided template, <code>false</code> otherwise.
+   */
+  public boolean doesServerSupportTemplate(String serverFactoryId, String templateId)
+  {
+    IFacetedProjectTemplate template = ProjectFacetsManager.getTemplate(templateId);
+    Set templateFacets = template.getFixedProjectFacets();
+    Iterator templateFacetsItr = templateFacets.iterator();
+    while (templateFacetsItr.hasNext())
+    {
+      boolean serverSupportsThisOne = false;
+      IProjectFacet fixedFacet = (IProjectFacet)templateFacetsItr.next();      
+      List versions = null;
+      try
+      {
+        versions = fixedFacet.getSortedVersions(true);
+      } catch (VersionFormatException e)
+      {
+        Set versionSet = fixedFacet.getVersions();
+        Iterator itr = versionSet.iterator();
+        versions = new ArrayList();
+        while (itr.hasNext())
+        {
+            versions.add(itr.next());
+        }            
+      } catch (CoreException e)
+      {
+        Set versionSet = fixedFacet.getVersions();
+        Iterator itr = versionSet.iterator();
+        versions = new ArrayList();
+        while (itr.hasNext())
+        {
+            versions.add(itr.next());
+        }            
+      } 
+      Iterator versionsItr = versions.iterator();
+      while(versionsItr.hasNext())
+      {
+        IProjectFacetVersion pfv = (IProjectFacetVersion)versionsItr.next();
+        Set pfvs = new HashSet();
+        pfvs.add(pfv);
+        if (doesServerSupportFacets(serverFactoryId, pfvs))
+        {
+          serverSupportsThisOne = true;
+          break;
+        }        
+      }
+      
+      if (!serverSupportsThisOne)
+      {
+        return false;
+      }
+    }
+    
+    return true;
+  }
+  
+  /**
+   * Returns whether or not the provided project or project type (if the project is null or does not exist)
+   * rules out the need for an EAR.
+   * @param projectName name of a project
+   * @param projectTypeId id of a {@link IFacetedProjectTemplate}. Must be non-empty if the project is null or
+   * does not exist. 
+   * @return boolean <code>true</code> if the need for an EAR is not ruled out, <code>false</code> otherwise.
+   */
+	public boolean projectOrProjectTypeNeedsEar(String projectName, String projectTypeId)
+	{
+		// If the project is a simple Java project or the project type is
+		// Java utility return false.
+		if (projectName != null && projectName.length() > 0) {
+			IProject project = ResourceUtils.getWorkspaceRoot().getProject(projectName);
+			if (project.exists()) {
+				if (FacetUtils.isJavaProject(project)) {
+					return false;
+				}
+			}
+		}
+
+		// Project didn't rule out the need for an EAR
+		// so check the proect type
+		String templateId = projectTypeId;
+		if (templateId != null && templateId.length() > 0) {
+			if (FacetUtils.isUtilityTemplate(templateId)) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+	
+	/**
+	 * Returns whether or not an J2EE 1.3 EAR project can be installed on a server of
+	 * the provided server type.
+	 * @param serverTypeId server type id
+	 * @return boolean <code>true</code> if a J2EE 1.3 EAR project can be installed on a server of
+	 * the provided server type, <code>false</code> otherwise. 
+	 */
+	public boolean serverNeedsEAR(String serverTypeId)
+	{
+		if (serverTypeId == null) {
+			return false;
+		}
+	    if (serverTypeId.length() > 0) {
+			String targetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverTypeId);
+			if (targetId != null && targetId.length() > 0) {
+				if (!ServerUtils.isTargetValidForEAR(targetId, "13")) // rm j2ee
+				{
+					return false;
+				}
+			}
+		}
+
+		return true;
+	}
+	
+  public IStatus validateProjectTargetAndJ2EE(String projectName, String compName, String earName, String earCompName, String serverFactoryId, String j2eeLevel)
+  {
+    IProject p = ProjectUtilities.getProject(projectName);
+    IProject earP = null;
+    if (earName!=null && !earName.equalsIgnoreCase("")) {
+    	earP = ProjectUtilities.getProject(earName);
+    }
+    IStatus targetStatus = doesProjectTargetMatchServerType(p, serverFactoryId);
+    if (earP!=null && targetStatus.getSeverity()==Status.OK)
+    {
+      //check the EAR      
+      IStatus earTargetStatus = doesProjectTargetMatchServerType(earP, serverFactoryId);
+      if(earTargetStatus.getSeverity()==Status.ERROR)
+      {
+        return earTargetStatus;
+      }            
+    }
+    else
+    {
+      return targetStatus;
+    }
+    
+
+    //Validate service side J2EE level    
+    IStatus j2eeStatus = doesProjectMatchJ2EELevel(p, compName, j2eeLevel);
+    if(earP!=null && j2eeStatus.getSeverity()==Status.OK)
+    {
+      IStatus earJ2EEStatus = doesProjectMatchJ2EELevel(earP, earCompName, j2eeLevel);
+      if(earJ2EEStatus.getSeverity()==Status.ERROR)
+      {
+        return earJ2EEStatus;
+      }
+    }
+    else
+    {
+      return j2eeStatus;
+    }
+    
+    return Status.OK_STATUS;
+  }
+  
+  //TODO: This method is obselete - should be removed.
+  private IStatus doesProjectTargetMatchServerType(IProject p, String serverFactoryId)
+  {
+    if (p!=null && p.exists())
+    {
+      IRuntime projectTarget = ServerSelectionUtils.getRuntimeTarget(p.getName());
+      if (projectTarget!=null)
+      {
+        String projectTargetId = projectTarget.getRuntimeType().getId();
+        String serverTargetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverFactoryId);
+        if (serverTargetId!=null && serverTargetId.length()>0)
+        {
+          if(!projectTargetId.equals(serverTargetId))
+          { 
+            return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_SERVER_TARGET_MISMATCH,new String[]{p.getName()}) );
+          }
+        }
+      }
+    }
+    return Status.OK_STATUS;        
+  }
+
+  //TODO: This method is obselete - should be removed.
+  private IStatus doesProjectMatchJ2EELevel(IProject p, String compName, String j2eeLevel)
+  {
+
+    try {
+		if (p!=null && p.exists())
+		{
+  	  int projectJ2EELevel = J2EEUtils.getJ2EEVersion(p);
+		  if (projectJ2EELevel!=-1)
+		  {
+		    String projectJ2EELevelString = String.valueOf(projectJ2EELevel);
+		    if (j2eeLevel!=null && j2eeLevel.length()>0)
+		    {
+		      if (!projectJ2EELevelString.equals(j2eeLevel))
+		      {
+		        return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_J2EE_MISMATCH,new String[]{p.getName()}) );
+		      }
+		    }
+		  }
+		}
+	} catch(Exception e){
+    
+  }
+    
+    return Status.OK_STATUS;        
+  }
+  
+  //TODO: This method is obselete - should be removed.
+  public IStatus validateProjectType(String projectName, SelectionListChoices runtime2ClientTypes)
+  {
+    IStatus status = Status.OK_STATUS;
+    IProject p = ProjectUtilities.getProject(projectName);
+    if (p==null || !p.exists())
+    {
+      //Project does not exist which means a new project of the correct type will be created
+      //We're done. All is good.
+      return status;
+    }
+      
+    //If the project exists, we should see it in the project list for the selected client
+    //project type.
+    String[] projectNames = runtime2ClientTypes.getChoice().getChoice().getList().getList();
+    for (int i=0; i<projectNames.length; i++)
+    {
+      if (projectName.equals(projectNames[i]))
+      {
+        //Found the project. All is good.
+        return status;
+      }
+    }
+    
+    //Didn't find the project. Return an error.
+    //Get the label for the client type id
+    String clientTypeLabel = getClientTypeLabel(runtime2ClientTypes.getChoice().getList().getSelection());
+    String message = NLS.bind(ConsumptionUIMessages.MSG_WRONG_CLIENT_PROJECT_TYPE,new String[]{projectName, clientTypeLabel});
+    IStatus eStatus = StatusUtils.errorStatus( message );
+    return eStatus;
+    
+  }
+  
+  //TODO: This method is obselete - should be removed.
+  private String getClientTypeLabel( String type )
+  {	  
+	  if (type.equals(IModuleConstants.JST_WEB_MODULE))
+	  {
+		  return ConsumptionUIMessages.LABEL_CLIENT_COMP_TYPE_WEB;
+	  }
+	  else if (type.equals(IModuleConstants.JST_EJB_MODULE))
+	  {
+		  return ConsumptionUIMessages.LABEL_CLIENT_COMP_TYPE_EJB;
+	  }
+	  else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE))
+	  {
+		  return ConsumptionUIMessages.LABEL_CLIENT_COMP_TYPE_APP_CLIENT;
+	  }
+	  else if (type.equals(IModuleConstants.JST_UTILITY_MODULE))
+	  {
+		  return ConsumptionUIMessages.LABEL_CLIENT_COMP_TYPE_CONTAINERLESS;
+	  }
+	  else
+	  {
+		  //No known label, return the typeId itself. 
+		  return type;
+	  }	  	  
+  }  
+  
+  /**
+   * Returns whether or not this project is likely hosting any of the services
+   * in the provided WSDL as a J2EE Web service.
+   * @param p IProject in the workspace
+   * @param wsdlURL URL of a WSDL document
+   * @param parser
+   * @return boolean <code>true</code> if the project contains a webservices.xml 
+   * deployment descriptor that points to at least one of the ports in the provided WSDL. 
+   * Returns <code>false</code> otherwise.
+   */
+  public boolean isProjectServiceProject(IProject p, String wsdlURL, WebServicesParser parser)
+  {
+    if (p==null || wsdlURL==null || wsdlURL.length()==0 || parser==null)
+      return false;
+    
+    IResource wsXML = getWebServcesXML(p);
+    if (wsXML==null)
+      return false;
+    
+    
+    //Make a list of all the wsdl-port's in webservices.xml
+    if (!(wsXML instanceof IFile))
+    {
+      return false;
+    }
+     
+    Resource res = WorkbenchResourceHelperBase.getResource((IFile)wsXML, true);
+    WsddResource wsddRes = (WsddResource)res;    
+    WebServices webServices = wsddRes.getWebServices();
+    Iterator wsDescs = webServices.getWebServiceDescriptions().iterator();
+    ArrayList wsdlPortList = new ArrayList();
+    while(wsDescs.hasNext())
+    {
+      WebServiceDescription wsDesc = (WebServiceDescription)wsDescs.next();
+      Iterator pcs = wsDesc.getPortComponents().iterator();
+      while(pcs.hasNext())
+      {
+        PortComponent pc = (PortComponent)pcs.next();
+        WSDLPort wsdlPort = pc.getWsdlPort();
+        wsdlPortList.add(new QualifiedName(wsdlPort.getNamespaceURI(), wsdlPort.getLocalPart()));
+      }
+    }
+    
+    ArrayList portList = getPortNamesFromWsdl(wsdlURL, parser);
+
+    //If any of the QualifiedNames in portList equals any of the QualifiedNames
+    //in wsdlPortList, this is the service project. Return true.
+    Object[] ports = portList.toArray();
+    Object[] wsdlPorts = wsdlPortList.toArray();
+    for (int i = 0; i < ports.length; i++)
+    {
+      QualifiedName portName = (QualifiedName) ports[i];
+      for (int j = 0; j < wsdlPorts.length; j++)
+      {
+        QualifiedName wsdlPortName = (QualifiedName) wsdlPorts[j];
+        if (portName.equals(wsdlPortName))
+        {
+          return true;
+        }
+      }
+    }
+
+    return false;
+  }
+  
+  /**
+   * Returns the IResource corresponding to the webservices.xml in the provided project.
+   * @param p an IProject in the workspace.
+   * @return IResource corresponding to the webservices.xml in the provided project,
+   * null if there is no webservices.xml in the project.
+   */
+  private IResource getWebServcesXML(IProject p)
+  {
+    //Get the module root.    
+    IResource moduleRoot = getModuleRoot(p);
+    if (!(moduleRoot instanceof IContainer))
+      return null;
+
+    IResource webServicesXML = null;
+    if (J2EEProjectUtilities.isDynamicWebProject(p))
+    {
+      StringBuffer wsPath = new StringBuffer();
+      wsPath.append("WEB-INF/");
+      wsPath.append(WebServiceConstants.WEBSERVICE_DD_SHORT_NAME);
+      webServicesXML = ((IContainer) moduleRoot).findMember(wsPath.toString());
+    }
+    else
+    {
+      StringBuffer wsPath = new StringBuffer();
+      wsPath.append("META-INF/");
+      wsPath.append(WebServiceConstants.WEBSERVICE_DD_SHORT_NAME);
+      webServicesXML = ((IContainer) moduleRoot).findMember(wsPath.toString());      
+    }
+    return webServicesXML;
+  }
+  
+  private IResource getModuleRoot(IProject p)
+  {
+    IPath modulePath = null;
+    try 
+    {
+      IVirtualComponent vc = ComponentCore.createComponent(p);
+      if (vc != null) 
+      {
+        modulePath = vc.getRootFolder().getWorkspaceRelativePath();
+      }
+    }
+    catch(Exception ex)
+    {
+      
+    } 
+    
+    IResource res = ResourceUtils.findResource(modulePath);
+    return res;
+  }
+  
+  /**
+   * Returns a list of WSDL ports in the provided WSDL
+   * @param wsdlURL URL of a WSDL document
+   * @param parser 
+   * @return ArrayList containing elements of type {@link QualifiedName}
+   */
+  private ArrayList getPortNamesFromWsdl(String wsdlURL, WebServicesParser parser)
+  {
+  	ArrayList portNameList = new ArrayList();
+  	Definition def = parser.getWSDLDefinition(wsdlURL);
+    Map services = def.getServices();
+    Service service = null;
+    for (Iterator it = services.values().iterator(); it.hasNext();)
+    {
+      service = (Service)it.next();
+      String namespace = service.getQName().getNamespaceURI();
+      Map ports = service.getPorts();
+      for (Iterator it2 = ports.values().iterator(); it2.hasNext();)
+      {
+      	Port port = (Port)it2.next();
+      	portNameList.add(new QualifiedName(namespace, port.getName()));
+      }
+    }        
+  	
+  	return portNameList;
+  	
+  }
+  
+  private class QualifiedName
+  {
+    String namespaceURI;
+
+    String localPart;
+
+    /**
+     * @param namespaceURI
+     * @param localPart
+     */
+    public QualifiedName(String namespaceURI, String localPart)
+    {
+      super();
+      this.namespaceURI = namespaceURI;
+      this.localPart = localPart;
+    }
+
+    /**
+     * @return Returns the localPart.
+     */
+    public String getLocalPart()
+    {
+      return localPart;
+    }
+
+    /**
+     * @param localPart
+     *          The localPart to set.
+     */
+    public void setLocalPart(String localPart)
+    {
+      this.localPart = localPart;
+    }
+
+    /**
+     * @return Returns the namespaceURI.
+     */
+    public String getNamespaceURI()
+    {
+      return namespaceURI;
+    }
+
+    /**
+     * @param namespaceURI
+     *          The namespaceURI to set.
+     */
+    public void setNamespaceURI(String namespaceURI)
+    {
+      this.namespaceURI = namespaceURI;
+    }
+
+    public boolean equals(QualifiedName qn)
+    {
+      return (qn.getNamespaceURI().equals(namespaceURI) && qn.getLocalPart()
+          .equals(localPart));
+    }
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java
new file mode 100644
index 0000000..06fb55a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060131 121071   rsinha@ca.ibm.com - Rupam Kuehner     
+ * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060516   126965 kathy@ca.ibm.com - Kathy Chan
+ * 20060529   141422 kathy@ca.ibm.com - Kathy Chan
+ * 20070123   167487 makandre@ca.ibm.com - Andrew Mak
+ * 20070403   173654 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+
+package org.eclipse.jst.ws.internal.consumption.ui.extension;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jst.ws.internal.consumption.command.common.CreateFacetedProjectCommand;
+import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
+import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
+import org.eclipse.wst.common.environment.IEnvironment;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.ws.internal.common.HTTPUtility;
+import org.eclipse.wst.ws.internal.wsrt.IContext;
+import org.eclipse.wst.ws.internal.wsrt.ISelection;
+import org.eclipse.wst.ws.internal.wsrt.IWebService;
+import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
+import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime;
+import org.eclipse.wst.ws.internal.wsrt.SimpleContext;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceState;
+
+public class PreClientDevelopCommand extends AbstractDataModelOperation 
+{
+  
+  private TypeRuntimeServer typeRuntimeServer_;
+  private String            clientRuntimeId_;
+  private IContext          context_;
+  private ISelection        selection_;
+  private String            project_;
+  private String            module_;
+  private String            moduleType_;
+  private String            earProject_;
+  private String            ear_;
+  private IWebServiceClient webServiceClient_;
+  private String            j2eeLevel_;
+  private ResourceContext   resourceContext_;
+  private boolean           develop_;
+  private boolean           assemble_;
+  private boolean           deploy_;
+  private boolean			test_;
+  private boolean			install_;
+  private boolean			run_;
+  private String            wsdlURI_;
+  private Object            dataObject_;
+
+  public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
+  {
+	  IStatus status = Status.OK_STATUS;
+	  
+	  if (develop_) {
+		  IEnvironment environment = getEnvironment();
+
+		  // Split up the project and module
+		  int index = module_.indexOf("/");
+		  if (index!=-1){
+			  project_ = module_.substring(0,index);
+			  module_ = module_.substring(index+1);
+		  }
+
+		  if (ear_!=null && ear_.length()>0)
+		  {
+			  int earIndex = ear_.indexOf("/");
+			  if (earIndex!=-1) {
+				  earProject_ = ear_.substring(0,earIndex);
+				  ear_ = ear_.substring(earIndex+1);
+			  }
+		  }    
+
+		  IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils2
+		  .getClientRuntime(clientRuntimeId_);
+		  WebServiceClientInfo wsInfo = new WebServiceClientInfo();
+
+		  wsInfo.setServerFactoryId(typeRuntimeServer_.getServerId());
+		  wsInfo.setServerInstanceId(typeRuntimeServer_.getServerInstanceId());
+		  wsInfo.setState(WebServiceState.UNKNOWN_LITERAL);
+		  wsInfo.setWebServiceRuntimeId(typeRuntimeServer_.getRuntimeId());
+		  
+		  // check for redirection in the wsdl
+		  HTTPUtility httpUtil = new HTTPUtility();		  
+		  wsInfo.setWsdlURL(httpUtil.handleRedirect(wsdlURI_));
+
+		  webServiceClient_ = wsrt.getWebServiceClient(wsInfo);
+		  WebServiceScenario scenario = WebServiceScenario.CLIENT_LITERAL;
+		  context_ = new SimpleContext(develop_, assemble_, deploy_, install_, run_, true, test_,
+				  false, scenario, resourceContext_.isOverwriteFilesEnabled(),
+				  resourceContext_.isCreateFoldersEnabled(), resourceContext_
+				  .isCheckoutFilesEnabled());
+
+		  // Create the client module if needed.
+		  IProject project = ProjectUtilities.getProject(project_);
+		  RequiredFacetVersion[] rfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRequiredFacetVersions();
+		  if (!project.exists())
+		  {
+			  boolean matches = WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportTemplate(clientRuntimeId_, moduleType_);
+			  if (matches)
+			  {  
+				  CreateFacetedProjectCommand command = new CreateFacetedProjectCommand();
+				  command.setProjectName(project_);
+				  command.setTemplateId(moduleType_);
+				  command.setRequiredFacetVersions(rfv);
+				  command.setServerFactoryId(typeRuntimeServer_.getServerId());
+				  command.setServerInstanceId(typeRuntimeServer_.getServerInstanceId());
+				  status = command.execute( monitor, adaptable );
+				  if (status.getSeverity() == Status.ERROR)
+				  {
+					  environment.getStatusHandler().reportError( status );
+					  return status;
+				  }        
+			  }            
+		  } else {
+				// add facets required by Web service runtime
+		        if (rfv.length != 0) {
+		        	status = FacetUtils.addRequiredFacetsToProject(project, rfv, monitor);
+		        	if (status.getSeverity() == Status.ERROR)
+		        	{
+		        		environment.getStatusHandler().reportError( status );
+		        		return status;
+		        	}      
+		        }
+		  }        
+	  }
+    return status;
+  }
+  
+  public void setClientTypeRuntimeServer( TypeRuntimeServer typeRuntimeServer )
+  {
+	typeRuntimeServer_ = typeRuntimeServer;  
+  }
+  
+  public void setClientRuntimeId( String id)
+  {
+    clientRuntimeId_ = id;
+  }
+  
+  public void setClientJ2EEVersion( String j2eeLevel )
+  {
+	j2eeLevel_ = j2eeLevel;  
+  }
+  
+  public String getJ2eeLevel()
+  {
+    return j2eeLevel_;  
+  }
+  
+  public IWebServiceClient getWebService()
+  {
+	return webServiceClient_;  
+  }
+  
+  public IContext getContext()
+  {
+    return context_;
+  }
+  
+  public void setResourceContext( ResourceContext resourceContext )
+  {
+    resourceContext_ = resourceContext;	  
+  }
+  
+  public ISelection getSelection()
+  {
+    return selection_;	  
+  }
+  
+  public void setSelection( ISelection selection )
+  {
+	selection_ = selection;  
+  }
+
+  public String getProject()
+  {
+    return project_;    
+  }
+  
+  public String getModule()
+  {
+    return module_;	  
+  }
+  
+  public void setModule( String module )
+  {
+	module_ = module;
+  }
+  
+  public void setModuleType( String moduleType)
+  {
+    moduleType_ = moduleType;
+  }
+
+  public String getEarProject()
+  {
+    return earProject_;   
+  }
+  
+  public String getEar()
+  {
+	return ear_;  
+  }
+  
+  public void setEar( String ear )
+  {
+	ear_ = ear;  
+  }
+  
+  public void setDevelopClient(boolean developClient) {
+	  develop_ = developClient;
+  }	
+
+  public void setAssembleClient(boolean assembleClient) {
+	  assemble_ = assembleClient;
+  }
+
+  public void setDeployClient(boolean deployClient)
+  {
+      deploy_ = deployClient;
+  }
+	
+  public void setInstallClient(boolean installClient)
+  {
+	install_ = installClient;
+  }	
+  
+  public void setTestService(boolean testService)
+  {
+	test_ = testService;
+  }		
+  
+  public void setStartService(boolean startService)
+  {
+	  run_ = startService;
+  }
+  
+  public void setWsdlURI(String uri)
+  {
+    wsdlURI_ = uri;
+  }
+  
+  public void setDataObject( Object object )
+  {
+    dataObject_ = object;	  
+  }
+  
+  public Object getDataObject()
+  {
+	Object result = null;
+	
+    if( dataObject_ != null && dataObject_ instanceof IWebService )
+	{
+	  // The data object has already been set with an IWebService
+	  // so we will keep this value.
+	  result = dataObject_;
+	}
+    else
+	{
+	  result = webServiceClient_;	
+	}
+	
+	return result;
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java
new file mode 100644
index 0000000..699f534
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java
@@ -0,0 +1,358 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060728	  151723 mahutch@ca.ibm.com - Mark Hutchinson
+ * 20070109   130965 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+
+package org.eclipse.jst.ws.internal.consumption.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.ui.common.UIUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.wst.command.internal.env.core.selection.SelectionListChoices;
+
+
+/**
+ *
+ */
+public class ServerRuntimePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener 
+{
+	private String pluginId_= "org.eclipse.jst.ws.consumption.ui";
+	
+	/* CONTEXT_ID SRPF0001 for server preference on the server runtime preference page */
+	private String INFOPOP_SRPF_SERVER_PREF = pluginId_ + ".SRPF0001";
+	private Combo server_;
+
+	/* CONTEXT_ID SRPF0002 for runtime preference on the server runtime preference page */
+	private String INFOPOP_SRPF_RUNTIME_PREF = pluginId_ + ".SRPF0002";
+	private Combo runtime_;	
+
+	/* CONTEXT_ID SRPF0003 for J2EE version preference on the server runtime preference page */
+    /*
+	private String INFOPOP_SRPF_J2EE_PREF = pluginId_ + ".SRPF0003";
+	private Combo j2eeVersion_;
+    */
+	
+	SelectionListChoices serverToRuntimeToJ2EE_;
+	
+	public void init(IWorkbench workbench)   { }	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+	 */
+	protected Control createContents(Composite parent) 
+	{
+	  UIUtils uiUtils = new UIUtils(pluginId_);
+	  
+	  Composite page = new Composite(parent, SWT.NONE);
+	  GridLayout gl = new GridLayout();
+	  gl.numColumns = 2;
+	  page.setLayout(gl);
+	  GridData gd = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
+	  page.setLayoutData(gd);
+	  
+	  server_ = uiUtils.createCombo(page,ConsumptionUIMessages.LABEL_SERVERS_LIST,
+			  ConsumptionUIMessages.TOOLTIP_SRPF_COMBO_SERVER,
+									INFOPOP_SRPF_SERVER_PREF,
+									SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY);
+	  
+	  runtime_ = uiUtils.createCombo(page,ConsumptionUIMessages.LABEL_RUNTIMES_LIST,
+			  ConsumptionUIMessages.TOOLTIP_SRPF_COMBO_RUNTIME,
+									 INFOPOP_SRPF_RUNTIME_PREF,
+									 SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY);
+
+/*
+	  j2eeVersion_ = uiUtils.createCombo(page,ConsumptionUIMessages.LABEL_J2EE_VERSION,
+			  ConsumptionUIMessages.TOOLTIP_SRPF_COMBO_J2EE,
+			                             INFOPOP_SRPF_J2EE_PREF,
+			                             SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY);	  
+*/
+
+	  initializeValues();
+	  startListening();
+	  applyDialogFont(page);
+	  return page;
+	}
+
+	private void initializeValues()
+	{
+		PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+        serverToRuntimeToJ2EE_ = WebServiceRuntimeExtensionUtils2.getServerToRuntimeToJ2EE();
+
+
+		setServerItems(serverToRuntimeToJ2EE_.getList().getList());
+		String defaultServerText = context.getServerFactoryId();
+		serverToRuntimeToJ2EE_.getList().setSelectionValue(defaultServerText);
+		setServerSelection(defaultServerText);
+		
+		setRuntimeItems(serverToRuntimeToJ2EE_.getChoice().getList().getList());
+		String defaultRuntimeText = context.getRuntimeId();
+		serverToRuntimeToJ2EE_.getChoice().getList().setSelectionValue(defaultRuntimeText);
+		setRuntimeSelection(defaultRuntimeText);			
+	}
+	
+	public void handleEvent(Event event)
+	{
+		if (server_ == event.widget)
+		{
+			handleServerSelected();
+		}
+		else if (runtime_ == event.widget)
+		{
+			handleRuntimeSelected();
+		}
+	}
+
+	private void handleServerSelected()
+	{
+		stopListening();
+		
+		String selectedText = getServerSelection();
+		serverToRuntimeToJ2EE_.getList().setSelectionValue(selectedText);
+		
+		// TODO (see bug 116025) - Since the server and runtime set in serverToRuntimeToJ2EE is just the list of 
+		// all servers and all runtime (i.e. no validation checking is being done), no need to update the runtime,
+		// just keep the original value.
+		//Update the runtime -------------------------------
+//		setRuntimeItems(serverToRuntimeToJ2EE_.getChoice().getList().getList());
+//		if (serverToRuntimeToJ2EE_.getChoice().getList().getList().length > 0)
+//		  serverToRuntimeToJ2EE_.getChoice().getList().setIndex(0);
+//		
+//		String newRuntimeText = serverToRuntimeToJ2EE_.getChoice().getList().getSelection();
+//		if (newRuntimeText!=null && newRuntimeText.length()>0)
+//			setRuntimeSelection(newRuntimeText);		
+		
+		startListening();
+	}
+	
+	private void handleRuntimeSelected()
+	{
+		stopListening();
+		
+		String selectedText = getRuntimeSelection();
+		serverToRuntimeToJ2EE_.getChoice().getList().setSelectionValue(selectedText);						
+		startListening();		
+	}
+	
+
+    /**
+	 * Does anything necessary because the default button has been pressed.
+	*/
+	protected void performDefaults()
+	{
+	  super.performDefaults();
+	  setToDefaults();
+	}
+	
+	private void setToDefaults()
+	{
+		PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+
+		String defaultServerText = context.getDefaultServerFactoryId();
+		serverToRuntimeToJ2EE_.getList().setSelectionValue(defaultServerText);
+		setServerSelection(defaultServerText);
+		
+		setRuntimeItems(serverToRuntimeToJ2EE_.getChoice().getList().getList());
+		String defaultRuntimeText = context.getDefaultRuntimeId();
+		serverToRuntimeToJ2EE_.getChoice().getList().setSelectionValue(defaultRuntimeText);
+		setRuntimeSelection(defaultRuntimeText);
+	}
+
+	/**
+	 * Do anything necessary because the OK button has been pressed.
+	 *  @return whether it is okay to close the preference page
+	 */
+	public boolean performOk()
+	{
+	  storeValues();
+	  return true;
+	}
+
+	private void storeValues()
+	{
+      PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+      context.setServerFactoryId(getServerSelection());
+      context.setRuntimeId(getRuntimeSelection());      
+	}
+	
+	protected void performApply()
+	{
+	  performOk();
+	}
+	
+  	
+	private void startListening()
+	{
+	  server_.addListener(SWT.Selection,this);
+	  runtime_.addListener(SWT.Selection,this);
+	}
+
+	private void stopListening()
+	{
+	  server_.removeListener(SWT.Selection, this);
+	  runtime_.removeListener(SWT.Selection, this);
+	}
+
+	private void setServerItems(String[] factoryIds)
+	{
+	  
+	  if (factoryIds != null)
+	  {
+	    ArrayList serverLabelsList = new ArrayList();
+		  for (int i=0;i<factoryIds.length;i++)
+		  {
+			  //String thisServerLabel = WebServiceServerRuntimeTypeRegistry.getInstance().getServerLabel(factoryIds[i]);
+        String thisServerLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(factoryIds[i]);
+			  if (thisServerLabel!=null && thisServerLabel.length()>0)
+			  {
+			    serverLabelsList.add(thisServerLabel);
+			  }
+			
+		  }
+		  String[] serverLabels = convertToStringArray(serverLabelsList.toArray()); 
+		  server_.setItems(serverLabels);
+	  }
+		
+	}
+	
+	private void setRuntimeItems(String[] ids)
+	{
+	  if (ids != null)
+	  {
+		String[] runtimeLabels = new String[ids.length];
+		for (int i=0;i<ids.length;i++)
+		{
+		  //runtimeLabels[i] = WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeLabel(ids[i]);
+      runtimeLabels[i] = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(ids[i]);
+		}
+
+		//sort the labels (bug 151723)
+		Arrays.sort(runtimeLabels);
+		runtime_.setItems(runtimeLabels);
+	  }
+		
+	}
+	
+    /*
+    private void setJ2EEItems(String[] versions)
+    {
+      if (versions != null)
+      {
+        String[] j2eeLabels = new String[versions.length];
+        for (int i = 0; i < versions.length; i++)
+        {
+          String label = J2EEUtils.getLabelFromJ2EEVersion(versions[i]);
+          if (label != null && label.length()>0)
+            j2eeLabels[i] = label;
+          else
+            j2eeLabels[i] = ConsumptionUIMessages.LABEL_NA;
+        }
+        j2eeVersion_.setItems(j2eeLabels);
+        
+        //Disable the combo if it has no items.
+        if (j2eeLabels.length > 0)
+          j2eeVersion_.setEnabled(true);
+        else
+          j2eeVersion_.setEnabled(false);
+      }
+        
+    }
+    */
+	
+	private String getServerSelection()
+	{
+	  String serverLabel = server_.getText();
+	  //return WebServiceServerRuntimeTypeRegistry.getInstance().getServerFactoryId(serverLabel);
+    return WebServiceRuntimeExtensionUtils2.getServerFactoryId(serverLabel);
+	}
+	
+	private String getRuntimeSelection()
+	{
+      String runtimeLabel = runtime_.getText();
+	  //return WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeId(runtimeLabel);
+      return WebServiceRuntimeExtensionUtils2.getRuntimeId(runtimeLabel);
+	}
+	
+    /*
+	private String getJ2EESelection()
+	{
+	  String j2eeLabel = j2eeVersion_.getText();
+	  return J2EEUtils.getJ2EEVersionFromLabel(j2eeLabel);		
+	}
+    */
+	
+	private void setServerSelection(String factoryId)
+	{
+		//String label = WebServiceServerRuntimeTypeRegistry.getInstance().getServerLabel(factoryId);
+    String label = WebServiceRuntimeExtensionUtils2.getServerLabelById(factoryId);
+		setSelection(server_,label);
+	}
+	
+	private void setRuntimeSelection(String id)
+	{
+		//String label = WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeLabel(id);
+    String label = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(id);
+		setSelection(runtime_,label);		
+	}
+	
+    /*
+	private void setJ2EESelection(String version)
+	{
+	  String label = J2EEUtils.getLabelFromJ2EEVersion(version);
+      setSelection(j2eeVersion_, label);
+	}
+    */
+	
+	private void setSelection(Combo combo, String s)
+	{
+		String[] items = combo.getItems();
+		for (int i=0; i<items.length; i++)
+		{
+			if (items[i].equals(s))
+			{
+				combo.select(i);
+				return;
+			}
+		}
+	}
+	
+	private String[] convertToStringArray(Object[] a)
+	{
+	  if (a==null) return new String[0];
+	  	
+	  int length = a.length;
+	  String[] sa = new String[length];
+	  for (int i=0; i<length; i++)
+	  {
+	  	Object obj = a[i];
+	  	if (obj instanceof String)
+	  	{
+	      sa[i] = (String)obj;
+	  	}
+	  }
+	  return sa;
+	}	
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidget.java
new file mode 100644
index 0000000..24dd038
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidget.java
@@ -0,0 +1,524 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060407   135415 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060417   136390/136159 joan@ca.ibm.com - Joan Haggarty
+ * 20060413   135581 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060420   135912 joan@ca.ibm.com - Joan Haggarty
+ * 20060424   138052 kathy@ca.ibm.com - Kathy Chan
+ * 20060425   137831 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060509   119296 pmoogk@ca.ibm.com - Peter Moogk
+ * 20060529   141422 kathy@ca.ibm.com - Kathy Chan
+ * 20060612   145081 pmoogk@ca.ibm.com - Peter Moogk
+ * 20060725   149351 makandre@ca.ibm.com - Andrew Mak, Deleted service definition keeps reappearing
+ * 20060803   152486 makandre@ca.ibm.com - Andrew Mak, Typing WSDL in Service definition field is very slow
+ * 20060817   140017 makandre@ca.ibm.com - Andrew Mak, longer project or server/runtime strings do not resize wizard
+ * 20060825   135570 makandre@ca.ibm.com - Andrew Mak, Service implementation URL not displayed properly on first page
+ * 20060829   155441 makandre@ca.ibm.com - Andrew Mak, web service wizard hangs during resize
+ * 20060907   156211 makandre@ca.ibm.com - Andrew Mak, Selecting service definition invalidated project config when creating web service java client
+ * 20061212   159911 makandre@ca.ibm.com - Andrew Mak, changing service definition resets some configuration fields
+ * 20060125   159911 kathy@ca.ibm.com - Kathy Chan, Remove unused method and imports
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jst.ws.internal.consumption.common.WSDLParserFactory;
+import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.command.data.EclipseIPath2URLStringTransformer;
+import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.Timer;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
+import org.eclipse.jst.ws.internal.ui.common.UIUtils;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
+import org.eclipse.wst.command.internal.env.ui.widgets.PageInfo;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
+
+
+public class ClientWizardWidget extends SimpleWidgetDataContributor implements Runnable
+{  
+  private WebServiceClientTypeWidget clientWidget_;
+  private Button overwriteButton_;
+  private Button monitorService_;
+
+  private Text serviceImpl_;
+  private Button browseButton_;
+  private WSDLSelectionDialog wsdlDialog_;
+  private String componentName_;
+  private IProject project_;
+  private String webServiceURI_;
+  private WebServicesParser parser_;
+  private ResourceContext resourceContext_;
+  
+  private Listener statusListener_;
+  private ModifyListener objectModifyListener_ ;
+  private int validationState_;
+  private boolean validObjectSelection_ = true;
+  private WSDLSelectionWidgetWrapper wsdlValidatorWidget_;
+
+  private Timer timer_ = null;
+  
+  /* CONTEXT_ID WSWSCEN0020 for the Service Implemenation text field of the Scenario Page */
+	 private String INFOPOP_WSWSCEN_TEXT_SERVICE_IMPL = "WSWSCEN0020";
+
+  
+  /* CONTEXT_ID WSWSCEN0014 for the monitor service checkbox of the Scenario page */
+  private String INFOPOP_WSWSCEN_CHECKBOX_MONITOR_SERVICE = "WSWSCEN0014";	
+  /* CONTEXT_ID WSWSCEN0030 for the Overwrite Files checkbox of the Scenario Page */
+  private String INFOPOP_WSWSCEN_CHECKBOX_OVERWRITE = "WSWSCEN0030";	
+  /* CONTEXT_ID WSWSCEN0001 for the Scenario Page */
+  private String INFOPOP_WSWSCEN_PAGE = "WSWSCEN0001";
+  
+  /**
+   * Run this ClientWizardWidget, which validates the entry field values. 
+   */
+  public void run() {
+	  validationState_ = ValidationUtils.VALIDATE_ALL;
+	  statusListener_.handleEvent(null);
+	  if (validObjectSelection_)
+		  callObjectTransformation(project_, 
+				  wsdlValidatorWidget_.getComponentName(), 
+				  wsdlValidatorWidget_.getWsdlURI());	  
+  }
+  
+  public WidgetDataEvents addControls( Composite parent, Listener statusListener)
+  {
+    String       pluginId = "org.eclipse.jst.ws.consumption.ui";
+    UIUtils      utils    = new UIUtils( pluginId );
+    utils.createInfoPop(parent, INFOPOP_WSWSCEN_PAGE);
+
+    statusListener_ = statusListener;
+	validationState_ = ValidationUtils.VALIDATE_ALL;
+  	// Create text field and browse for service selection
+  	Composite typeComposite = utils.createComposite(parent, 3);
+	serviceImpl_ = utils.createText(typeComposite, ConsumptionUIMessages.LABEL_WEBSERVICEDEF, 
+			ConsumptionUIMessages.TOOLTIP_WSWSCEN_TEXT_IMPL,
+			INFOPOP_WSWSCEN_TEXT_SERVICE_IMPL, SWT.LEFT | SWT.BORDER );
+	
+	objectModifyListener_ = new ModifyListener(){
+		public void modifyText(ModifyEvent e) {
+			if (serviceImpl_.getText().indexOf(':') > 0) {
+		        timer_ = Timer.newInstance(timer_, Display.getCurrent(), ClientWizardWidget.this);
+		        timer_.startTimer();
+			}
+		    else
+		        run();
+		}
+	};
+	
+	serviceImpl_.addModifyListener(objectModifyListener_);
+	
+	browseButton_ = utils.createPushButton(typeComposite,
+			ConsumptionUIMessages.BUTTON_BROWSE, ConsumptionUIMessages.TOOLTIP_WSWSCEN_BUTTON_BROWSE_IMPL, null);
+	
+	IWorkbench workbench = PlatformUI.getWorkbench();
+    wsdlDialog_ = new WSDLSelectionDialog(workbench.getActiveWorkbenchWindow().getShell(), 
+		  						new PageInfo(ConsumptionUIMessages.DIALOG_TITILE_SERVICE_IMPL_SELECTION, "", 
+		                        new WidgetContributorFactory()
+		  						{	
+		  							public WidgetContributor create()
+		  							{	  						 
+		  							   return new WSDLSelectionWidgetWrapper();
+		  							}
+		  						}));		
+	browseButton_.addSelectionListener(new WSDLBrowseListener());
+	
+	utils.createHorizontalSeparator(parent, 1);
+	
+	Composite clientComposite = utils.createComposite( parent, 1, 0, 0 );
+	
+    clientWidget_ = new WebServiceClientTypeWidget(true);
+    clientWidget_.addControls(clientComposite , statusListener );
+   
+    //  Create test service check box.
+    Composite buttonGroup = utils.createComposite(clientComposite,1);
+    
+    // Create monitor service check box.
+    monitorService_ = utils.createCheckbox(buttonGroup , ConsumptionUIMessages.CHECKBOX_MONITOR_WEBSERVICE,
+    									ConsumptionUIMessages.TOOLTIP_PWPR_CHECKBOX_MONITOR_SERVICE,
+    									INFOPOP_WSWSCEN_CHECKBOX_MONITOR_SERVICE);
+
+    //show overwrite if it is enabled in the preferences
+    if (getResourceContext().isOverwriteFilesEnabled()) {
+		Label prefSeparator = utils.createHorizontalSeparator(parent, 1);
+		prefSeparator.setText("File Options");
+		Composite prefButtonPanel = utils.createComposite(parent, 1);
+		overwriteButton_ = utils.createCheckbox(prefButtonPanel,
+				ConsumptionUIMessages.CHECKBOX_OVERWRITE_FILES, 
+				ConsumptionUIMessages.TOOLTIP_WSWSCEN_BUTTON_OVERWRITE_FILES, 
+				INFOPOP_WSWSCEN_CHECKBOX_OVERWRITE);
+		overwriteButton_.setSelection(getResourceContext()
+				.isOverwriteFilesEnabled());
+	}
+    return this;
+  }
+  
+  public void setResourceContext( ResourceContext context )
+  {    
+	  resourceContext_ = context;
+  }
+   
+  public ResourceContext getResourceContext()
+  {   
+    if (resourceContext_ == null) {
+		resourceContext_ = WebServicePlugin.getInstance()
+				.getResourceContext();
+	}
+	return resourceContext_;
+  }
+  
+  public void setClientTypeRuntimeServer( TypeRuntimeServer ids )
+  {	  
+    clientWidget_.setTypeRuntimeServer( ids );
+  }
+  
+  public void setClientProjectName(String name)
+  {
+	  clientWidget_.setClientProjectName(name);
+  }
+  
+  public void setClientEarProjectName(String name)
+  {
+	  clientWidget_.setClientEarProjectName(name);
+  }
+  
+  public void setClientComponentType(String name)
+  {
+	  clientWidget_.setClientComponentType(name);	  
+  }
+  
+  public void setClientNeedEAR(boolean b)
+  {
+	  clientWidget_.setClientNeedEAR(b);
+  }
+  
+  public String getClientRuntimeId()
+  {
+	  return clientWidget_.getClientRuntimeId();
+  }
+  
+  public String getClientEarProjectName()
+  {
+	  return clientWidget_.getClientEarProjectName();
+  }
+  
+  public String getClientProjectName()
+  {
+	  return clientWidget_.getClientProjectName();
+  }
+  
+  public String getClientComponentType()
+  {
+	  return clientWidget_.getClientComponentType();
+  }
+  
+  public boolean getClientNeedEAR()
+  {
+	  return clientWidget_.getClientNeedEAR();
+  }
+  
+ public void setWebServiceURI(String uri)
+ {
+     webServiceURI_ = uri;    
+ }
+ 
+public void internalize() {		
+
+	if (webServiceURI_ == null || webServiceURI_.length() == 0)
+		return;
+
+	serviceImpl_.removeModifyListener(objectModifyListener_);
+	serviceImpl_.setText(webServiceURI_);    	 
+	serviceImpl_.addModifyListener(objectModifyListener_);
+		
+	EclipseIPath2URLStringTransformer transformer = new EclipseIPath2URLStringTransformer();
+	webServiceURI_ = (String) transformer.transform(webServiceURI_);    
+}
+ 
+ public void setProject(IProject project)
+ {
+     project_ = project;
+ }
+  public void setComponentName(String name)
+  {
+      componentName_ = name;      
+  } 
+  
+  public String getWebServiceURI()
+  {
+      return webServiceURI_ ;
+  }
+  
+  public String getWsdlURI()
+  {
+	  return getWebServiceURI();
+  }
+  
+  public IProject getProject()
+  {
+      return project_;
+  }
+  
+   public String getComponentName()
+   {
+       return componentName_ ;
+   }
+  
+   public WebServicesParser getWebServicesParser()
+	{
+		return WSDLParserFactory.getWSDLParser();
+	}
+	
+	public void setWebServicesParser(WebServicesParser parser)
+	{
+		parser_ = getWebServicesParser();
+		clientWidget_.setWebServicesParser(parser_);
+	}
+   
+  public TypeRuntimeServer getClientTypeRuntimeServer()
+  {
+    return clientWidget_.getTypeRuntimeServer();  
+  }
+  
+  public void setInstallClient( Boolean install)
+  {
+    clientWidget_.setInstallClient( install );
+  }
+  
+  public Boolean getInstallClient()
+  {
+	  return clientWidget_.getInstallClient();   
+  }
+  
+  public Boolean getTestService()
+  {
+	  return clientWidget_.getTestClient(); 
+  }
+  
+  public void setTestService( Boolean value )
+  {
+      clientWidget_.setTestClient(value);  
+  }
+  
+  public int getClientGeneration()
+  {
+	  return clientWidget_.getClientGeneration();
+  }
+  
+  public void setClientGeneration(int value)
+  {
+	  clientWidget_.setClientGeneration(value);
+  }
+  
+  public void setDevelopClient(boolean develop) {
+		clientWidget_.setDevelopClient( develop );
+	}
+
+	public boolean getDevelopClient() {		
+		return clientWidget_.getDevelopClient();
+	}
+	
+	public void setAssembleClient(boolean assemble) {
+		clientWidget_.setAssembleClient( assemble );
+	}
+
+	public boolean getAssembleClient() {		
+		return clientWidget_.getAssembleClient();
+	}
+	
+	public void setDeployClient(boolean deploy) {
+		clientWidget_.setDeployClient( deploy );
+	}
+
+	public boolean getDeployClient() {		
+		return clientWidget_.getDeployClient();
+	}
+	
+	public void setStartClient(Boolean start) {
+		clientWidget_.setStartClient( start );
+	}
+
+	public Boolean getStartClient() {	
+		return clientWidget_.getStartClient();
+	}
+  
+  public Boolean getMonitorService()
+  {
+    return new Boolean(monitorService_.getSelection());
+  }
+  
+  public void setMonitorService(Boolean value)
+  {
+    monitorService_.setSelection(value.booleanValue());
+  }
+
+  public IStatus getStatus() {
+				
+		validObjectSelection_ = false;	// assume false at first
+
+		IStatus missingFieldStatus = checkMissingFieldStatus();
+		if (missingFieldStatus.getSeverity() == IStatus.ERROR) {
+			return missingFieldStatus;
+		}
+
+		IStatus invalidServiceImplStatus = checkServiceImplTextStatus();
+		if (invalidServiceImplStatus.getSeverity() == IStatus.ERROR) {
+			return invalidServiceImplStatus;
+		}
+
+		IStatus possibleErrorStatus = checkErrorStatus();
+		if (possibleErrorStatus.getSeverity() == IStatus.ERROR) {
+			return possibleErrorStatus;
+		}
+
+		IStatus possibleWarningStatus = checkWarningStatus();
+		if (possibleWarningStatus.getSeverity() == IStatus.WARNING) {
+			return possibleWarningStatus;
+		}
+
+		// if no errors or warnings were found, clear the validation state.
+		validationState_ = ValidationUtils.VALIDATE_NONE;
+		clientWidget_.setValidationState(ValidationUtils.VALIDATE_NONE);
+
+		return Status.OK_STATUS;
+	}
+	
+	private IStatus checkMissingFieldStatus() {
+
+		if (validationState_ == ValidationUtils.VALIDATE_ALL) {
+			if (serviceImpl_.getText().trim().length() == 0) {
+				return StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_SERVICE_SELECTION, new String[]{ConsumptionUIMessages.LABEL_WEBSERVICEIMPL}));
+			}
+		}
+		
+		IStatus clientMissingFieldsStatus = clientWidget_.checkMissingFieldStatus();
+		if (clientMissingFieldsStatus.getSeverity() == IStatus.ERROR) {
+			return clientMissingFieldsStatus;
+		}
+		
+		return Status.OK_STATUS;
+
+	}
+
+	private IStatus checkErrorStatus() {
+		IStatus clientSideErrorStatus = clientWidget_.checkErrorStatus();
+		if (clientSideErrorStatus.getSeverity() == IStatus.ERROR) {
+			return clientSideErrorStatus;
+		}
+		return Status.OK_STATUS;
+	}
+
+	private IStatus checkWarningStatus() {
+		IStatus clientWarningStatus = clientWidget_.checkWarningStatus();
+		if (clientWarningStatus.getSeverity() == IStatus.WARNING) {
+			return clientWarningStatus;
+		}
+		return Status.OK_STATUS;
+	}	
+	
+	/*call validation code in the object selection widget to ensure
+	 any modifications to the serviceImpl_ field are valid*/
+	private IStatus checkServiceImplTextStatus() {
+		
+		String fieldText = serviceImpl_.getText().trim();
+
+		if (wsdlValidatorWidget_ == null)
+			wsdlValidatorWidget_ = new WSDLSelectionWidgetWrapper();
+		
+		validObjectSelection_ = wsdlValidatorWidget_.validate(fieldText);
+				
+		if (!validObjectSelection_)
+		{
+			return StatusUtils.errorStatus(ConsumptionUIMessages.MSG_INVALID_SERVICE_DEF);			
+		}		
+		
+		return Status.OK_STATUS;
+	}
+	
+	private void callObjectTransformation(IProject project, String componentName,
+			String wsdlURI)
+	{
+		   WSDLSelectionOutputCommand wsdlOutputCommand = new WSDLSelectionOutputCommand();
+		   wsdlOutputCommand.setComponentName(componentName);
+		   wsdlOutputCommand.setProject(project);
+		   wsdlOutputCommand.setWsdlURI(wsdlURI);
+		   wsdlOutputCommand.setTestService(getTestService().booleanValue());
+		   wsdlOutputCommand.setWebServicesParser(getWebServicesParser());
+		
+           wsdlOutputCommand.execute(null, null);
+      
+           setComponentName(wsdlOutputCommand.getComponentName());
+           setProject(wsdlOutputCommand.getProject());
+           setWebServicesParser(wsdlOutputCommand.getWebServicesParser());
+           setWebServiceURI(wsdlOutputCommand.getWsdlURI());
+           
+           // bug 159911: our starting point is a wsdl, we should not need to
+           // refresh the runtime everytime the user specify a new wsdl path
+           // refreshClientRuntimeSelection();
+     }
+	
+  private class WSDLBrowseListener implements SelectionListener
+  {
+	  public void widgetDefaultSelected(SelectionEvent e) {
+		// TODO Auto-generated method stub
+		
+	}
+	  public void widgetSelected(SelectionEvent e) {
+		  
+		   wsdlDialog_.setComponentName(getComponentName());
+		   wsdlDialog_.setProject(getProject());
+		   wsdlDialog_.setWebServiceURI( serviceImpl_.getText() );		
+		   
+		   int result = wsdlDialog_.open();
+		   
+		   if (result == Dialog.OK)
+		   {
+			   serviceImpl_.removeModifyListener(objectModifyListener_);
+			   serviceImpl_.setText(wsdlDialog_.getDisplayableSelectionString());
+			   serviceImpl_.addModifyListener(objectModifyListener_);
+			   
+			   // call WSDLSelectionOutputCommand to carry out any transformation on the objectSelection
+	           callObjectTransformation(project_,
+	        			wsdlDialog_.getComponentName(), wsdlDialog_.getWebServiceURI());
+	           
+		       validationState_ = ValidationUtils.VALIDATE_ALL;
+		       clientWidget_.setValidationState(ValidationUtils.VALIDATE_ALL);
+		       statusListener_.handleEvent(null); //validate the page
+		   }
+	  }
+	}
+}
+
+
+
+
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionTreeWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionTreeWidget.java
new file mode 100644
index 0000000..28cc163
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionTreeWidget.java
@@ -0,0 +1,291 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060418   136712 joan@ca.ibm.com - Joan Haggarty
+ * 20070131   168786 makandre@ca.ibm.com - Andrew Mak, wsdl url on web service wizard page 1 is not reflected in browse dialog
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServiceEntity;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
+
+
+/**
+* This wizard page allows the user to select the WSDL URI for consumption
+*/
+public class WSDLSelectionTreeWidget extends SimpleWidgetDataContributor
+{
+  private String pluginId_ = "org.eclipse.jst.ws.consumption.ui";
+
+  /*CONTEXT_ID PWWS0001 for the WSDL Selection Page*/
+  private final String INFOPOP_PWWS_PAGE = ".PWWS0001";
+
+  private WebServicesParser webServicesParser;
+  private String webServiceURI;
+  
+  private Listener statusListener;
+  private TreeViewer treeViewer_;
+  private TreeContentProvider treeContentProvider;
+  private Tree tree_;
+  private int pageWidth_;
+  private WebServiceEntity entity_;
+
+  /**
+  * Default constructor.
+  */
+  public WSDLSelectionTreeWidget()
+  {
+  }
+
+  public WidgetDataEvents addControls( Composite parent, Listener statusListener )
+  {
+  	this.statusListener = statusListener;
+    parent.setToolTipText(ConsumptionUIMessages.TOOLTIP_PWWS_PAGE);
+    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, pluginId_ + INFOPOP_PWWS_PAGE);
+
+    Label wsdlLabel = new Label(parent, SWT.WRAP);
+    wsdlLabel.setText(ConsumptionUIMessages.LABEL_SELECT_WSDL);
+    wsdlLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+    tree_ = new Tree(parent, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+    GridData gd = new GridData(GridData.FILL_BOTH);
+    gd.heightHint = 200;
+    tree_.setLayoutData(gd);
+    pageWidth_ = tree_.getShell().getSize().x;
+    treeViewer_ = new TreeViewer(tree_);
+    treeContentProvider = new TreeContentProvider();
+    treeViewer_.setContentProvider(treeContentProvider);
+    treeViewer_.setLabelProvider(new TreeLabelProvider());
+    treeViewer_.addSelectionChangedListener(
+      new ISelectionChangedListener()
+      {
+        public void selectionChanged(SelectionChangedEvent event)
+        {
+        	handleTreeSelectionChangedEvent(event);
+        }
+      }
+    );
+    return this;
+  }
+  
+  private void handleTreeSelectionChangedEvent(SelectionChangedEvent event)
+  {
+  	statusListener.handleEvent(new Event());
+  }
+  
+  /**
+   * @return Returns the webServicesParser.
+   */
+  public WebServicesParser getWebServicesParser()
+  {
+  	return webServicesParser;
+  }
+  /**
+   * @param webServicesParser The webServicesParser to set.
+   */
+  public void setWebServicesParser(WebServicesParser webServicesParser)
+  {
+  	this.webServicesParser = webServicesParser;
+  	treeViewer_.setInput(this.webServicesParser);
+  	refreshTreeViewer();
+  }
+
+  public void setWebServiceURI(String wsURI)
+  {
+  	webServiceURI = wsURI;
+  	if (!tree_.isDisposed()) {
+  		treeContentProvider.setWebServiceURI(webServiceURI);
+  		refreshTreeViewer();
+  	}
+  }
+
+  public void refreshTreeViewer()
+  {
+  	if (webServicesParser != null && webServiceURI != null)
+  	{
+  	  treeViewer_.refresh();
+  	  Control shell = tree_.getShell();
+  	  if (tree_.getSize().x > pageWidth_ || shell.getSize().x > pageWidth_)
+  	  {
+  	    tree_.setSize(pageWidth_, tree_.getSize().y);
+  	    shell.setSize(pageWidth_, shell.getSize().y);
+  	    shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+  	    shell.redraw();
+  	  }
+  	}
+  }
+  
+  public void setEnabled(boolean enabled)
+  {
+    tree_.setEnabled(enabled);
+  }
+  
+  public boolean isEnabled()
+  {
+    return tree_.isEnabled();
+  }
+  
+  public String getWsdlURI()
+  {	  
+	  	if (entity_ != null)
+	  	  return entity_.getURI();
+	  	else
+	  	  return webServiceURI;
+  }
+  
+  private WebServiceEntity getSelectionAsWebServiceEntity()
+  {
+  	if (treeViewer_ != null)
+  	{
+      ISelection sel = treeViewer_.getSelection();
+      if (!sel.isEmpty() && (sel instanceof IStructuredSelection))
+      {
+        IStructuredSelection ssel = (IStructuredSelection)sel;
+        Object object = ssel.getFirstElement();
+        if (object instanceof WebServiceEntity)
+          return (WebServiceEntity)object;
+      }
+  	}
+    return null;  	
+  }
+    
+  public IStatus getStatus()
+  {    
+	entity_ = getSelectionAsWebServiceEntity();
+    if (entity_ == null || entity_.getType() != WebServiceEntity.TYPE_WSDL)
+      return StatusUtils.errorStatus( ConsumptionUIMessages.PAGE_MSG_SELECTION_MUST_BE_WSDL );
+    else
+      return Status.OK_STATUS;
+  }
+
+  private class TreeContentProvider implements ITreeContentProvider
+  {
+  	private String webServiceURI;
+
+    public void dispose()
+    {
+    }
+
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+    {
+    }
+
+    public Object[] getElements(Object inputElement)
+    {
+      if (inputElement instanceof WebServicesParser)
+      {
+      	WebServicesParser parser = (WebServicesParser)inputElement;
+        Object wsEntity = parser.getWebServiceEntityByURI(webServiceURI);
+        if (wsEntity != null)
+          return new Object[] {wsEntity};
+      }
+      return new Object[0];
+    }
+
+    public Object[] getChildren(Object parentElement)
+    {
+      if (parentElement instanceof WebServiceEntity)
+      {
+        List list = ((WebServiceEntity)parentElement).getChildren();
+        Object[] objects = new Object[list.size()];
+        for (int i = 0; i < objects.length; i++)
+          objects[i] = list.get(i);
+        return objects;
+      }
+      return new Object[0];
+    }
+
+    public Object getParent(Object element)
+    {
+      if (element instanceof WebServiceEntity)
+        return ((WebServiceEntity)element).getParent();
+      return new Object[0];
+    }
+
+    public boolean hasChildren(Object element)
+    {
+      return (getChildren(element).length > 0);
+    }
+    
+    public void setWebServiceURI(String wsURI)
+    {
+      webServiceURI = wsURI;
+    }
+  }
+
+  private class TreeLabelProvider implements ILabelProvider
+  {
+    public Image getImage(Object element)
+    {
+      switch (((WebServiceEntity)element).getType())
+      {
+        case WebServiceEntity.TYPE_HTML:
+          return WebServiceConsumptionUIPlugin.getImageDescriptor("icons/wsil/html.gif").createImage();
+        case WebServiceEntity.TYPE_WSIL:
+          return WebServiceConsumptionUIPlugin.getImageDescriptor("icons/wsil/wsil.gif").createImage();
+        case WebServiceEntity.TYPE_WSDL:
+          return WebServiceConsumptionUIPlugin.getImageDescriptor("icons/wsil/wsdl.gif").createImage();
+        default:
+          return null;
+      }
+    }
+
+    public String getText(Object element)
+    {
+      return ((WebServiceEntity)element).getURI();
+    }
+
+    public void addListener(ILabelProviderListener listener)
+    {
+    }
+
+    public void removeListener(ILabelProviderListener listener)
+    {
+    }
+
+    public boolean isLabelProperty(Object element, String property)
+    {
+      return true;
+    }
+
+    public void dispose()
+    {
+    }
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java
new file mode 100644
index 0000000..fa822ce
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070116   159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer
+ * 20070327   172339 kathy@ca.ibm.com - Kathy Chan
+ * 20070410   181827 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef;
+import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.common.UniversalPathTransformer;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.ws.internal.ui.utils.AdapterUtils;
+import org.eclipse.wst.wsdl.internal.impl.ServiceImpl;
+import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
+
+public class WSDLSelectionWidgetDefaultingCommand extends AbstractDataModelOperation
+{
+  private IStructuredSelection selection_;
+  private UniversalPathTransformer transformer_ = new UniversalPathTransformer(); 
+  
+  public String getWebServiceURI()
+  {
+    String uri = "";
+    
+  	if (selection_ != null && !selection_.isEmpty())
+  	{
+  	  Object firstSel = selection_.getFirstElement();
+  	  if (firstSel instanceof IFile)
+  	  {
+  	    IFile ifile = (IFile)firstSel;
+  	    String ext = ifile.getFileExtension();
+  	    if (ext != null && (ext.equals("wsdl") || ext.equals("wsil") || ext.equals("html")))
+  	    {
+  	      uri = ifile.getFullPath().toString();
+  	    }
+  	  } else if (firstSel instanceof ServiceImpl)
+      {
+        ServiceImpl serviceImpl = (ServiceImpl)firstSel;
+        uri = J2EEActionAdapterFactory.getWSDLURI(serviceImpl);
+      } else if (firstSel instanceof ServiceRef)
+      {
+  	    ServiceRef serviceRef = (ServiceRef)firstSel;
+        uri = J2EEActionAdapterFactory.getWSDLURI(serviceRef);
+      } else if (firstSel instanceof WSDLResourceImpl)
+  	  {
+  	    WSDLResourceImpl wsdlRI = (WSDLResourceImpl)firstSel;
+  	    uri = J2EEActionAdapterFactory.getWSDLURI(wsdlRI);
+  	  } else if (firstSel instanceof String)
+  	  {
+  	    uri = (String)firstSel;
+  	  } else {
+  		String adaptedUri = AdapterUtils.getAdaptedWSDL(firstSel);
+  		if (adaptedUri != null) {
+  			uri = adaptedUri;
+  		}
+  	  }
+  	  
+  	  uri = transformer_.toPath(uri);
+  	}
+    return uri;
+  }
+ 
+  public void setInitialSelection( IStructuredSelection selection )
+  {
+    selection_ = selection;   
+  }
+  
+  public boolean getGenWSIL()
+  {
+    return false;
+  }
+  
+  public String getWsilURI()
+  {
+  	String wsURI = getWebServiceURI();
+  	if (wsURI != null && wsURI.length() > 0 && wsURI.endsWith("wsdl"))
+  	{
+      StringBuffer sb = new StringBuffer(wsURI.substring(0, wsURI.length()-4));
+      sb.append("wsil");
+      return sb.toString();
+  	}
+    return "";
+  }
+  
+  public IProject getProject()
+  {
+  	IProject p = getProjectFromInitialSelection(selection_);
+  	return p;
+  }
+  
+  public String getComponentName()
+  {
+    String cname = getComponentNameFromInitialSelection(selection_);
+    return cname;
+  }
+  
+  private boolean hasProtocol(String url) {	  
+    return url.indexOf(":") != -1;	  
+  }
+  
+  private IProject getProjectFromInitialSelection(IStructuredSelection selection)
+  {
+    if (selection != null && selection.size() == 1)
+    {
+      Object obj = selection.getFirstElement();
+      if (obj != null) 
+      {
+        try
+        { 
+          IResource resource = ResourceUtils.getResourceFromSelection(obj);
+          if (resource==null) {
+            String uri = getWebServiceURI();
+            if (hasProtocol(uri)) return null;
+            return ResourceUtils.getProjectOf(new Path(uri));
+          }
+          else
+            return ResourceUtils.getProjectOf(resource.getFullPath());
+        } catch(CoreException e)
+        {
+          return null;
+        }        
+      }
+    }
+    return null;
+  }
+  
+  private String getComponentNameFromInitialSelection(IStructuredSelection selection)
+  {
+    if (selection != null && selection.size() == 1)
+    {
+      Object obj = selection.getFirstElement();
+      if (obj != null) 
+      {
+        try
+        { 
+          IResource resource = ResourceUtils.getResourceFromSelection(obj);
+          IVirtualComponent comp;
+          if (resource==null) {
+            String uri = getWebServiceURI();
+            if (hasProtocol(uri)) return null;              
+            comp = ResourceUtils.getComponentOf(new Path(uri)) ;
+          }
+          else 
+            comp = ResourceUtils.getComponentOf(resource);
+          if (comp!=null)
+          {
+            return comp.getName();
+          }
+        } catch(CoreException e)
+        {
+          return null;
+        }        
+      }
+    }
+    return null;
+  }
+
+  public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+  {
+	  return Status.OK_STATUS;
+  }    
+     
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java
new file mode 100644
index 0000000..12561b2
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java
@@ -0,0 +1,1052 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060407   135443 joan@ca.ibm.com - Joan Haggarty
+ * 20060410   135441 joan@ca.ibm.com - Joan Haggarty
+ * 20060410   136030 kathy@ca.ibm.com - Kathy Chan
+ * 20060411   136167 kathy@ca.ibm.com - Kathy Chan
+ * 20060417   136390 joan@ca.ibm.com - Joan Haggarty
+ * 20060413   135581 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060420   136158 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060420   136705 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060421   136761 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060424   138052 kathy@ca.ibm.com - Kathy Chan
+ * 20060425   137831 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060426   137622 joan@ca.ibm.com - Joan Haggarty
+ * 20060427   138058 joan@ca.ibm.com - Joan Haggarty
+ * 20060504   138035 joan@ca.ibm.com - Joan Haggarty
+ * 20060529   141422 kathy@ca.ibm.com - Kathy Chan
+ * 20060607   144826 joan@ca.ibm.com - Joan Haggarty
+ * 20060607   144049 joan@ca.ibm.com - Joan Haggarty
+ * 20060614   146270 joan@ca.ibm.com - Joan Haggarty
+ * 20060717   150577 makandre@ca.ibm.com - Andrew Mak
+ * 20060726   150865 sengpl@ca.ibm.com - Seng Phung-Lu
+ * 20060817   140017 makandre@ca.ibm.com - Andrew Mak, longer project or server/runtime strings do not resize wizard
+ * 20060829   155441 makandre@ca.ibm.com - Andrew Mak, web service wizard hangs during resize
+ * 20070126   138484 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets;
+
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.common.DefaultingUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
+import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidgetDefaultingCommand;
+import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ProjectSelectionWidget;
+import org.eclipse.jst.ws.internal.consumption.ui.wizard.RuntimeServerSelectionDialog;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.context.ScenarioContext;
+import org.eclipse.jst.ws.internal.data.LabelsAndIds;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.jst.ws.internal.ui.common.UIUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.Accessible;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleControlAdapter;
+import org.eclipse.swt.accessibility.AccessibleControlEvent;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.HyperlinkGroup;
+import org.eclipse.ui.forms.HyperlinkSettings;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.wst.command.internal.env.ui.widgets.PageInfo;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
+
+
+public class WebServiceClientTypeWidget extends SimpleWidgetDataContributor implements IPackable
+{    
+	 // INFOPOPS	 
+	 /* CONTEXT_ID WSWSCEN0022 for the Server hyperlink of the Scenario Page */
+	 private String INFOPOP_WSWSCEN_HYPERLINK_SERVER = "WSWSCEN0022";
+	 /* CONTEXT_ID WSWSCEN0023 for the Runtime hyperlink of the Scenario Page */
+	 private String INFOPOP_WSWSCEN_HYPERLINK_RUNTIME = "WSWSCEN0023";
+	 /* CONTEXT_ID WSWSCEN0024 for theProjects hyperlink of the Scenario Page */
+     private String INFOPOP_WSWSCEN_HYPERLINK_PROJECTS  = "WSWSCEN0024";
+	 /* CONTEXT_ID WSWSCEN0025 for theClient Type combo box of the Scenario Page */
+	 private String INFOPOP_WSWSCEN_COMBO_CLIENTTYPE = "WSWSCEN0025";
+	 /* CONTEXT_ID WSWSCEN0026 for theClient Slider of the Scenario Page */
+	 private String INFOPOP_WSWSCEN_SCALE_CLIENT = "WSWSCEN0026";
+	
+  private String GRAPHIC_CLIENT_0="icons/client_test.jpg";  //$NON-NLS-N$
+  private String GRAPHIC_CLIENT_1="icons/client_run.jpg";   //$NON-NLS-N$
+  private String GRAPHIC_CLIENT_2="icons/client_install.jpg"; //$NON-NLS-N$
+  private String GRAPHIC_CLIENT_3="icons/client_deploy.jpg"; //$NON-NLS-N$
+  private String GRAPHIC_CLIENT_4="icons/client_assemble.jpg"; //$NON-NLS-N$
+  private String GRAPHIC_CLIENT_5="icons/client_develop.jpg";  //$NON-NLS-N$
+  private String GRAPHIC_CLIENT_6="icons/client_none.jpg";  //$NON-NLS-N$
+  
+  private String ICON_SCALE_BG_0="icons/scale0_bground.jpg";  //$NON-NLS-N$
+  private String ICON_SCALE_BG_1="icons/scale1_bground.jpg";  //$NON-NLS-N$
+  private String ICON_SCALE_BG_2="icons/scale2_bground.jpg";  //$NON-NLS-N$
+  private String ICON_SCALE_BG_3="icons/scale3_bground.jpg";  //$NON-NLS-N$
+  private String ICON_SCALE_BG_4="icons/scale4_bground.jpg";  //$NON-NLS-N$
+  private String ICON_SCALE_BG_5="icons/scale5_bground.jpg";  //$NON-NLS-N$
+  private String ICON_SCALE_BG_6="icons/scale6_bground.jpg";  //$NON-NLS-N$
+  
+  private Composite clientComposite_;
+  private Composite hCompClient_;
+  private Shell shell_;
+  private Combo  clientTypeCombo_;  
+  private Scale clientScale_;  
+  private Label topologySpot_;
+  private Label clientDetailsLabel_;  
+  private Hyperlink hLinkClientRuntime_;
+  private Hyperlink hLinkClientServer_;
+  private Hyperlink hLinkClientProject_;
+  private Hyperlink hLinkClientEAR_;
+  private ProjectSelectionDialog projectDialog_;
+  
+  private boolean developClient_;
+  private boolean assembleClient_;
+  private boolean deployClient_;
+	
+  private Boolean testClient_;
+  private Boolean installClient_;
+  private Boolean startClient_;    
+    
+  private TypeRuntimeServer ids_;
+  private IStructuredSelection objectSelection_;
+  private boolean enableProxy_;  //service scale is set to a level that the client scale can be enabled
+  private boolean clientOnly_=false;
+  private int clientScaleSetting_;
+  private ImageRegistry imageReg_;
+  private IProject project_;
+  private WebServicesParser parser_;
+  private String earProjectName_;
+  private String projectName_;
+  private boolean needEar_;
+  private String clientComponentType_;
+  
+  private Listener statusListener_;
+  private int validationState_;
+  
+  private ScaleSelectionListener scaleSelectionListener = new ScaleSelectionListener();
+  
+  private String CLIENT_RUNTIME_PREFIX = ConsumptionUIMessages.LABEL_RUNTIMES_LIST ; 
+  private String CLIENT_SERVER_PREFIX =  ConsumptionUIMessages.LABEL_SERVERS_LIST;
+  private String CLIENT_PROJECT_PREFIX = ConsumptionUIMessages.LABEL_CLIENT_PROJECT;
+  private String CLIENT_EAR_PREFIX = ConsumptionUIMessages.LABEL_CLIENT_EAR_PROJECT;
+  
+  private Composite clientGroupComposite_ ;
+	
+  private UIUtils utils_ = new UIUtils("org.eclipse.jst.ws.consumption.ui");
+  private IPackable packable_ = null;  
+  private LabelsAndIds labelIds_;
+  
+  public WebServiceClientTypeWidget(boolean clientOnly) {
+	    clientOnly_ = clientOnly;
+		initImageRegistry();
+		validationState_ = ValidationUtils.VALIDATE_ALL;
+	}
+   
+    /**
+     * Give this widget a handle to an IPackable instance, which will also be
+     * packed when this widget's packIt() is called.
+     * 
+     * @param packable The IPackable instance.
+     */
+    public void setPackable(IPackable packable) {
+    	packable_ = packable;
+    }
+  
+	/* (non-Javadoc)
+	 * @see org.eclipse.jst.ws.internal.consumption.ui.widgets.IPackable#packIt()
+	 */
+	public void packIt() {
+		clientGroupComposite_.pack(true);		
+		utils_.horizontalResize(clientGroupComposite_.getShell(), clientGroupComposite_, UIUtils.DEFAULT_PADDING);
+		if (!clientOnly_ && packable_ != null)
+			packable_.packIt();
+	}
+  
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#addControls(org.eclipse.swt.widgets.Composite, org.eclipse.swt.widgets.Listener)
+   */
+  public WidgetDataEvents addControls( Composite parent, Listener statusListener)
+  {
+    statusListener_ = statusListener;
+    Composite clientTypeComposite = new Composite(parent, SWT.NONE);
+	GridLayout cclayout = new GridLayout();
+	cclayout.numColumns = 2;
+	cclayout.marginTop=3;
+	clientTypeComposite.setLayout( cclayout );
+    GridData ccGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); 
+    clientTypeComposite.setLayoutData(ccGridData);
+    
+    int comboStyle = SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY;
+    clientTypeCombo_ = utils_.createCombo( clientTypeComposite, 
+    		ConsumptionUIMessages.LABEL_WEBSERVICECLIENTTYPE,
+    		ConsumptionUIMessages.TOOLTIP_PWPR_COMBO_CLIENTTYPE, 
+    		INFOPOP_WSWSCEN_COMBO_CLIENTTYPE, 
+                                          comboStyle );
+    GridData comboGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+    clientTypeCombo_.setLayoutData(comboGridData);
+	clientTypeCombo_.addSelectionListener(new SelectionListener() {
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+
+			public void widgetSelected(SelectionEvent e) {
+				String oldTypeId = ids_.getTypeId();
+				int currentSelectionIdx = clientTypeCombo_.getSelectionIndex();
+				String currentTypeId = labelIds_.getIds_()[currentSelectionIdx];
+				if (!oldTypeId.equals(currentTypeId)) {		
+					// handle changing client type
+					ids_.setTypeId(currentTypeId);
+					refreshServerRuntimeSelection();
+				}
+				validationState_ = ValidationUtils.VALIDATE_ALL;
+				statusListener_.handleEvent(null);
+			}
+
+		});    
+    
+    clientGroupComposite_ = new Composite(parent, SWT.NONE);    
+	GridLayout gclayout = new GridLayout();
+	gclayout.numColumns = 2;
+	gclayout.horizontalSpacing=0;		
+	gclayout.marginHeight=0;		
+	gclayout.marginBottom=5;
+	clientGroupComposite_.setLayout( gclayout );
+    GridData gcGridData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true); 
+    clientGroupComposite_.setLayoutData(gcGridData);
+    
+    clientGroupComposite_.addControlListener(new ControlListener()
+	{
+		public void controlMoved(ControlEvent e) {
+			// TODO Auto-generated method stub
+			
+		}
+		public void controlResized(ControlEvent e) {
+			clientGroupComposite_.pack(true);
+		}
+	});
+    
+       
+	clientComposite_ =  new Composite(clientGroupComposite_, SWT.NONE);
+	GridLayout gridlayout   = new GridLayout();
+    gridlayout.numColumns   = 2;
+    gridlayout.horizontalSpacing=0;
+    gridlayout.marginHeight=0;
+    clientComposite_.setLayout( gridlayout );
+    GridData scGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+    clientComposite_.setLayoutData(scGridData);
+    
+    clientScale_ = new Scale(clientComposite_ , SWT.VERTICAL | SWT.BORDER);		
+	utils_.createInfoPop(clientScale_, INFOPOP_WSWSCEN_SCALE_CLIENT);	
+	clientScale_.setMinimum(0);
+	clientScale_.setMaximum(6);
+	clientScale_.setIncrement(1);
+	clientScale_.addSelectionListener(scaleSelectionListener);		
+	setClientScale(getClientGeneration());
+	clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT);
+	
+	Accessible accessibleScale = clientScale_.getAccessible();
+	accessibleScale.addAccessibleListener(new AccessibleAdapter(){
+		// return a string that describes what to do with the slider
+		//  this is read by the screen reader when the slider first gets focus
+		public void getName(AccessibleEvent e) {
+			e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT;			
+		}			
+	});
+	accessibleScale.addAccessibleControlListener(new AccessibleControlAdapter(){
+		// return a meaningful string when the screen reader
+		// attempts to get the value from the service scale
+		public void getValue(AccessibleControlEvent e) {
+			int selection = clientScale_.getSelection();
+			switch (selection) {
+			case 0:
+				e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_TEST;
+				break;
+			case 1:
+				e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_RUN;
+				break;
+			case 2:
+				e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_INSTALL;
+				break;
+			case 3:
+				e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEPLOY;
+				break;
+			case 4:
+				e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_ASSEMBLE;
+				break;
+			case 5:
+				e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEVELOP;
+				break;
+			case 6:				
+				if (clientOnly_)
+					e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT_ONLY;
+				else
+					e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT;				
+				break;
+			default:
+				break;
+			}								
+		}
+	});
+	
+	GridData layoutData1 = new GridData();
+	layoutData1.horizontalAlignment=SWT.CENTER;
+	layoutData1.verticalAlignment = SWT.BEGINNING;
+	Rectangle scaleR = (imageReg_.get(ICON_SCALE_BG_0)).getBounds();	
+	layoutData1.heightHint=scaleR.height;
+	layoutData1.widthHint=scaleR.width+1;
+	clientScale_.setLayoutData(layoutData1);
+		
+	topologySpot_ = new Label(clientComposite_ , SWT.CENTER | SWT.BORDER );
+	topologySpot_.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+	if (clientOnly_)
+		topologySpot_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT_ONLY);
+	else
+	topologySpot_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT);
+	
+	GridData layoutData = new GridData();
+	layoutData.verticalAlignment=SWT.BEGINNING;
+	layoutData.horizontalAlignment=SWT.BEGINNING;
+	Rectangle topR = (imageReg_.get(GRAPHIC_CLIENT_6)).getBounds();
+	layoutData.widthHint=topR.width;
+	layoutData.heightHint=topR.height;
+	topologySpot_.setLayoutData(layoutData);		
+	
+	setGraphics(getClientGeneration());
+		
+	hCompClient_ = utils_.createComposite(clientGroupComposite_, 1);
+	
+	clientDetailsLabel_ = new Label(hCompClient_, SWT.NONE);
+	clientDetailsLabel_.setText(ConsumptionUIMessages.LABEL_SUMMARY);
+	
+	hLinkClientServer_= new Hyperlink(hCompClient_, SWT.NULL);
+	utils_.createInfoPop(hLinkClientServer_, INFOPOP_WSWSCEN_HYPERLINK_SERVER);
+	hLinkClientServer_.setToolTipText(ConsumptionUIMessages.TOOLTIP_PWRS_TEXT_SERVER);
+	hLinkClientServer_.addHyperlinkListener(new IHyperlinkListener(){
+		public void linkActivated(HyperlinkEvent e){			
+			launchRuntimeSelectionDialog(true, true);				
+		}
+		public void linkEntered(HyperlinkEvent e){}
+		public void linkExited(HyperlinkEvent e){}			
+	});
+	
+	hLinkClientRuntime_ = new Hyperlink(hCompClient_, SWT.NULL);
+	utils_.createInfoPop(hLinkClientRuntime_, INFOPOP_WSWSCEN_HYPERLINK_RUNTIME);
+	hLinkClientRuntime_.setToolTipText(ConsumptionUIMessages.TOOLTIP_PWRS_TEXT_RUNTIME);
+	hLinkClientRuntime_.addHyperlinkListener(new IHyperlinkListener(){
+		public void linkActivated(HyperlinkEvent e){			
+			launchRuntimeSelectionDialog(true);
+		}
+		public void linkEntered(HyperlinkEvent e){}
+		public void linkExited(HyperlinkEvent e){}			
+	});
+	
+	IWorkbench workbench = PlatformUI.getWorkbench();
+	projectDialog_ = new ProjectSelectionDialog(workbench.getActiveWorkbenchWindow().getShell(), 
+			new PageInfo(ConsumptionUIMessages.DIALOG_TITILE_CLIENT_PROJECT_SETTINGS, "", 
+                    new WidgetContributorFactory()
+						{	
+							public WidgetContributor create()
+							{	  						 
+							   return new ProjectSelectionWidget(true);
+							}
+						}));
+	
+	hLinkClientProject_ = new Hyperlink(hCompClient_, SWT.NULL);
+	utils_.createInfoPop(hLinkClientRuntime_, INFOPOP_WSWSCEN_HYPERLINK_PROJECTS);
+	hLinkClientProject_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_CLIENTPROJECT_LINK);
+	hLinkClientProject_.addHyperlinkListener(new IHyperlinkListener(){
+		public void linkActivated(HyperlinkEvent e){			
+			launchProjectDialog();
+		}
+		public void linkEntered(HyperlinkEvent e){}
+		public void linkExited(HyperlinkEvent e){}			
+	});
+	
+	hLinkClientEAR_ = new Hyperlink(hCompClient_, SWT.NULL);	
+	utils_.createInfoPop(hLinkClientRuntime_, INFOPOP_WSWSCEN_HYPERLINK_PROJECTS);
+	hLinkClientEAR_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_CLIENTPROJECT_LINK);
+	hLinkClientEAR_.addHyperlinkListener(new IHyperlinkListener(){
+		public void linkActivated(HyperlinkEvent e){			
+			launchProjectDialog();
+		}
+		public void linkEntered(HyperlinkEvent e){}
+		public void linkExited(HyperlinkEvent e){}			
+	});
+	
+	hLinkClientServer_.setText(CLIENT_SERVER_PREFIX); 
+	hLinkClientRuntime_.setText(CLIENT_RUNTIME_PREFIX);
+	hLinkClientProject_.setText(CLIENT_PROJECT_PREFIX);
+	hLinkClientEAR_.setText(CLIENT_EAR_PREFIX);	
+	
+	HyperlinkGroup serverRuntimeGroup = new HyperlinkGroup(Display.getCurrent());
+	serverRuntimeGroup.add(hLinkClientServer_);
+	serverRuntimeGroup.add(hLinkClientRuntime_);
+	serverRuntimeGroup.add(hLinkClientProject_);
+	serverRuntimeGroup.add(hLinkClientEAR_);
+	serverRuntimeGroup.setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_ALWAYS);
+    
+	enableClientSlider(getGenerateProxy());
+	
+    return this;
+  }
+  
+  public void enableClientSlider( boolean enable )
+  {
+	enableProxy_ = enable;
+	clientScale_.setEnabled(enable);
+	int selection = getClientGeneration();
+	if (enable)
+	{				
+		setGraphics(selection);
+	}
+	else
+	{
+		setClientScale(ScenarioContext.WS_NONE);
+		setGraphics(ScenarioContext.WS_NONE);
+		clientScale_.setBackgroundImage(null);  //override background for disable to grey		
+	}	
+	showSummary(enable && (selection <= ScenarioContext.WS_DEVELOP));
+  }
+  
+  private void showSummary(boolean show)
+  {
+	  if (clientOnly_)
+		  show = true;  //short circuit to eliminate flicker...	  
+	  
+	  hLinkClientEAR_.setVisible(show && needEar_);
+	  hLinkClientProject_.setVisible(show);
+	  hLinkClientRuntime_.setVisible(show);
+	  hLinkClientServer_.setVisible(show);
+	  
+	  if (show)
+	  {
+		  clientDetailsLabel_.setText(ConsumptionUIMessages.LABEL_SUMMARY);
+	  }
+	  else
+	  {
+		  if (clientOnly_)
+			  hCompClient_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT_ONLY);
+			else
+		  hCompClient_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT);
+		  clientDetailsLabel_.setText(ConsumptionUIMessages.LABEL_SUMMARY_NO_CLIENT);		  
+	  }	  
+	  clientDetailsLabel_.pack(true);
+	  hLinkClientProject_.pack(true);
+	  hLinkClientEAR_.pack(true);
+	  packIt();
+  }
+
+  public void setTypeRuntimeServer( TypeRuntimeServer ids )
+  {
+	LabelsAndIds                 labelIds   = WebServiceRuntimeExtensionUtils2.getClientTypeLabels();
+    int                          selection  = 0;
+    String[]                     clientIds  = labelIds.getIds_();
+    String                       selectedId = ids.getTypeId();
+    
+    labelIds_ = labelIds;
+	// rskreg
+    clientTypeCombo_.setItems( labelIds.getLabels_() );
+    
+    // Now find the selected one.
+    for( int index = 0; index < clientIds.length; index++ )
+    {
+      if( selectedId.equals( clientIds[index ]) )
+      {
+        selection = index;
+        break;
+      }
+    }
+    
+    clientTypeCombo_.select( selection );    
+	ids_ = ids;
+	
+	if (ids_ != null)
+	{
+		String clientServerText = "";
+		String serverId = ids_.getServerId();
+		if (serverId != null && serverId.length()>0)
+		{
+			clientServerText = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId);
+		} 
+		String clientRuntimeText = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(ids_.getRuntimeId());
+		
+		String currentServerText = hLinkClientServer_.getText();
+		String currentRuntimeText = hLinkClientRuntime_.getText();
+		String newServerText = CLIENT_SERVER_PREFIX + " " + clientServerText;
+		String newRuntimeText = CLIENT_RUNTIME_PREFIX + " " + clientRuntimeText;
+		hLinkClientServer_.setText(newServerText);
+		hLinkClientRuntime_.setText(newRuntimeText);
+		
+		/*check to see if text has changed for server or runtime
+		if so, repaint links */
+		if (!newServerText.equals(currentServerText))
+		{
+			hLinkClientServer_.pack(true);
+			packIt();
+		}			
+		
+		if (!newRuntimeText.equals(currentRuntimeText))
+		{
+			hLinkClientRuntime_.pack(true);
+			packIt();
+		} 	
+	}
+	
+    if (projectDialog_ != null)
+    	projectDialog_.setTypeRuntimeServer(ids_);
+    
+	//When the server changes, the state of needEar could change.
+	//If the the server change results in a change in the state of needEar,
+	//update needEar and clientEarProjectName.    
+    
+	ValidationUtils vu = new ValidationUtils();
+	boolean oldNeedEar = getClientNeedEAR();
+	boolean clientProjectOrProjectTypeNeedsEar;
+
+	if (!oldNeedEar) {
+			// If an EAR was not needed previously it could have been because of
+			// the project/project type or the server.
+			// If it was because of the project/project type, changing the
+			// server should have no impact
+			// on the state of needEar.
+			clientProjectOrProjectTypeNeedsEar = vu.projectOrProjectTypeNeedsEar(getClientProjectName(),
+					getClientComponentType());
+		} else {
+			clientProjectOrProjectTypeNeedsEar = true;
+		}
+
+		// boolean clientProjectOrProjectTypeNeedsEar =
+		// vu.projectOrProjectTypeNeedsEar(getClientProjectName(),
+		// getClientComponentType());
+		if (clientProjectOrProjectTypeNeedsEar) {
+			// Could not rule out need for an Ear from the project/project type
+			// so changing the server
+			// may impact the need for an Ear.
+			boolean currentServerNeedsEar = vu.serverNeedsEAR(getTypeRuntimeServer().getServerId());
+			if (oldNeedEar != currentServerNeedsEar) {
+				// Update needEar and serviceEarProjectName.
+				if (currentServerNeedsEar) {
+					// Calculate a reasonable default for the Ear project name
+					String earProjectName = DefaultingUtils.getDefaultEARProjectName(getClientProjectName());
+					setClientNeedEAR(currentServerNeedsEar);
+					setClientEarProjectName(earProjectName);
+				} else {
+					setClientNeedEAR(currentServerNeedsEar);
+					setClientEarProjectName("");
+				}
+
+			}
+		}		    
+  }
+  
+  public TypeRuntimeServer getTypeRuntimeServer()
+  {
+    return ids_;  
+  }
+      
+  public boolean getGenerateProxy()
+  {
+	  return getClientGeneration() <= ScenarioContext.WS_DEVELOP;
+  }
+  
+  public boolean getDevelopClient() {
+	  return developClient_;
+  }
+
+  public void setDevelopClient(boolean developClient) {
+	  this.developClient_ = developClient;
+  }	
+
+  public boolean getAssembleClient() {
+	  return assembleClient_;
+  }
+
+  public void setAssembleClient(boolean assembleClient) {
+	  this.assembleClient_ = assembleClient;
+  }
+
+  public boolean getDeployClient() {
+	  return deployClient_;
+  }
+
+  public void setDeployClient(boolean deployClient) {
+	  this.deployClient_ = deployClient;
+  }
+  
+  public void setTestClient(Boolean value)
+  {
+	  testClient_ = value;
+  }
+  
+  public Boolean getTestClient()
+  {
+	  return testClient_;
+  }
+  
+  public Boolean getInstallClient()
+  {
+	  return installClient_;
+  }
+  
+  public Boolean getStartClient()
+  {
+	  return startClient_;
+  }
+  
+  public void setInstallClient( Boolean value )
+  {
+      installClient_ = value;    
+  }
+    
+  public void setStartClient( Boolean value )
+  {
+      startClient_ = value;    
+  }
+
+  
+	private void launchProjectDialog()
+	{
+		String currentProjectName = getClientProjectName();
+		String currentEarProjectName = getClientEarProjectName();
+		String currentProjectType = getClientComponentType();
+		boolean currentNeedEar = getClientNeedEAR();
+		
+		projectDialog_.setProjectName(currentProjectName);
+		projectDialog_.setEarProjectName(currentEarProjectName);
+		projectDialog_.setNeedEAR(currentNeedEar);	
+		projectDialog_.setProjectComponentType(currentProjectType);
+		
+		int status = projectDialog_.open();
+		
+		if (status == Window.OK)
+		{
+			String newProjectName = projectDialog_.getProjectName();
+			String newEarProjectName = projectDialog_.getEarProjectName();
+			String newProjectType = projectDialog_.getProjectComponentType();
+			boolean newNeedEar = projectDialog_.getNeedEAR();	
+			
+			//Update project settings and validate page if selections changed.
+			if (!newProjectName.equals(currentProjectName)
+					|| !newEarProjectName.equals(currentEarProjectName)
+					|| !newProjectType.equals(currentProjectType)
+					|| newNeedEar != currentNeedEar) {
+				setClientProjectName(newProjectName);
+				setClientEarProjectName(newEarProjectName);
+				setClientNeedEAR(newNeedEar);
+				setClientComponentType(newProjectType);				
+				validationState_ = (new ValidationUtils()).getNewValidationState(validationState_, ValidationUtils.VALIDATE_PROJECT_CHANGES);
+				statusListener_.handleEvent(null);
+			}
+			
+			/*check to see if text has changed for project or EAR
+			if so, repaint links */
+			if (!newProjectName.equals(currentProjectName))
+			{
+				hLinkClientProject_.pack(true);
+				packIt();
+			}
+			if (!newEarProjectName.equals(currentEarProjectName))
+			{
+				hLinkClientEAR_.pack(true);
+				packIt();
+			}
+		}		
+	}
+  
+  private void launchRuntimeSelectionDialog(boolean clientContext) {
+	  launchRuntimeSelectionDialog(clientContext, false);
+  }
+  
+  private void launchRuntimeSelectionDialog(boolean clientContext, boolean selectServerFirst)
+	{
+	    TypeRuntimeServer currentClientTRS = getTypeRuntimeServer();
+	    RuntimeServerSelectionDialog rssd = new RuntimeServerSelectionDialog(shell_, (byte)1, getTypeRuntimeServer(), "14");
+	    rssd.setSelectServerFirst(selectServerFirst);
+	    int status = rssd.open();
+		if (status == Window.OK)
+		{
+			TypeRuntimeServer newClientTRS = rssd.getTypeRuntimeServer();			
+			if (!currentClientTRS.equals(newClientTRS))
+			{
+				setTypeRuntimeServer(rssd.getTypeRuntimeServer());
+				validationState_ = (new ValidationUtils()).getNewValidationState(validationState_, ValidationUtils.VALIDATE_SERVER_RUNTIME_CHANGES);
+				statusListener_.handleEvent(null); //validate the page
+			}
+		}		
+	}
+  
+  //Private method should be used whenever clientScale_ setting is changed
+  //instead of calling clientScale_.setSelection directly.
+  private void setClientScale(int setting)
+  {
+	  clientScale_.setSelection(setting);
+	  clientScaleSetting_ = setting;
+  }
+  
+  protected void initImageRegistry()
+	{
+		imageReg_ = new ImageRegistry(Display.getCurrent());
+		
+		imageReg_.put(ICON_SCALE_BG_0, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(ICON_SCALE_BG_0));
+		imageReg_.put(ICON_SCALE_BG_1, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(ICON_SCALE_BG_1));
+		imageReg_.put(ICON_SCALE_BG_2, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(ICON_SCALE_BG_2));
+		imageReg_.put(ICON_SCALE_BG_3, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(ICON_SCALE_BG_3));
+		imageReg_.put(ICON_SCALE_BG_4, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(ICON_SCALE_BG_4));
+		imageReg_.put(ICON_SCALE_BG_5, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(ICON_SCALE_BG_5));
+		imageReg_.put(ICON_SCALE_BG_6, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(ICON_SCALE_BG_6));
+		
+		imageReg_.put(GRAPHIC_CLIENT_0, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(GRAPHIC_CLIENT_0));
+		imageReg_.put(GRAPHIC_CLIENT_1, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(GRAPHIC_CLIENT_1));
+		imageReg_.put(GRAPHIC_CLIENT_2, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(GRAPHIC_CLIENT_2));
+		imageReg_.put(GRAPHIC_CLIENT_3, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(GRAPHIC_CLIENT_3));
+		imageReg_.put(GRAPHIC_CLIENT_4, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(GRAPHIC_CLIENT_4));
+		imageReg_.put(GRAPHIC_CLIENT_5, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(GRAPHIC_CLIENT_5));		
+		imageReg_.put(GRAPHIC_CLIENT_6, WebServiceConsumptionUIPlugin
+				.getImageDescriptor(GRAPHIC_CLIENT_6));
+	}
+  
+  private void setGraphics(int selection)
+  {
+     String iconImage = "";
+     String topologyImage = "";
+     
+	  //TODO: change the hard coded integers here to the the ScenarioContext.WS_xxx when in less critical phase
+	  switch (selection) {
+		case 0:
+			iconImage=ICON_SCALE_BG_0;
+			topologyImage=GRAPHIC_CLIENT_0;
+			clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_TEST);
+			break;
+		case 1:
+			iconImage=ICON_SCALE_BG_1;
+			topologyImage=GRAPHIC_CLIENT_1;
+			clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_RUN);
+			break;
+		case 2:
+			iconImage=ICON_SCALE_BG_2;
+			topologyImage=GRAPHIC_CLIENT_2;
+			clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_INSTALL);
+			break;
+		case 3:
+			iconImage=ICON_SCALE_BG_3;
+			topologyImage=GRAPHIC_CLIENT_3;
+			clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEPLOY);
+			break;
+		case 4:
+			iconImage=ICON_SCALE_BG_4;
+			topologyImage=GRAPHIC_CLIENT_4;
+			clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_ASSEMBLE);
+			break;
+		case 5:
+			iconImage=ICON_SCALE_BG_5;
+			topologyImage=GRAPHIC_CLIENT_5;
+			clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEVELOP);
+			break;
+		case 6:			
+			if (!clientOnly_)
+			{
+				if (enableProxy_)  //if service is install run or test...
+					iconImage=ICON_SCALE_BG_6;  
+				else
+					iconImage=null;
+				topologyImage=GRAPHIC_CLIENT_6;
+				clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT);
+			}
+			else
+			{
+				setClientScale(ScenarioContext.WS_DEVELOP); //"no selection" is not allowed...must develop client @ minimum
+				iconImage=ICON_SCALE_BG_5;
+				topologyImage=GRAPHIC_CLIENT_5;				
+				clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEVELOP);			
+			}
+			break;
+		default:
+			break;
+		}
+		clientScale_.setBackgroundImage(imageReg_.get(iconImage));
+		topologySpot_.setImage(imageReg_.get(topologyImage));	
+  }
+  
+	public IStructuredSelection getObjectSelection()
+	{
+		return objectSelection_;		
+	}
+	
+	public void setObjectSelection(IStructuredSelection selection)
+	{
+        objectSelection_ = selection;
+	}
+	
+  public int getClientGeneration()
+  {
+	  return clientScaleSetting_;
+  }
+  
+  public void setClientGeneration(int value)
+  {
+	  if (clientOnly_ && value == ScenarioContext.WS_NONE) {
+		  value = ScenarioContext.WS_DEVELOP;
+		  setDevelopClient(true);
+	  }
+	
+	  clientScaleSetting_ = value;
+	  setClientScale(value);
+	  	  
+	  setGraphics(value);
+	  showSummary(value < ScenarioContext.WS_NONE);
+  }
+  
+  public void setProject(IProject project)
+  {
+	  project_ = project;
+  }
+  
+  public IProject getProject()
+  {
+	  return project_;
+  }
+  
+  public String getClientRuntimeId()
+  {
+	  // calculate the most appropriate clientRuntimeId based on current settings.
+	  return WebServiceRuntimeExtensionUtils2.getClientRuntimeId(getTypeRuntimeServer(), getClientProjectName(), getClientComponentType());   
+
+  }
+  
+  public void setClientComponentType(String type)
+  {
+	  clientComponentType_= type;
+  }
+
+  public String getClientComponentType()
+  {
+	  return clientComponentType_;
+  }
+
+  public void setClientProjectName(String name)
+  {
+    projectName_ = name;      
+	hLinkClientProject_.setText(CLIENT_PROJECT_PREFIX + " " + projectName_);	
+	hLinkClientProject_.pack(true);   
+	packIt();
+  }
+  
+  public String getClientProjectName()
+  {  
+	  if (projectName_ == null)
+		  return "";
+	  return projectName_;
+  }
+  
+  public void setClientEarProjectName(String name)
+  {
+    earProjectName_ = name;  
+    refreshEARLink();
+   		   
+  }
+  
+  public void refreshEARLink()
+  {
+	  hLinkClientEAR_.setVisible(needEar_ && getGenerateProxy());
+	  if (needEar_)
+	  {    	
+		  hLinkClientEAR_.setText(CLIENT_EAR_PREFIX + " " + earProjectName_);
+		  hLinkClientEAR_.pack(true); 
+		  packIt();
+	  }  
+  }
+	    
+  public String getClientEarProjectName()
+  {
+	  if (earProjectName_ == null)
+		  return "";
+     return earProjectName_;  
+  }
+  
+  public void setClientNeedEAR(boolean b)
+  {
+     needEar_ = b;
+     refreshEARLink();
+  } 
+  
+  public boolean getClientNeedEAR()
+  {
+     return needEar_;
+  } 
+  
+  public WebServicesParser getWebServicesParser()
+	{
+		return parser_;
+	}
+	
+	public void setWebServicesParser(WebServicesParser parser)
+	{
+		parser_ = parser;		
+	}
+  
+    //for the purposes of disabling the service implementation controls from the preferences dialog
+	public void disableNonPreferenceWidgets()
+	{
+		if (hCompClient_ != null)
+		{
+			hCompClient_.setVisible(false);			
+		}
+	}
+	
+	public int getValidationState()
+	{
+		return validationState_;
+	}
+	
+	public void setValidationState(int state)
+	{
+		validationState_ = state;
+	}
+		
+	public IStatus checkMissingFieldStatus() {
+
+		ValidationUtils valUtils = new ValidationUtils();
+		String runtimeId = getTypeRuntimeServer().getRuntimeId();
+		String serverId = getTypeRuntimeServer().getServerId();
+		String projectName = getClientProjectName();
+		boolean needEar = getClientNeedEAR();
+		String earProjectName = getClientEarProjectName();
+		String projectTypeId = getClientComponentType();
+		IStatus missingFieldStatus = valUtils.checkMissingFieldStatus(validationState_, null, null, runtimeId, serverId,
+				projectName, needEar, earProjectName, projectTypeId, true);
+		return missingFieldStatus;
+	}
+
+	public IStatus checkErrorStatus() {
+
+		ValidationUtils valUtils = new ValidationUtils();
+		String runtimeId = getTypeRuntimeServer().getRuntimeId();
+		String serverId = getTypeRuntimeServer().getServerId();
+		String typeId = getTypeRuntimeServer().getTypeId();
+		String projectName = getClientProjectName();
+		boolean needEar = getClientNeedEAR();
+		String earProjectName = getClientEarProjectName();
+		String projectTypeId = getClientComponentType();
+		IStatus possibleErrorStatus = valUtils.checkErrorStatus(validationState_, typeId, runtimeId, serverId,
+				projectName, needEar, earProjectName, projectTypeId, true);
+		return possibleErrorStatus;
+	}
+
+	public IStatus checkWarningStatus() {
+		ValidationUtils valUtils = new ValidationUtils();
+
+		int scaleSetting = getClientGeneration();
+		String serverId = getTypeRuntimeServer().getServerId();
+		IStatus warningStatus = valUtils.checkWarningStatus(validationState_, scaleSetting, serverId, true);
+		return warningStatus;
+	}	
+	
+	
+  private class ScaleSelectionListener implements SelectionListener
+	{
+		public void widgetSelected(SelectionEvent e) {
+			    int oldClientScaleSetting = clientScaleSetting_;
+			    
+				setGraphics(((Scale)e.widget).getSelection());
+				
+				int selection = clientScale_.getSelection();
+				setClientGeneration(selection);
+			    
+			    setDevelopClient(selection <= ScenarioContext.WS_DEVELOP);
+				setAssembleClient(selection <= ScenarioContext.WS_ASSEMBLE);
+				setDeployClient(selection <= ScenarioContext.WS_DEPLOY);
+			    setTestClient(new Boolean(selection <= ScenarioContext.WS_TEST));
+				setInstallClient(new Boolean(selection <= ScenarioContext.WS_INSTALL));
+				setStartClient(new Boolean(selection <= ScenarioContext.WS_START));
+				
+				//disable the client settings if the client scenario setting isn't at least "DEVELOP"
+				boolean generate = selection<=ScenarioContext.WS_DEVELOP;
+				showSummary(generate);
+				
+				
+				//When client slider moves out of the "WS_NONE" state, VALIDATE_ALL should be done. 
+				//Otherwise, VALIDATE_SCALE_CHANGES is sufficient.
+				if (oldClientScaleSetting==ScenarioContext.WS_NONE && clientScaleSetting_!=ScenarioContext.WS_NONE)
+				{
+					validationState_ = ValidationUtils.VALIDATE_ALL;
+				}
+				else
+				{
+					validationState_ = (new ValidationUtils()).getNewValidationState(validationState_, ValidationUtils.VALIDATE_SCALE_CHANGES);	
+				}				
+				statusListener_.handleEvent(null); //validate the page
+			}
+		
+
+		public void widgetDefaultSelected(SelectionEvent e) {
+			widgetSelected(e);
+		}
+	} 
+  
+  private void refreshServerRuntimeSelection()
+	{		
+		//new up ServerRuntimeSelectionWidgetDefaultingCommand
+		ClientRuntimeSelectionWidgetDefaultingCommand clientRTDefaultCmd = new ClientRuntimeSelectionWidgetDefaultingCommand();
+		
+		  //call setters of new defaulting command:
+		  clientRTDefaultCmd.setClientInitialSelection(getObjectSelection());
+		  clientRTDefaultCmd.setClientInitialProject(getProject());	      
+	      clientRTDefaultCmd.setClientTypeRuntimeServer(getTypeRuntimeServer());
+		  clientRTDefaultCmd.setWebServicesParser(getWebServicesParser());     
+	      clientRTDefaultCmd.setClientEarProjectName(getClientEarProjectName());
+		  		  
+		  clientRTDefaultCmd.execute(null, null);
+		  
+		  //perform mappings from the defaulting command to the project settings...	
+		  setClientProjectName(clientRTDefaultCmd.getClientProjectName());
+		  setClientEarProjectName(clientRTDefaultCmd.getClientEarProjectName());
+		  setClientComponentType(clientRTDefaultCmd.getClientComponentType());
+		  setTypeRuntimeServer(clientRTDefaultCmd.getClientTypeRuntimeServer());
+          setClientNeedEAR(clientRTDefaultCmd.getClientNeedEAR());
+	}
+}
+
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionTransformer.java
new file mode 100644
index 0000000..6306fbb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionTransformer.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070116   159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer
+ *******************************************************************************/
+
+package org.eclipse.jst.ws.internal.consumption.ui.widgets.object;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.webservice.wsdd.EJBLink;
+import org.eclipse.jst.j2ee.webservice.wsdd.PortComponent;
+import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean;
+import org.eclipse.wst.command.internal.env.core.data.Transformer;
+
+public class EJBSelectionTransformer implements Transformer
+{
+
+  public Object transform(Object value)
+  {
+    if (value instanceof IStructuredSelection)
+    {
+      Object sel = ((IStructuredSelection)value).getFirstElement();
+      if (sel instanceof EnterpriseBean)
+      {
+        return new StructuredSelection(((EnterpriseBean)sel).getName());
+      }
+      else if (sel instanceof ServiceImplBean)
+      {
+        return new StructuredSelection(getBeanName((ServiceImplBean) sel));
+      }
+      else if (sel instanceof EJBLink)
+      {
+        return new StructuredSelection(getBeanName((EJBLink) sel));
+      }
+    }
+    return value;
+  }
+  
+  private String getBeanName(ServiceImplBean bean) {
+	  EObject eObject = bean.eContainer();
+	  if (eObject instanceof PortComponent) {
+		  PortComponent pc = (PortComponent) eObject;
+		  return pc.getPortComponentName();	      	
+	  }
+	  return "";
+  }
+  
+  private String getBeanName(EJBLink link) {
+	  EObject eObject = link.eContainer();
+	  if (eObject instanceof ServiceImplBean)
+		  return getBeanName((ServiceImplBean) eObject);
+	  return "";
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionTransformer.java
new file mode 100644
index 0000000..8e76b88
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionTransformer.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070116   159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets.object;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean;
+import org.eclipse.jst.j2ee.webservice.wsdd.ServletLink;
+import org.eclipse.jst.j2ee.webservice.wsdd.internal.impl.PortComponentImpl;
+import org.eclipse.wst.command.internal.env.core.data.Transformer;
+
+public class JavaBeanSelectionTransformer implements Transformer
+{
+  public Object transform(Object value)
+  {
+    if (value instanceof IStructuredSelection)
+    {
+      Object sel = ((IStructuredSelection)value).getFirstElement();
+      if (sel instanceof IFile)
+      {
+        return new StructuredSelection(computeFullyQualifiedJavaName((IFile)sel));
+      }
+      else if (sel instanceof ICompilationUnit)
+      {
+        IResource res = ((ICompilationUnit)sel).getResource();
+        if (res instanceof IFile)
+          return new StructuredSelection(computeFullyQualifiedJavaName((IFile)res));
+      }
+      else if (sel instanceof ServiceImplBean)
+      {
+        return new StructuredSelection(getBeanName((ServiceImplBean) sel));
+      }
+      else if(sel instanceof ServletLink)
+      {
+        return new StructuredSelection(getBeanName((ServletLink) sel));
+      }
+    }
+    return value;
+  }
+
+  private String computeFullyQualifiedJavaName(IFile resource)
+  {
+    IPath path = resource.getFullPath();
+    String basename = path.lastSegment();
+    String beanClass = "";
+    if (basename != null && basename.length() > 0)
+    {
+      String beanPackage = org.eclipse.jst.ws.internal.common.ResourceUtils.getJavaResourcePackageName(path);
+      beanClass = (beanPackage == null || beanPackage.length() == 0 ? basename : (beanPackage + "." + basename));
+      if (beanClass.toLowerCase().endsWith(".java") || beanClass.toLowerCase().endsWith(".class"))
+        beanClass = beanClass.substring(0, beanClass.lastIndexOf('.'));
+    }
+    return beanClass;
+  }
+  
+  private String getBeanName(ServiceImplBean bean) {
+    EObject eObject = bean.eContainer();
+    if (eObject instanceof PortComponentImpl) {
+      PortComponentImpl pci = (PortComponentImpl) eObject;
+      return pci.getServiceEndpointInterface();	      	
+    }
+    return "";
+  }
+  
+  private String getBeanName(ServletLink link) {    
+    EObject eObject = link.eContainer();
+    if (eObject instanceof ServiceImplBean)
+      return getBeanName((ServiceImplBean) eObject);
+    return "";
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java
new file mode 100644
index 0000000..0dd5eab
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java
@@ -0,0 +1,297 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060830   155114 pmoogk@ca.ibm.com - Peter Moogk, Updated patch for this defect.
+ * 20070116   159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets.object;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.common.UniversalPathTransformer;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.wst.command.internal.env.core.data.Transformer;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.environment.IEnvironment;
+import org.eclipse.wst.common.environment.StatusException;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+
+
+public class ObjectSelectionOutputCommand extends AbstractDataModelOperation
+{
+  private String                 objectSelectionWidgetId_;
+  private IStructuredSelection   objectSelection_;
+  private IObjectSelectionWidget objectSelectionWidget_;
+  private IProject               project_;
+  private String                 componentName_;
+  private WebServicesParser      parser_;
+  
+  private UniversalPathTransformer transformer_ = new UniversalPathTransformer();
+  
+  private boolean                topDown_ = false;
+
+  public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
+  {
+    IEnvironment env = getEnvironment();
+    
+    // Transformation
+    if (objectSelectionWidgetId_ != null && objectSelectionWidgetId_.length() > 0)
+    {
+      Transformer transformer          = ObjectSelectionRegistry.getInstance().getTransformer(objectSelectionWidgetId_);
+      Object      transformedSelection = transformer == null ? null : transformer.transform(objectSelection_);
+      
+      if (transformedSelection instanceof IStructuredSelection)
+      {
+        objectSelection_ = (IStructuredSelection)transformedSelection;
+      }
+    }
+	
+    // Validation
+    IStatus status = (objectSelectionWidget_ != null) ? objectSelectionWidget_.validateSelection(getObjectSelection()) : Status.OK_STATUS;
+    if (status.getSeverity() != Status.OK && env != null)
+    {
+      try
+      {
+        env.getStatusHandler().report(status);
+      }
+      catch (StatusException se)
+      {
+      }
+    }
+	
+    return status;
+  }
+
+  /**
+   * @param typeRuntimeServer The typeRuntimeServer to set.
+   */
+  public void setTypeRuntimeServer(TypeRuntimeServer typeRuntimeServer)
+  {
+    if (typeRuntimeServer != null)
+    {
+      String wst = typeRuntimeServer.getTypeId();
+
+      int scenario = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(wst);
+      String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(wst);
+
+      WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.getWebServiceImplById(implId);
+	    //IWebServiceType wst = WebServiceRuntimeExtensionUtils2.getWebServiceTypeById(typeRuntimeServer.getTypeId());
+
+      if (wsimpl != null)
+      {
+        String objectSelectionWidgetId = null;
+        if (scenario == WebServiceScenario.TOPDOWN)
+        {
+          objectSelectionWidgetId = "org.eclipse.jst.ws.internal.consumption.ui.widgets.object.WSDLSelectionWidget";
+          topDown_ = true;
+        }
+        else
+        {
+          objectSelectionWidgetId = wsimpl.getObjectSelectionWidget();
+        }        
+        
+		    objectSelectionWidgetId_ = objectSelectionWidgetId;
+        
+		    Object object = ObjectSelectionRegistry.getInstance().getSelectionWidget(objectSelectionWidgetId_);
+        
+        if( object instanceof IObjectSelectionWidget )
+        {
+          objectSelectionWidget_ = (IObjectSelectionWidget)object;
+        }
+      }
+    }
+  }
+
+  /**
+   * @return Returns the selection.
+   */
+  public IStructuredSelection getObjectSelection()
+  {
+    return objectSelection_;
+  }
+  /**
+   * @param selection The selection to set.
+   */
+  public void setObjectSelection(IStructuredSelection objectSelection)
+  {
+    objectSelection_ = objectSelection;
+    
+    //Set the project if you can
+    if (project_==null)
+    {
+      project_ = getProjectFromObjectSelection(objectSelection);
+    }
+    
+    //Set the componentName if you can
+    if (componentName_ == null)
+    {
+      componentName_ = getComponentNameFromObjectSelection(objectSelection);
+    }
+    
+    // Check if this is a WSDL selection object.  If it is we need
+    // to unwrap it.
+    if( objectSelection != null && !objectSelection.isEmpty() )
+    {
+      Object object = objectSelection.getFirstElement();
+      
+      if( object instanceof WSDLSelectionWrapper )
+      {
+        WSDLSelectionWrapper wsdlWrapper = (WSDLSelectionWrapper)object;
+        
+        objectSelection_ = wsdlWrapper.wsdlSelection;
+        parser_          = wsdlWrapper.parser;
+      }
+    }
+  }
+  
+  public IProject getProject()
+  {
+    if (project_ == null && topDown_)
+      project_ = getProjectFromTransformedSelection();
+    return project_;
+  }
+  
+  public void setProject(IProject project)
+  {
+    this.project_ = project;
+  }  
+  
+  public String getComponentName()
+  {
+    if (componentName_ == null && topDown_)
+      componentName_ = getComponentNameFromTransformedSelection();
+    return componentName_;
+  }
+
+  public void setComponentName(String componentName)
+  {
+    this.componentName_ = componentName;
+  }
+
+  /**
+   * @return Returns the parser_.
+   */
+  public WebServicesParser getWebServicesParser()
+  {
+    return parser_;
+  }
+  
+  private boolean hasProtocol(String url) { 
+    return url.indexOf(":") != -1;  
+  }
+  
+  private IResource findResourceFromSelection(Object selection) throws CoreException {
+	  
+      IResource resource = ResourceUtils.getResourceFromSelection(selection); 
+	  
+      // try finding at least the project using the EMF way
+      if (resource == null && selection instanceof EObject)
+          resource = ProjectUtilities.getProject(selection);
+	  
+      return resource;
+  }
+  
+  private IProject getProjectFromTransformedSelection() {
+    if (objectSelection_ != null && objectSelection_.size() == 1)
+    {
+      Object obj = objectSelection_.getFirstElement();
+      if (obj instanceof String) {
+        String str = transformer_.toPath((String) obj);
+        if (hasProtocol(str)) return null;
+        return ResourceUtils.getProjectOf(new Path(str));
+      }
+    }
+    return null;	  
+  }
+  
+  private IProject getProjectFromObjectSelection(IStructuredSelection selection)
+  {
+    if (selection != null && selection.size() == 1)
+    {
+      Object obj = selection.getFirstElement();
+      if (obj != null) 
+      {
+        try
+        { 
+          IResource resource = findResourceFromSelection(obj);
+          if (resource==null) 
+            return null;
+          if (resource instanceof IProject)
+        	return (IProject) resource;
+          IProject p = ResourceUtils.getProjectOf(resource.getFullPath());
+          return p;
+        } catch(CoreException e)
+        {
+			e.printStackTrace();
+          return null;
+        }        
+      }
+    }
+    return null;
+  }
+  
+  private String getComponentNameFromTransformedSelection() {
+    if (objectSelection_ != null && objectSelection_.size() == 1)
+    {
+      Object obj = objectSelection_.getFirstElement();
+      if (obj instanceof String) { 
+        String str = transformer_.toPath((String) obj);
+        if (hasProtocol(str)) return null;
+        IVirtualComponent comp = ResourceUtils.getComponentOf(new Path(str));
+        return comp == null ? null : comp.getName();
+      }
+    }
+    return null;	  
+  }
+  
+  private String getComponentNameFromObjectSelection(IStructuredSelection selection)
+  {
+    if (selection != null && selection.size() == 1)
+    {
+      Object obj = selection.getFirstElement();
+      if (obj != null) 
+      {
+        try
+        { 
+          IResource resource = findResourceFromSelection(obj);
+          if (resource==null) 
+            return null;
+     
+          IVirtualComponent comp = ResourceUtils.getComponentOf(resource);
+     
+          if (comp!=null)
+          {
+            return comp.getName();
+          }
+        } catch(CoreException e)
+        {
+      e.printStackTrace();
+          return null;
+        }        
+      }
+    }
+    return null;
+  }  
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java
new file mode 100644
index 0000000..3285958
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060224   129387 pmoogk@ca.ibm.com - Peter Moogk
+ * 20060410   135441 joan@ca.ibm.com - Joan Haggarty
+ * 20060825   155114 pmoogk@ca.ibm.com - Peter Moogk
+ * 20061220   161232 makandre@ca.ibm.com - Andrew Mak, AbstractObjectSelectionWidget.setInitialSelection(IStructuredSelection initialSelection) called twice each time Browse pressed
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets.object;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+
+
+public class ObjectSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget
+{
+  private Composite parent;
+  private Listener statusListener;
+  private Composite composite;
+  private IProject project;
+  private String componentName;
+  private IObjectSelectionWidget child;
+  private Point widgetSize_;
+  
+  public WidgetDataEvents addControls(Composite parentComposite, Listener statListener)
+  {
+    this.parent = parentComposite;
+    this.statusListener = statListener;
+    composite = null;
+    return this;
+  }
+  
+  public Control getControl(){
+	  return composite;
+  }
+  
+  /**
+   * @param typeRuntimeServer The typeRuntimeServer to set.
+   */
+  public void setTypeRuntimeServer(TypeRuntimeServer typeRuntimeServer)
+  {
+    if (composite != null)
+    {
+      composite.dispose();
+      child = null;
+    }
+    if (typeRuntimeServer != null)
+    {
+      String wst = typeRuntimeServer.getTypeId();
+      int scenario = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(wst);
+      String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(wst);
+      WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.getWebServiceImplById(implId);
+      
+	    //IWebServiceType wst = WebServiceRuntimeExtensionUtils.getWebServiceTypeById(typeRuntimeServer.getTypeId());
+      if (wsimpl != null)
+      {
+        String objectSelectionWidgetId = null;
+        if (scenario == WebServiceScenario.TOPDOWN)
+        {
+          objectSelectionWidgetId = "org.eclipse.jst.ws.internal.consumption.ui.widgets.object.WSDLSelectionWidget";
+        }
+        else
+        {
+          objectSelectionWidgetId = wsimpl.getObjectSelectionWidget();
+        }
+
+        Object object = ObjectSelectionRegistry.getInstance().getSelectionWidget( objectSelectionWidgetId );
+        
+        if( object instanceof IObjectSelectionWidget )
+        {
+          child = (IObjectSelectionWidget)object;
+        }
+        
+        if( child != null )
+        {
+          Control shell = parent.getShell();
+          composite = new Composite(parent, SWT.NONE);
+          GridLayout gl = new GridLayout();
+          gl.marginHeight = 0;
+          gl.marginWidth = 0;
+          GridData gd = new GridData(GridData.FILL_BOTH);
+          composite.setLayout(gl);
+          composite.setLayoutData(gd);
+          child.addControls(composite, statusListener);
+
+          Point origSize = shell.getSize();
+          Point compSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+          int   newX     = origSize.x;
+          int   newY     = origSize.y;
+                  
+          // Note: we are trying to determine here if the wizard page should
+          //       be resized based on the size of the control that is
+          //       given to us by the extension.  The hard coded constants
+          //       below represent the vertical and horizontal pixels that need
+          //       to go around object selection control.  Hopefully, a more
+          //       programatic method of doing this can be found in the future.
+          if( compSize.x + 20 > origSize.x )
+          {
+            newX = compSize.x + 20;
+          }
+                  
+          if( compSize.y + 205 > origSize.y )
+          {
+            newY = compSize.y + 205;
+          }
+   
+          widgetSize_ = new Point(newX, newY);                  
+                  
+          return;
+        }
+      }
+    }
+  }
+  
+  public IStatus getStatus()
+  {
+    return (child != null) ? child.getStatus() : Status.OK_STATUS;
+  }
+
+  public void setInitialSelection(IStructuredSelection initialSelection)
+  {
+    project = getProjectFromInitialSelection(initialSelection);
+    componentName = getComponentNameFromInitialSelection(initialSelection);
+    if (child != null)
+      child.setInitialSelection(initialSelection);
+  }
+    
+  public IStructuredSelection getObjectSelection()
+  {
+    return (child != null) ? child.getObjectSelection() : null;
+  }
+  
+  public IStatus validateSelection(IStructuredSelection objectSelection)
+  {
+    return (child != null) ? child.validateSelection(objectSelection) : Status.OK_STATUS;
+  }
+  
+  public IProject getProject()
+  {
+    if (child != null)
+    {
+      IProject p = child.getProject();
+      if (p != null)
+        return p;
+      else
+        return project;
+    }
+    else
+    {
+      return null;
+    }
+  }
+  
+  public String getComponentName()
+  {
+    if (child != null)
+    {
+      String cname = child.getComponentName();
+      if (cname != null && cname.length()>0)
+        return cname;
+      else
+        return componentName;
+    }
+    else
+    {
+      return null;
+    }    
+	 
+  }
+  
+  private IProject getProjectFromInitialSelection(IStructuredSelection selection)
+  {
+    if (selection != null && selection.size() == 1)
+    {
+      Object obj = selection.getFirstElement();
+      if (obj != null) 
+      {
+        try
+        { 
+          IResource resource = ResourceUtils.getResourceFromSelection(obj);
+          if (resource==null) 
+            return null;
+          IProject p = ResourceUtils.getProjectOf(resource.getFullPath());
+          return p;
+        } catch(CoreException e)
+        {
+          return null;
+        }        
+      }
+    }
+    return null;
+  }
+  
+  private String getComponentNameFromInitialSelection(IStructuredSelection selection)
+  {
+    if (selection != null && selection.size() == 1)
+    {
+      Object obj = selection.getFirstElement();
+      if (obj != null) 
+      {
+        try
+        { 
+          IResource resource = ResourceUtils.getResourceFromSelection(obj);
+          if (resource==null) 
+            return null;
+          
+          IVirtualComponent comp = ResourceUtils.getComponentOf(resource);
+          if (comp != null)
+          {
+            return comp.getName();  
+          }          
+        } catch(CoreException e)
+        {
+          return null;
+        }        
+      }
+    }
+    return null;    
+  }
+  
+  public String getObjectSelectionDisplayableString() {
+	return child.getObjectSelectionDisplayableString();    
+  }
+  
+  public Point getWidgetSize()
+  {
+	  Point childWidgetSize = child.getWidgetSize();
+	  if (childWidgetSize == null)
+		  	  return widgetSize_;
+	  return childWidgetSize;
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java
new file mode 100644
index 0000000..eff1617
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070116   159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer
+ * 20070327   172339 kathy@ca.ibm.com - Kathy Chan
+ * 20070713   191357 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets.object;
+
+import java.net.MalformedURLException;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jst.j2ee.webservice.wsclient.internal.impl.ServiceRefImpl;
+import org.eclipse.jst.j2ee.webservice.wsdd.BeanLink;
+import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean;
+import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription;
+import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory;
+import org.eclipse.jst.ws.internal.common.J2EEUtils;
+import org.eclipse.wst.command.internal.env.core.data.Transformer;
+import org.eclipse.wst.ws.internal.ui.utils.AdapterUtils;
+import org.eclipse.wst.wsdl.internal.impl.ServiceImpl;
+import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
+
+public class WSDLSelectionTransformer implements Transformer
+{
+  public Object transform(Object value)
+  {
+    if (value instanceof IStructuredSelection)
+    {
+     IStructuredSelection selection = (IStructuredSelection)value;
+     if (selection != null && !selection.isEmpty()) {
+     
+      Object sel = selection.getFirstElement();
+      if (sel instanceof IResource)
+      {
+        try
+        {
+          return new StructuredSelection(((IResource)sel).getLocation().toFile().toURL().toString());
+        }
+        catch (MalformedURLException murle)
+        {
+        }
+      }
+      else if (sel instanceof ServiceImpl)
+      {
+        return new StructuredSelection(J2EEActionAdapterFactory.getWSDLURI((ServiceImpl)sel));
+      }
+      else if (sel instanceof ServiceRefImpl)
+      {
+        return new StructuredSelection(J2EEActionAdapterFactory.getWSDLURI((ServiceRefImpl)sel));
+      }
+      else if (sel instanceof WSDLResourceImpl)
+      {
+        return new StructuredSelection(J2EEActionAdapterFactory.getWSDLURI((WSDLResourceImpl)sel));
+      }
+      /*
+       * TODO - Remove the cases below after bug 170834 is fixed
+       * 
+       * WSDLSelectionTransformer should not need to handle ServiceImplBean and BeanLink which
+       * represent service classes.  These catches are here for now since we incorrectly allow
+       * the wizard to default to top-down sceanrio when launch from these objects in the JSR-109
+       * branch. 
+       */
+      else if (sel instanceof ServiceImplBean)
+      {
+        return new StructuredSelection(getWSDLURI((ServiceImplBean) sel));
+      }
+      else if (sel instanceof BeanLink)
+      {
+        return new StructuredSelection(getWSDLURI((BeanLink) sel));
+      } else {
+    	  String wsdlURI = AdapterUtils.getAdaptedWSDL(sel);
+    	  if (wsdlURI != null) {
+    		  return new StructuredSelection(wsdlURI);
+    	  }
+      }
+     }
+    }
+    return value;
+  }
+  
+  private String getWSDLURI(ServiceImplBean bean) {
+	  EObject eObject = bean.eContainer();
+	  if (eObject == null)
+		  return "";
+          
+	  eObject = eObject.eContainer();
+      
+	  if (eObject instanceof WebServiceDescription) {
+		  WebServiceDescription wsd = (WebServiceDescription) eObject;
+		  IProject project = ProjectUtilities.getProject(wsd);    	  
+    	  
+		  // getWebContentPath returns the "WebContent" folder path for Web projects
+		  // for EJB projects, it returns the "ebjModule" folder path
+		  IPath path = J2EEUtils.getWebContentPath(project);    	 
+		  path = path.append(wsd.getWsdlFile()); 
+    	  
+		  return path.toString();    	    
+	  }
+	  return "";
+  }
+  
+  private String getWSDLURI(BeanLink link) {
+	  EObject eObject = link.eContainer();
+	  if (eObject instanceof ServiceImplBean)
+		  return getWSDLURI((ServiceImplBean) eObject);
+	  return "";
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java
new file mode 100644
index 0000000..24b3a30
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java
@@ -0,0 +1,719 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060410   135441 joan@ca.ibm.com - Joan Haggarty
+ * 20060410   136011 kathy@ca.ibm.com - Kathy Chan
+ * 20060420   135912 joan@ca.ibm.com - Joan Haggarty
+ * 20060504   119296 pmoogk@ca.ibm.com - Peter Moogk
+ * 20060525   142281 joan@ca.ibm.com - Joan Haggarty
+ * 20060607   144932 kathy@ca.ibm.com - Kathy Chan
+ * 20060612   145081 pmoogk@ca.ibm.com - Peter Moogk
+ * 20060719   139977 kathy@ca.ibm.com - Kathy Chan
+ * 20060803   152701 cbrealey@ca.ibm.com - Chris Brealey
+ * 20060803   152486 makandre@ca.ibm.com - Andrew Mak, Typing WSDL in Service definition field is very slow
+ * 20060825   135570 makandre@ca.ibm.com - Andrew Mak, Service implementation URL not displayed properly on first page
+ * 20060831   155883 makandre@ca.ibm.com - Andrew Mak, service impl field doesn't work after switching from BU to TD
+ * 20061211   161589 makandre@ca.ibm.com - Andrew Mak, NPE in service generation after opening and cancelling from browse dialog
+ * 20070131   168786 makandre@ca.ibm.com - Andrew Mak, wsdl url on web service wizard page 1 is not reflected in browse dialog
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets.object;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobManager;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef;
+import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.common.UniversalPathTransformer;
+import org.eclipse.jst.ws.internal.consumption.common.WSDLParserFactory;
+import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.widgets.TimedWSDLSelectionConditionCommand;
+import org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionTreeWidget;
+import org.eclipse.jst.ws.internal.ui.common.DialogResourceBrowser;
+import org.eclipse.jst.ws.internal.ui.common.FileExtensionFilter;
+import org.eclipse.jst.ws.internal.ui.common.UIUtils;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServiceEntity;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
+import org.eclipse.wst.ws.internal.plugin.WSPlugin;
+import org.eclipse.wst.ws.internal.preferences.PersistentWSDLValidationContext;
+import org.eclipse.wst.wsdl.internal.impl.ServiceImpl;
+import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
+import org.eclipse.wst.wsdl.validation.internal.IValidationMessage;
+
+public class WSDLSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget, Runnable
+{
+  private String              pluginId_;
+  private FileExtensionFilter wsFilter_;
+  private WebServicesParser webServicesParser;
+  private String wsdlURI_;
+  
+  private Composite parent_;
+  private Listener  statusListener_;
+  private ModifyListener modifyListener_;
+  private WSDLSelectionTreeWidget tree;
+  
+  private Timer timer_ = null;
+  
+  private UniversalPathTransformer transformer_ = new UniversalPathTransformer();
+  
+  /*CONTEXT_ID PCON0001 for the WSDL Selection Page*/
+  private final String INFOPOP_PCON_PAGE = "PCON0001";
+
+  /*CONTEXT_ID PCON0002 for the WSDL Document text field of the WSDL Selection Page*/
+  private final String INFOPOP_PCON_TEXT_WSDL = "PCON0002";
+  private Text webServiceURI;
+
+  /*CONTEXT_ID PCON0003 for the WSDL Resource Browse button of the WSDL Selection Page*/
+  private final String INFOPOP_PCON_BUTTON_BROWSE_WSDL = "PCON0003";
+  private Button wsBrowseButton_;
+  
+  /*CONTEXT_ID PCON0004 for the Wizard WSDL Validation table of the WSDL Selection Page*/
+  private ValidationMessageViewerWidget msgViewer_;
+  private ValidateWSDLJob validateWSDLJob_;
+  private JobChangeAdapter    jobChangeAdapter_;
+  
+  /*CONTEXT_ID PCON0005 for the Wizard WSDL Validation summary message of the WSDL Selection Page*/
+  private Text validationSummaryText_;
+  private Text validationSummaryText2_;
+  
+  /*CONTEXT_ID PCON0006 for the Stop Wizard WSDL Validation button of the WSDL Selection Page*/
+  private Button stopValidationButton_;
+  private final String INFOPOP_PCON_BUTTON_STOP_VALIDATION = "PCON0006";
+  
+  public WSDLSelectionWidget()
+  {
+    pluginId_ = "org.eclipse.jst.ws.consumption.ui";
+    wsFilter_ = new FileExtensionFilter(new String[] {"wsdl", "wsil", "html"});
+    webServicesParser = WSDLParserFactory.getWSDLParser();
+    
+    final Runnable handleValidationMessages = new Runnable()
+    {
+	  public void run() 
+      {
+		  msgViewer_.setInput(validateWSDLJob_.getValidationMessages());
+		  updateValidationSummary(validateWSDLJob_.getValidationMessageSeverity());
+		  setValidationInProgress(false);
+      }
+    };
+    
+    jobChangeAdapter_ = new JobChangeAdapter()
+    {
+      public void done(IJobChangeEvent event) 
+      {   	
+    	  if (msgViewer_!= null && msgViewer_.getContentProvider() != null) {
+    		  Display.getDefault().asyncExec( handleValidationMessages );
+		  }
+      }
+    };
+  }
+  
+  public WidgetDataEvents addControls( Composite parent, Listener statusListener )
+  {
+    UIUtils uiUtils  = new UIUtils( pluginId_ );
+    parent_          = parent;
+    statusListener_  = statusListener;
+
+	  parent.setToolTipText( ConsumptionUIMessages.TOOLTIP_PCON_PAGE );
+	  PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, pluginId_ + "." + INFOPOP_PCON_PAGE );
+    
+    Composite wsdlGroup = uiUtils.createComposite( parent, 2, 5, 0 );
+    
+    Label wsLabel = new Label( wsdlGroup, SWT.WRAP);
+    wsLabel.setText( ConsumptionUIMessages.LABEL_WS_SELECTION);
+    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+    gd.horizontalSpan = 2;
+    wsLabel.setLayoutData(gd);
+    wsLabel.setToolTipText( ConsumptionUIMessages.TOOLTIP_PCON_TEXT_WS );
+    
+    webServiceURI = uiUtils.createText( wsdlGroup, null, 
+    						ConsumptionUIMessages.TOOLTIP_PCON_TEXT_WS, 
+    						INFOPOP_PCON_TEXT_WSDL, SWT.SINGLE | SWT.BORDER );
+    modifyListener_ =
+      new ModifyListener()
+      {
+        public void modifyText(ModifyEvent event)
+        {
+          handleWebServiceURIModifyEvent();
+        }
+      };
+    
+    webServiceURI.addModifyListener(modifyListener_);
+    
+//    webServiceURI.addListener( SWT.Modify, statusListener );
+
+    wsBrowseButton_ = uiUtils.createPushButton( wsdlGroup, ConsumptionUIMessages.BUTTON_BROWSE, 
+    								ConsumptionUIMessages.TOOLTIP_PCON_BUTTON_BROWSE_WS, 
+    								INFOPOP_PCON_BUTTON_BROWSE_WSDL );
+    wsBrowseButton_.addSelectionListener(
+      new SelectionListener()
+      {
+        public void widgetDefaultSelected(SelectionEvent event)
+        {
+          handleWSDLButton();
+        }
+        
+        public void widgetSelected(SelectionEvent event)
+        {
+          handleWSDLButton();
+        } 
+      });
+
+    tree = new WSDLSelectionTreeWidget();
+    tree.addControls(parent, statusListener);
+    tree.setWebServicesParser(webServicesParser);    
+    
+    msgViewer_ = new ValidationMessageViewerWidget();
+    msgViewer_.addControls(parent, statusListener);
+    
+    validationSummaryText_ = new Text( parent, SWT.WRAP);
+    validationSummaryText_.setEditable(false);
+    GridData gd1 = new GridData(SWT.FILL, SWT.FILL, false, false);
+    validationSummaryText_.setLayoutData(gd1);
+    validationSummaryText_.setToolTipText( ConsumptionUIMessages.TOOLTIP_VALIDATE_TEXT_MESSAGE_SUMMARY );
+    
+    validationSummaryText2_ = new Text( parent, SWT.WRAP);
+    validationSummaryText2_.setEditable(false);
+    validationSummaryText2_.setLayoutData(gd1);
+    
+    stopValidationButton_ = uiUtils.createPushButton(parent, 
+    			ConsumptionUIMessages.LABEL_BUTTON_STOP_WSDL_VALIDATION, 
+    			ConsumptionUIMessages.TOOLTIP_STOP_VALIDATION_BUTTON, 
+    			INFOPOP_PCON_BUTTON_STOP_VALIDATION);
+    setValidationInProgress(false);
+    
+    stopValidationButton_.addSelectionListener(
+    		new SelectionListener()
+    		{
+    			public void widgetDefaultSelected(SelectionEvent event)
+    			{
+    				handleStopValidationButton();
+    			}
+
+    			public void widgetSelected(SelectionEvent event)
+    			{
+    				handleStopValidationButton();
+    			} 
+    		});
+    
+    setMessageSummary();
+    return this;
+  }
+  
+  private void setMessageSummary() {
+	  String validationMessageSummary = ConsumptionUIMessages.MESSAGE_VALIDATE_NO_WSDL;
+	  PersistentWSDLValidationContext wsdlValidationContext = WSPlugin.getInstance().getWSDLValidationContext();
+	  String validationSelection = wsdlValidationContext.getPersistentWSDLValidation();
+	  if (PersistentWSDLValidationContext.VALIDATE_REMOTE_WSDL.equals(validationSelection)) {
+		  validationMessageSummary = ConsumptionUIMessages.MESSAGE_VALIDATE_REMOTE_WSDL;
+	  } else if (PersistentWSDLValidationContext.VALIDATE_ALL_WSDL.equals(validationSelection)) {
+		  validationMessageSummary = ConsumptionUIMessages.MESSAGE_VALIDATE_ALL_WSDL;
+	  }
+	  validationSummaryText_.setText( validationMessageSummary );
+	  validationSummaryText2_.setText(" ");
+  }
+  
+  private void handleWebServiceURIModifyEvent()
+  {
+    if (webServiceURI.getText().indexOf(':') > 0) {
+      timer_ = Timer.newInstance(timer_, Display.getCurrent(), this);
+      timer_.startTimer();
+    }
+    else
+      handleWebServiceURI();
+    statusListener_.handleEvent(null);
+  }
+  
+  private void handleWebServiceURI() {
+	  handleWebServiceURI(webServiceURI.getText());
+  }
+  
+  private void handleWebServiceURI(String wsURI)
+  {    
+    if (wsURI.indexOf(':') < 0)
+    {
+      IFile file = uri2IFile(wsURI);
+      if (file != null)
+        wsURI = iFile2URI(file);
+    }
+    if (wsURI != null && wsURI.indexOf(':') >= 0 && webServicesParser.getWebServiceEntityByURI(wsURI) == null)
+    {
+      TimedWSDLSelectionConditionCommand cmd = new TimedWSDLSelectionConditionCommand();
+      cmd.setWebServicesParser(webServicesParser);
+      cmd.setWebServiceURI(wsURI);
+      cmd.execute(null, null);
+    }
+    WebServiceEntity entity = webServicesParser.getWebServiceEntityByURI(wsURI);
+    if (entity != null && entity.getType() == WebServiceEntity.TYPE_WSDL)
+      tree.setEnabled(false);
+    else
+      tree.setEnabled(true);
+    tree.setWebServiceURI(wsURI);
+    tree.refreshTreeViewer();  
+    wsdlURI_ = wsURI;
+  }
+  
+  public void run()
+  {
+    handleWebServiceURI();
+    statusListener_.handleEvent(null);
+  }
+
+  private void handleWSDLButton()
+  {
+    DialogResourceBrowser dialog = new DialogResourceBrowser( parent_.getShell(), null, wsFilter_);
+    dialog.open();
+    IResource res = dialog.getFirstSelection();
+    if( res != null )
+    {
+    	wsdlURI_ = res.getFullPath().toString();
+    	webServiceURI.setText( wsdlURI_ );    	
+    }
+    	
+    statusListener_.handleEvent(null);
+  }
+  
+  private void setValidationInProgress(boolean validating) {
+	  stopValidationButton_.setEnabled(validating);
+  }
+  
+  private void handleStopValidationButton()
+  {
+	  IJobManager    jobManager     = Platform.getJobManager();
+	  Job[]          jobs           = jobManager.find( ValidateWSDLJob.VALIDATE_WSDL_JOB_FAMILY );
+	  ValidateWSDLJob existingValidateWSDLJob = null;
+	  
+	  if( jobs.length > 0 )
+	  {
+		  for (int i=0; i<jobs.length; i++) {
+			  existingValidateWSDLJob = (ValidateWSDLJob)jobs[i];
+
+			  if (existingValidateWSDLJob.getState() != Job.NONE) { 
+				  existingValidateWSDLJob.cancel();
+			  }
+		  }
+	  }
+	  clearValidationMessages();
+	  setValidationInProgress(false);
+  }
+  
+  private void clearValidationMessages() {
+	  msgViewer_.clearInput();
+	  validationSummaryText_.setText(" " );
+	  validationSummaryText2_.setText(" ");
+  }
+  
+  public IStatus getStatus()
+  {
+    // Timer validation
+    /*
+     * Commenting out because we don't want to block fast typers from hitting Next/Finish 
+    if (Timer.isRunning())
+      return new SimpleStatus("", ConsumptionUIMessages.PAGE_MSG_LOADING_WEB_SERVICE_URI, Status.ERROR);
+    */
+	
+    // Validate the String representation of the Web service URI
+    // For example, is it pointing to an existing resource in the workspace?
+    String wsPath  = webServiceURI.getText();
+    if( wsPath == null || wsPath.length() <= 0 ) {
+    	clearValidationMessages();
+    	return StatusUtils.errorStatus( ConsumptionUIMessages.PAGE_MSG_INVALID_WEB_SERVICE_URI );
+    }
+    else if( wsPath.indexOf(':') < 0 )
+    {
+    	IResource res = ResourceUtils.findResource(wsPath);
+    	if( res == null ) {
+    		clearValidationMessages();
+    		return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.PAGE_MSG_NO_SUCH_FILE, new Object[] {wsPath}) );
+    	}
+    	else if( res.getType() != IResource.FILE ) {
+    		clearValidationMessages();
+    		return StatusUtils.errorStatus( ConsumptionUIMessages.PAGE_MSG_INVALID_WEB_SERVICE_URI );
+    	}
+    }
+
+    
+    // Validate the content of the Web service URI
+    // For example, is selection a WSDL URI?
+    if (!Timer.isRunning(timer_) && tree.isEnabled())
+    {
+      IStatus status = tree.getStatus();
+      if (status != null)
+      {
+        int severity = status.getSeverity();
+        if (severity == Status.ERROR || severity == Status.WARNING) {
+        	clearValidationMessages();
+        	return status;
+        }
+      }
+    }
+    else
+    {
+    	if( wsPath.indexOf(':') < 0 )
+        {
+          String wsdlURI = iFile2URI((IFile)ResourceUtils.findResource(wsPath));
+          if (webServicesParser.getWSDLDefinition(wsdlURI) == null) {
+        	  clearValidationMessages();
+        	  return StatusUtils.errorStatus(ConsumptionUIMessages.PAGE_MSG_SELECTION_MUST_BE_WSDL );
+          }
+        }
+    }
+    
+    
+    if (!Timer.isRunning(timer_)) {
+    	String wsdlURI1 = wsPath;
+    	 boolean isRemote = true;
+    	if (tree.isEnabled()) { // is wsil
+    		wsdlURI1 = tree.getWsdlURI();
+    		if (wsdlURI1.startsWith("file:") || wsdlURI1.startsWith("platform:"))
+    		{
+    			isRemote = false;
+    		}
+    	} else {
+    		if (wsPath.indexOf(':') < 0)
+    		{
+    			isRemote = false;
+    			wsdlURI1 = iFile2URI((IFile)ResourceUtils.findResource(wsPath));
+    		}
+    		else if (wsPath.startsWith("file:") || wsPath.startsWith("platform:"))
+    		{
+    			isRemote = false;
+    		}
+    	}
+  	  
+      setMessageSummary();
+	  msgViewer_.clearInput();
+  	  validateWSDL(wsdlURI1, isRemote);
+    }
+    
+
+    // OK status
+    return Status.OK_STATUS;
+  }
+  
+  private void validateWSDL (String wsdlURI, boolean isRemote) {
+
+	  String validationSelection = WSPlugin.getInstance().getWSDLValidationContext().getPersistentWSDLValidation();;
+	  if ((PersistentWSDLValidationContext.VALIDATE_ALL_WSDL.equals(validationSelection)) ||
+			  (PersistentWSDLValidationContext.VALIDATE_REMOTE_WSDL.equals(validationSelection) && isRemote)) {
+
+		  IJobManager    jobManager     = Platform.getJobManager();
+		  Job[]          jobs           = jobManager.find( ValidateWSDLJob.VALIDATE_WSDL_JOB_FAMILY );
+		  ValidateWSDLJob existingValidateWSDLJob = null;
+		  
+		  boolean startWSDLValidation = true;
+		  validationSummaryText_.setText( ConsumptionUIMessages.MESSAGE_VALIDATE_IN_PROGRESS );
+		  validationSummaryText2_.setText(" ");
+		  if( jobs.length > 0 )
+		  {
+			  for (int i=0; i<jobs.length; i++) {
+				  existingValidateWSDLJob = (ValidateWSDLJob)jobs[i];
+				  
+				  if (existingValidateWSDLJob.getState() != Job.NONE) { 
+					  // Job running or to be run
+					  // If the job is validating the same wsdlURI, let it finish running and ignore this one.
+					  // It is not for the same wsdlURI, cancel the job and schedule this one.
+
+					  if (!wsdlURI.equals(existingValidateWSDLJob.getWsdlURI())) {
+						  existingValidateWSDLJob.cancel();
+						  setValidationInProgress(false);
+					  } else {						  
+						  startWSDLValidation = false;
+					  }
+				  } 
+			  }
+		  } 
+		  
+		  if (startWSDLValidation) {
+			  startWSDLValidationJob(wsdlURI);
+		  }
+	  }
+	  return;
+  }
+  
+  private void startWSDLValidationJob (String wsdlURI) {
+	  validateWSDLJob_ = new ValidateWSDLJob(wsdlURI);
+	  validateWSDLJob_.addJobChangeListener( jobChangeAdapter_ );
+	  validateWSDLJob_.schedule();
+	  setValidationInProgress(true);
+  }
+  
+  public void updateValidationSummary(int messageSeverity)
+  {
+  	
+  	switch (messageSeverity) {
+  	case IValidationMessage.SEV_ERROR:
+		validationSummaryText_.setText(ConsumptionUIMessages.ERROR_MESSAGES_IN_VALIDATION);
+		validationSummaryText2_.setText(ConsumptionUIMessages.WARNING_IF_CONTINUE);
+		break;
+	case IValidationMessage.SEV_WARNING:
+		validationSummaryText_.setText(ConsumptionUIMessages.WARNING_MESSAGES_IN_VALIDATION);
+		validationSummaryText2_.setText(ConsumptionUIMessages.WARNING_IF_CONTINUE);
+		break;
+	default:
+		validationSummaryText_.setText(ConsumptionUIMessages.VALIDATION_COMPLETED);
+		validationSummaryText2_.setText(" ");
+		break;
+	}
+  }
+  
+  private IFile uri2IFile(String uri)
+  {
+    IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(uri);
+    
+    if (res instanceof IFile)
+      return (IFile)res;
+    else
+      return null;
+  }
+  
+  private String iFile2URI(IFile file)
+  {
+  	File f = file.getLocation().toFile();
+    try
+    {
+      return f.toURL().toString();
+    }
+    catch (MalformedURLException murle)
+    {
+    }
+    return f.toString();
+  }
+
+  public void setInitialSelection(IStructuredSelection initialSelection)
+  {
+    if (initialSelection != null && !initialSelection.isEmpty())
+    {
+      Object object = initialSelection.getFirstElement();
+      String wsdlURI = toWsdlURI(object);  
+      wsdlURI_ = wsdlURI;
+      
+      if (wsdlURI != null && webServiceURI != null)
+      {
+        handleWebServiceURI(wsdlURI);
+    	
+        webServiceURI.removeModifyListener(modifyListener_);
+        webServiceURI.setText(getObjectSelectionDisplayableString());       
+        webServiceURI.addModifyListener(modifyListener_);
+      }
+    }  
+  }
+  
+  private String toWsdlURI(Object object)
+  {
+    if (object instanceof ServiceImpl)
+      return J2EEActionAdapterFactory.getWSDLURI((ServiceImpl)object);
+    else if (object instanceof WSDLResourceImpl)
+      return J2EEActionAdapterFactory.getWSDLURI((WSDLResourceImpl)object);
+    else if (object instanceof ServiceRef)
+      return J2EEActionAdapterFactory.getWSDLURI((ServiceRef)object);
+    else if (object instanceof IFile)
+      return ((IFile)object).getFullPath().toString();
+    else if (object instanceof String)
+      return (String)object;
+    else
+      return null;
+  }
+  
+  public IStructuredSelection getObjectSelection()
+  {
+	  StructuredSelection ss; 
+	  if (tree != null && tree.getWsdlURI() != null)
+		  ss = new StructuredSelection(tree.getWsdlURI());
+	  else
+		  ss = new StructuredSelection(wsdlURI_);
+	return new StructuredSelection( 
+               new WSDLSelectionWrapper( webServicesParser, ss));
+  }
+  
+  public WebServicesParser getWebServicesParser()
+  {
+    return webServicesParser;
+  }
+  
+  public IStatus validateSelection(IStructuredSelection objectSelection)
+  {
+    return Status.OK_STATUS;
+  }
+  
+  public IProject getProject()
+  {
+	String wsdlURI;
+
+	if (tree != null)
+       wsdlURI = tree.getWsdlURI();
+	else
+		wsdlURI = wsdlURI_;
+	
+    if (wsdlURI != null)
+    {
+      IProject p = getProjectFromURI(wsdlURI);
+      if (p!=null && p.exists())
+        return p;
+      
+      String wsRelPath = wsdlURI_;
+      IResource wsRes = ResourceUtils.findResource(wsRelPath);
+      if (wsRes!=null && wsRes instanceof IFile)
+      {
+        IProject p2 = ((IFile)wsRes).getProject();
+        return p2;
+      }
+      
+    }
+    return null;
+  }
+  
+  public String getComponentName()
+  {
+	 
+    String wsdlURI;
+    if (tree != null)
+    	wsdlURI = tree.getWsdlURI();
+    else 
+    	wsdlURI = wsdlURI_;
+    
+    if (wsdlURI != null)
+    {
+      String cname = getComponentNameFromURI(wsdlURI);
+      if (cname!=null && cname.length()>0)
+        return cname;
+      
+      String wsRelPath = wsdlURI_;
+      IResource wsRes = ResourceUtils.findResource(wsRelPath);
+      if (wsRes!=null && wsRes instanceof IFile)
+      {
+        IVirtualComponent comp = ResourceUtils.getComponentOf(wsRes);
+        if (comp!=null)
+        {
+          return comp.getName();
+        }
+      }
+      
+    }
+    return null;
+  }
+  
+  private IProject getProjectFromURI(String uri)
+  {
+    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+    String wkspcRootLoc = root.getLocation().toString();
+    int idx = uri.indexOf(wkspcRootLoc);
+    if (idx != -1) 
+    {
+      String relPath = uri.substring(wkspcRootLoc.length()+idx);
+      IResource res = root.findMember(new Path(relPath));
+      if (res instanceof IFile)
+      {
+        IProject p = ((IFile)res).getProject();
+        return p;
+      }
+    }
+    return null;
+  }
+  
+  private String getComponentNameFromURI(String uri)
+  {
+    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+    String wkspcRootLoc = root.getLocation().toString();
+    int idx = uri.indexOf(wkspcRootLoc);
+    if (idx != -1) 
+    {
+      String relPath = uri.substring(wkspcRootLoc.length()+idx);
+      IResource res = root.findMember(new Path(relPath));
+      if (res instanceof IFile)
+      {
+        IVirtualComponent comp = ResourceUtils.getComponentOf(res);
+        if (comp!=null)
+        {
+          return comp.getName();
+        }        
+      }
+    }
+    return null;    
+  }
+  
+  public String getObjectSelectionDisplayableString() 
+  {	
+    if (tree != null)
+    {
+      return transformer_.toPath(tree.getWsdlURI());
+    }
+    else
+    {
+	    return transformer_.toPath(wsdlURI_);
+    }
+	}
+  
+  public Point getWidgetSize() {	
+	  return new Point( 580, 580);  
+  }
+  
+  public boolean validate(String s) {
+	  String wsURI = s;
+	    
+	    if (wsURI.indexOf(':') < 0)
+	    {
+	      IFile file = uri2IFile(wsURI);
+	      if (file != null)
+	        wsURI = iFile2URI(file);
+	    }
+	    if (wsURI != null && wsURI.indexOf(':') >= 0 && webServicesParser.getWebServiceEntityByURI(wsURI) == null)
+	    {
+	      TimedWSDLSelectionConditionCommand cmd = new TimedWSDLSelectionConditionCommand();
+	      cmd.setWebServicesParser(webServicesParser);
+	      cmd.setWebServiceURI(wsURI);
+	      cmd.execute(null, null);
+	    }
+		
+	    // prime widget based on the string
+	    wsdlURI_ = wsURI;
+	    if (tree != null)
+	      tree.setWebServiceURI(wsURI);
+	    
+	    WebServiceEntity entity = webServicesParser.getWebServiceEntityByURI(wsURI);
+	    if (entity != null && entity.getType() == WebServiceEntity.TYPE_WSDL)
+             return true;
+	    else
+	    	return false;
+	    
+  } 
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
new file mode 100644
index 0000000..e71ed1e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
@@ -0,0 +1,1602 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060131 121071   rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060206 126408   rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060222   115834 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060227   124392 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060315   131963 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060418   129688 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060427   126780 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060427   126780 kathy@ca.ibm.com - Kathy Chan
+ * 20060427   138058 joan@ca.ibm.com - Joan Haggarty
+ * 20060523   133714 joan@ca.ibm.com - Joan Haggarty
+ * 20060525   143843 joan@ca.ibm.com - Joan Haggarty
+ * 20060905   156230 kathy@ca.ibm.com - Kathy Chan, Handling projects with no target runtime
+ * 20070326   159458 mahutch@ca.ibm.com - Mark Hutchinson
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.server.core.FacetUtil;
+import org.eclipse.jst.ws.internal.common.J2EEUtils;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.common.ServerUtils;
+import org.eclipse.jst.ws.internal.consumption.common.FacetMatcher;
+import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
+import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
+import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.common.DefaultingUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
+import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext;
+import org.eclipse.jst.ws.internal.consumption.ui.preferences.ProjectTopologyContext;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.FacetMatchCache;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
+import org.eclipse.wst.command.internal.env.core.selection.SelectionList;
+import org.eclipse.wst.command.internal.env.core.selection.SelectionListChoices;
+import org.eclipse.wst.common.environment.IEnvironment;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
+import org.eclipse.wst.ws.internal.wsrt.IContext;
+import org.eclipse.wst.ws.internal.wsrt.ISelection;
+import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
+import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime;
+import org.eclipse.wst.ws.internal.wsrt.SimpleContext;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceState;
+
+public class ClientRuntimeSelectionWidgetDefaultingCommand extends AbstractDataModelOperation
+{   
+  private String DEFAULT_CLIENT_EAR_PROJECT_EXT = "EAR";
+  private TypeRuntimeServer    clientIds_;
+  private boolean clientIdsFixed_ = false;
+  private String clientRuntimeId_;
+  private String clientProjectName_;
+  private String clientEarProjectName_;
+  protected boolean clientNeedEAR_ = true;
+  private String clientComponentType_;
+  private FacetMatcher clientFacetMatcher_;
+  
+  private IContext          context_;
+  private ISelection        selection_;
+  private IWebServiceClient webServiceClient_;
+  private ResourceContext   resourceContext_;
+  private boolean           test_;
+  
+  //A note on initial projects ...
+  //The difference between clientInitialProject_ and initialProject_ is that
+  //clientInitialProject_ comes from the ObjectSelectionOutputCommand while initialProject_
+  //comes from SelectionCommand (i.e. it is the project containing the thing that was selected before 
+  //the wizard was launched). In the defaulting algorithm, clientInitialProject_ will 
+  //be given first priority. If, however, it is deemed that clientInitialProject_ is not a valid project 
+  //because it contains the J2EE Web service for which we are trying to create a client, initialProject_
+  //will be given second priority.
+  private IProject initialProject_; //This is the project containing the selection prior to the wizard being launched.
+  private IProject clientInitialProject_; //This is the project containing the object selection from page 2.
+  private String wsdlURI_;
+  private WebServicesParser parser_;  
+
+  public ClientRuntimeSelectionWidgetDefaultingCommand()
+  {
+    super();
+  }
+  
+  public void setClientTypeRuntimeServer( TypeRuntimeServer ids )
+  {
+    clientIds_ = ids;
+  }
+  
+  public TypeRuntimeServer getClientTypeRuntimeServer()
+  {
+    return clientIds_; 
+  }
+  
+  public void setClientIdsFixed(boolean b)
+  {
+    clientIdsFixed_ = b;  
+  }
+  
+  public String getClientRuntimeId()
+  {
+    return clientRuntimeId_;
+  }
+  
+  public String getClientProjectName()
+  {
+    return clientProjectName_;
+  }
+  
+  public String getClientEarProjectName()
+  {
+    return clientEarProjectName_;
+  }
+  
+  public void setClientEarProjectName(String name)
+  {
+    clientEarProjectName_ = name;
+  }
+  
+  public String getClientComponentType()
+  {
+    return  clientComponentType_;
+  }
+  
+  public IWebServiceClient getWebService()
+  {
+    return webServiceClient_;  
+  }
+    
+  public IContext getContext()
+  {
+    return context_;
+  }  
+  
+  public ISelection getSelection()
+  {
+    return selection_;    
+  }
+  
+  /**
+   * Defaults the following bits of information in the following order:
+   * clientRuntimeId_ : the clientRuntimeId. Must be defaulted to non-empty String.
+   * clientIds_.runtimeId_: the Web service runtime id. Must be defaulted to non-empty String.
+   * clientProjectName_ : the name of the client project. Must be non-empty. May or may not exist.
+   * clientComponentType_: the id of the client project template. Must be empty if the client
+   *                        project exists. Must be non-empty of the client project does not exist.
+   * clientIds_.serverId_: the server type id. May be an empty String if the defaulted Web service runtime
+   *                        does not require a server.
+   * clientIds_.serverInstanceId_: the server id. May be null or an empty String.
+   * clientNeedEAR_: true if an EAR is needed. False otherwise.
+   * clientEarProjectName_: the client EAR project. Must be empty if the clientNeedEAR_ is false.
+   *                         Must be non-empty if the clientNeedEAR_ is true.
+   * webServiceClient_ : the IWebServiceClient based on the calculated defaults. Must be non-null for "Next"
+   *                     button to be enabled on the page following this command.
+   * context_ : an IContext. Must be non-null for "Next" button to be enabled on the page following this command.                         
+   */  
+  public IStatus execute(IProgressMonitor monitor, IAdaptable adaptable)
+  {
+
+    IEnvironment env = getEnvironment();
+
+    try
+    {
+      
+      //**Step 1** Default the Web service runtime.
+    	
+      //clientIdsFixed_ is set to true for the Ant scenario. It's always false for the wizard
+      //scenarios.
+      if (clientIdsFixed_ && (clientProjectName_ == null))
+      {
+        // Set the clientRuntime based on the runtime, server, and initial
+        // selection.
+        DefaultRuntimeTriplet drt = getDefaultClientRuntimeForFixedRuntimeAndServer(clientInitialProject_);
+        clientFacetMatcher_ = drt.getFacetMatcher();
+        clientProjectName_ = drt.getProjectName();
+        clientRuntimeId_ = drt.getRuntimeId();        
+      } 
+      else      
+      {	
+        ValidationUtils vu = new ValidationUtils();
+        
+        // Set the runtime based on the project containing the object selection/initial selection.
+        DefaultRuntimeTriplet drt = null;
+        
+        if (!vu.isProjectServiceProject(clientInitialProject_, wsdlURI_, parser_) && !clientIdsFixed_)
+        {
+          //If clientIntialProject_ does not contain the J2EE Web service, choose a clientRuntime based on it.
+          drt = getDefaultRuntime(clientInitialProject_, clientIds_.getTypeId(), true);
+          clientFacetMatcher_ = drt.getFacetMatcher();
+          clientProjectName_ = drt.getProjectName(); 
+          clientRuntimeId_ = drt.getRuntimeId();          
+        }
+        else
+        {
+          //clientInitialProject_ contains the J2EE Web service so don't use it.
+          //Try using the initalProject_ instead.
+          if (!vu.isProjectServiceProject(initialProject_, wsdlURI_, parser_) && !clientIdsFixed_)
+          {
+            //If intialProject_ does not contain the J2EE Web service, choose a clientRuntime based on it.
+            drt = getDefaultRuntime(initialProject_, clientIds_.getTypeId(), true);
+            clientFacetMatcher_ = drt.getFacetMatcher();
+            clientProjectName_ = drt.getProjectName();
+            clientRuntimeId_ = drt.getRuntimeId();            
+          }
+          else
+          {
+            //Both clientIntialProject_ and initialProject_ contain the J2EE Web service
+            //and cannot be used to influence clientRuntime defaulting.
+            //Choose a clientRuntime but don't choose clientInitialProject_
+            //as the clientProject.
+            drt = getDefaultRuntime(null, clientIds_.getTypeId(), true);
+            clientRuntimeId_ = drt.getRuntimeId();                      
+          }
+        }
+
+        //Set the Web service runtime id from the clientRuntime
+        clientIds_.setRuntimeId(WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRuntime()
+            .getId());
+      }
+      
+      //**Step 2** Default the client project if it was not already defaulted 
+      //as part of defaulting the Web service runtime.
+      if (clientProjectName_ == null)
+      {
+        // Project name did not get set when the runtime was set, so set it now
+        clientProjectName_ = getDefaultClientProjectName();
+      }
+
+      //**Step 3** Default the client project type.      
+      IProject clientProject = ProjectUtilities.getProject(clientProjectName_);
+      if (!clientProject.exists())
+      {
+        // Set the project template
+        clientComponentType_ = getDefaultClientProjectTemplate();
+      }
+      else
+      {
+        //Set it to an empty String
+        clientComponentType_ = "";
+      }
+
+
+      //**Step 4** Default the client server if this is not an Ant scenario.
+      if (!clientIdsFixed_)
+      {
+        IStatus serverStatus = setClientDefaultServer();
+        if (serverStatus.getSeverity() == Status.ERROR)
+        {
+          env.getStatusHandler().reportError(serverStatus);
+          return serverStatus;
+        }
+      }
+      
+      //**Step 5** Default clientNeedEAR and client EAR if an EAR is needed
+      setDefaultClientEarProject();      
+      
+      
+      //**Step 6** Calculate default IWebServiceClient. This is need to make sure that
+      // Next is enabled on the page following this command.
+      setDefaultsForExtension(env);
+
+      return Status.OK_STATUS;
+      
+    } catch (Exception e)
+    {
+      // Catch all Exceptions in order to give some feedback to the user
+      IStatus errorStatus = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_ERROR_TASK_EXCEPTED,
+          new String[] { e.getMessage() }), e);
+      env.getStatusHandler().reportError(errorStatus);
+      return errorStatus;
+    }
+  }
+  
+  private void setDefaultClientEarProject()
+  {    
+    //Don't need an ear if this is a Java project, or if the selected template is jst.utility
+    IProject clientProject = ProjectUtilities.getProject(clientProjectName_);
+    if (clientProject.exists())
+    {
+      clientNeedEAR_ = !(FacetUtils.isJavaProject(clientProject));
+    }
+    else
+    {
+      clientNeedEAR_ = !(FacetUtils.isUtilityTemplate(clientComponentType_));  
+    }
+    
+    //If clientNeedEAR_ is still true, it means that we're not dealing with a Java project
+    //or Java project type. Check the server.
+    if (clientNeedEAR_)
+    {
+      // Determine if an ear selection is needed based on the server type.
+
+      String serverId = clientIds_.getServerId();
+      if (serverId != null)
+      {
+        // Use the server type
+        String serverTargetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverId);
+        if (serverTargetId != null && serverTargetId.length() > 0)
+        {
+          if (!ServerUtils.isTargetValidForEAR(serverTargetId, "13"))
+          {
+            // Default the EAR selection to be empty
+            clientNeedEAR_ = false;
+          }
+        }
+      } else {  // serverId == null, assume that it does not need EAR
+    	  clientNeedEAR_ = false;
+    	  
+      }
+    }
+    
+    if (clientNeedEAR_)
+    {
+    	clientEarProjectName_ = DefaultingUtils.getDefaultEARProjectName(clientProjectName_);
+    }
+    else
+    {
+      clientEarProjectName_ = "";
+    }   
+  }
+  
+  private IStatus setClientDefaultServer()
+  {
+    //Choose an existing server the module is already associated with if possible
+    IProject clientProject = ProjectUtilities.getProject(clientProjectName_);
+    IServer[] configuredServers = ServerUtil.getServersByModule(ServerUtils.getModule(clientProject), null);
+    
+    if (configuredServers!=null && configuredServers.length>0 && configuredServers[0].getServerType() != null)
+    {
+      clientIds_.setServerId(configuredServers[0].getServerType().getId());
+      clientIds_.setServerInstanceId(configuredServers[0].getId());
+      return Status.OK_STATUS;            	
+    }
+    
+    //If the project exists, choose a suitable server or server type based on the existing project's runtime or facets
+    if (clientProject.exists())
+    {
+      IServer server = getServerFromProject(clientProjectName_, clientFacetMatcher_);
+      if (server != null && server.getServerType() != null)
+      {
+        clientIds_.setServerId(server.getServerType().getId());
+        clientIds_.setServerInstanceId(server.getId());
+        return Status.OK_STATUS;
+      }
+      else
+      {
+        IServerType serverType = getServerTypeFromProject(clientProjectName_, clientFacetMatcher_);
+        if (serverType != null)
+        {
+          clientIds_.setServerId(serverType.getId());
+          return Status.OK_STATUS;
+        }
+      }
+    }
+
+    //Haven't picked a server/server type on the basis of the project. Pick a server/server type
+    //that is compatible with the clientRuntimeId.
+    IServer server = getServerFromClientRuntimeId();
+    if (server!=null && server.getServerType() != null)
+    {
+      clientIds_.setServerId(server.getServerType().getId());
+      clientIds_.setServerInstanceId(server.getId());
+      return Status.OK_STATUS;
+    }
+    
+    IServerType serverType = getServerTypeFromClientRuntimeId();
+    if (serverType != null)
+    {
+      clientIds_.setServerId(serverType.getId());
+      return Status.OK_STATUS;
+    }    
+    
+    // No suitable server was found. Popup an error if the default Web service
+    // runtime requires a server.
+    RuntimeDescriptor runtimeDescriptor = WebServiceRuntimeExtensionUtils2.getRuntimeById(clientIds_.getRuntimeId());
+    if (runtimeDescriptor.getServerRequired())
+    {
+      String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(clientIds_.getRuntimeId());
+      IStatus status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_ERROR_NO_SERVER_RUNTIME, new String[] {
+          runtimeLabel}));
+      return status;
+    }
+    
+    return Status.OK_STATUS;
+  }
+  
+  private IServer getServerFromClientRuntimeId()
+  {
+    IServer[] servers = ServerCore.getServers();
+    if (servers != null && servers.length > 0) {
+    	
+        PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+        String preferredServerFactoryId = context.getServerFactoryId();
+        
+        //If a server of the preferred server type is present, check that one first
+        for (int j = 0; j < servers.length; j++)
+        {
+          if (servers[j] != null && servers[j].getServerType() != null)
+          {
+	          String serverFactoryId = servers[j].getServerType().getId();
+	          if (serverFactoryId == preferredServerFactoryId)
+	          {
+	            if (WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportServer(clientRuntimeId_, serverFactoryId))
+	            {
+	              return servers[j];
+	            }
+	          }
+          }
+        }
+        
+        //A server of the preferred server type could not be found or did not match. Check all the existing servers.    
+    	
+      for (int i = 0; i < servers.length; i++)
+      {
+    	if (servers[i] != null && servers[i].getServerType() != null)
+    	{
+	        String serverFactoryId = servers[i].getServerType().getId();
+	        if (WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportServer(clientRuntimeId_, serverFactoryId))
+	        {
+	          return servers[i];
+	        }
+	      }
+      }
+    }
+    return null;    
+  }
+  
+  private IServerType getServerTypeFromClientRuntimeId()
+  {
+    String[] serverTypes = WebServiceRuntimeExtensionUtils2.getServerFactoryIdsByClientRuntime(clientRuntimeId_);
+    if (serverTypes!=null && serverTypes.length>0)
+    {
+      //Return the preferred one if it is in the list
+      PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+      String preferredServerFactoryId = context.getServerFactoryId();
+      for (int i=0; i<serverTypes.length; i++)
+      {
+        if (serverTypes[i].equals(preferredServerFactoryId))
+        {
+          return ServerCore.findServerType(serverTypes[i]);
+        }
+      }
+      
+      return ServerCore.findServerType(serverTypes[0]);
+    }    
+    
+    return null;
+  }
+  
+  protected IServer getServerFromProject(String projectName, FacetMatcher facetMatcher)
+  {
+    IServer server = null;
+    
+    IProject project = ProjectUtilities.getProject(projectName);
+    IServer[] servers = ServerCore.getServers();
+    
+    if (servers.length > 0)
+    {
+      PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+      String preferredServerFactoryId = context.getServerFactoryId();
+        
+      // Get the runtime.
+      org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = null;
+      IFacetedProject fProject = null;
+
+      if (project != null && project.exists())
+      {
+        try
+        {
+          fProject = ProjectFacetsManager.create(project);
+          if (fProject != null)
+          {
+            fRuntime = fProject.getRuntime();
+          }
+        } catch (CoreException ce)
+        {
+
+        }
+      }
+
+      if (fRuntime != null)
+      {
+        // Get an existing server that has the same runtime.
+        IServer firstMatchingServer = null;    	  
+        IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+        for (int i = 0; i < servers.length; i++)
+        {
+          IServer thisServer = servers[i];
+          IRuntime thisServerRuntime = thisServer.getRuntime();
+          if ( thisServerRuntime != null && sRuntime != null && thisServerRuntime.getId().equals(sRuntime.getId()))
+          {
+            if (firstMatchingServer==null)
+            {
+              firstMatchingServer = thisServer;
+            }
+              
+            if (thisServer != null && thisServer.getServerType() != null && thisServer.getServerType().getId().equals(preferredServerFactoryId))
+            {
+        	  
+              server = thisServer;
+              break;
+            }
+          }
+        }
+                
+        //If a server of the preferred server type was not found but
+        //there was a server that matched, return that one.
+        if (server == null && firstMatchingServer != null)
+        {
+          server = firstMatchingServer;
+        }        
+      }
+
+      // If an existing server could not be chosen on the basis of the project's
+      // runtime,
+      // try to find an existing server using the project's facets and the
+      // facetsToAdd.
+      if (server == null)
+      {
+        if (project!=null && project.exists())
+        {
+          Set facets = FacetUtils.getFacetsForProject(project.getName());
+          if (facets != null)
+          {
+            Set facetsClone = new HashSet();
+            facetsClone.addAll(facets);            
+            if (facetMatcher.getFacetsToAdd() != null)
+            {
+              Iterator itr = facetMatcher.getFacetsToAdd().iterator();
+              while (itr.hasNext())
+              {
+                facetsClone.add(itr.next());  
+              }            
+            }
+            server = getServerFromFacets(facetsClone);            
+          }
+        }
+      }
+    }
+    return server;
+  }
+  
+  protected IServer getServerFromFacets(Set facets)
+  {
+	    IServer server = null;
+	    Set runtimes = FacetUtils.getRuntimes(new Set[]{facets});
+	    Iterator itr = runtimes.iterator();
+	    IServer[] servers = ServerCore.getServers();
+	    PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+	    String preferredServerFactoryId = context.getServerFactoryId();
+	    
+	    //If one of the servers is of the preferred type, and its runtime
+	    //is in the set of matching runtimes, return that server.
+	    for (int j=0; j<servers.length; j++)      
+	    {
+	      IServer thisServer = servers[j];
+	      if (thisServer != null && thisServer.getServerType() != null && thisServer.getRuntime() != null && thisServer.getServerType().getId().equals(preferredServerFactoryId))
+	      {
+	    	IRuntime thisServerRuntime = thisServer.getRuntime();
+	        //Check to see if it matches any of the runtimes.
+	        Iterator runtimesItr = runtimes.iterator();
+	        while(runtimesItr.hasNext())
+	        {
+	          org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)runtimesItr.next();
+	          IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+	          if (sRuntime != null && thisServerRuntime.getId().equals(sRuntime.getId()))
+	          {
+	            server = thisServer;
+	          }          
+	        }
+	      }            
+	    }
+	    
+	    if (server == null)
+	    {
+	      outer: while (itr.hasNext())
+	      {
+	        org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime) itr
+	            .next();
+	        IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+	        for (int i = 0; i < servers.length; i++)
+	        {
+	          IServer thisServer = servers[i];
+	          IRuntime thisServerRuntime = thisServer.getRuntime();
+	          if (thisServerRuntime != null && sRuntime != null && thisServerRuntime.getId().equals(sRuntime.getId()))
+	          {
+	            server = thisServer;
+	            break outer;
+	          }
+	        }
+	      }
+	    }
+
+	    return server;
+
+  }
+  
+  protected IServerType getServerTypeFromProject(String projectName, FacetMatcher facetMatcher)
+  {
+	    IServerType serverType = null;
+	    PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+	    String preferredServerFactoryId = context.getServerFactoryId();
+	    
+	    IProject project = ProjectUtilities.getProject(projectName);
+	    IServerType[] serverTypes = ServerCore.getServerTypes();
+	    
+	    //Get the runtime.
+	    org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = null;
+	    IFacetedProject fProject = null;
+	    
+	    if (project != null && project.exists())
+	    {
+	      try
+	      {
+	        fProject = ProjectFacetsManager.create(project);
+	        if (fProject != null)
+	        {
+	          fRuntime = fProject.getRuntime();
+	        }
+	      } catch (CoreException ce)
+	      {
+	        
+	      }
+	    }
+	    
+	    if (fRuntime != null)
+	    {
+	      //Get a server type that has the same runtime type.
+	      IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); 
+	      if (sRuntime != null)
+	      {
+		      IRuntimeType sRuntimeType = sRuntime.getRuntimeType();
+		      IServerType firstMatchingServerType = null;
+		      for (int i=0; i<serverTypes.length; i++)
+		      {
+		        IServerType thisServerType = serverTypes[i];
+		        IRuntimeType thisServerRuntimeType = thisServerType.getRuntimeType();
+		        if (sRuntimeType != null && thisServerRuntimeType != null && thisServerRuntimeType.getId().equals(sRuntimeType.getId()))
+		        {
+		          if (firstMatchingServerType == null)
+		          {
+		            firstMatchingServerType = thisServerType;
+		          }
+		          if (thisServerType.getId().equals(preferredServerFactoryId))
+		          {
+		            serverType = thisServerType;
+		            break;
+		          }
+		        }     
+		      }
+		      
+		      //If the preferred server type was not found but
+		      //there was a server type that matched, return that one.        
+		      if (serverType == null && firstMatchingServerType != null)
+		      {        
+		        serverType = firstMatchingServerType;
+		      }
+	      }
+	    }
+
+	    //If a server type could not be chosen on the basis of the project's runtime,
+	    //try to find a server type using the project's facets and the facetsToAdd.
+	    if (serverType == null)
+	    {
+	      if (project != null && project.exists())
+	      {
+	        Set facets = FacetUtils.getFacetsForProject(project.getName());
+	        if (facets != null)
+	        {
+	          Set facetsClone = new HashSet();
+	          facetsClone.addAll(facets);          
+	          if (facetMatcher != null && facetMatcher.getFacetsToAdd() != null)
+	          {
+	            Iterator itr = facetMatcher.getFacetsToAdd().iterator();
+	            while (itr.hasNext())
+	            {
+	              facetsClone.add(itr.next());  
+	            }            
+	          }
+	          serverType = getServerTypeFromFacets(facetsClone);          
+	        }
+	      }
+	    }
+	    
+	    return serverType;
+
+  }
+  
+  protected IServerType getServerTypeFromFacets(Set facets)
+  {
+	    IServerType serverType = null;
+	    Set runtimes = FacetUtils.getRuntimes(new Set[]{facets});
+	    Iterator itr = runtimes.iterator();
+	    IServerType[] serverTypes = ServerCore.getServerTypes();
+	    PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+	    String preferredServerFactoryId = context.getServerFactoryId();    
+
+	    //If one of the server types is of the preferred type, and its runtime
+	    //is in the set of matching runtimes, return that server type.
+	    for (int j=0; j<serverTypes.length; j++)      
+	    {
+	      IServerType thisServerType = serverTypes[j];
+	      IRuntimeType thisServerTypeRuntimeType = thisServerType.getRuntimeType();
+	      if (thisServerTypeRuntimeType != null && thisServerType.getId().equals(preferredServerFactoryId))
+	      {
+	        //Check to see if it matches any of the runtimes.
+	        Iterator runtimesItr = runtimes.iterator();
+	        while(runtimesItr.hasNext())
+	        {
+	          org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)runtimesItr.next();
+	          IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+	          if (sRuntime != null)
+	          {
+	        	  IRuntimeType sRuntimeType = sRuntime.getRuntimeType();
+		          if (sRuntimeType != null && thisServerTypeRuntimeType.getId().equals(sRuntimeType.getId()))
+		          {
+		            serverType = thisServerType;
+		          }          
+	          }
+	        }
+	      }            
+	    }
+	    
+	    
+	    if (serverType == null)
+	    {
+	      outer: while (itr.hasNext())
+	      {
+	        org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime) itr
+	            .next();
+	        IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+	        if (sRuntime != null)
+	        {
+		        IRuntimeType sRuntimeType = sRuntime.getRuntimeType();
+		        for (int i = 0; i < serverTypes.length; i++)
+		        {
+		          IServerType thisServerType = serverTypes[i];
+		          if (thisServerType != null)
+		          {
+			          IRuntimeType thisServerTypeRuntimeType = thisServerType.getRuntimeType();
+			          if (sRuntimeType != null && thisServerTypeRuntimeType != null && thisServerTypeRuntimeType.getId().equals(sRuntimeType.getId()))
+			          {
+			            serverType = thisServerType;
+			            break outer;
+			          }
+		          }
+		        }
+	        }
+	      }
+	    }
+
+	    return serverType;
+
+  }  
+  
+  protected IServer getServerFromProjectType(String templateId, FacetMatcher facetMatcher)
+  {
+    IServer server = null;
+    Set facets = FacetUtils.getInitialFacetVersionsFromTemplate(templateId);
+    if (facetMatcher.getFacetsToAdd() != null)
+    {
+      Iterator itr = facetMatcher.getFacetsToAdd().iterator();
+      while (itr.hasNext())
+      {
+        facets.add(itr.next());  
+      }            
+    }
+    server = getServerFromFacets(facets);
+    return server;
+  }
+  
+  protected IServerType getServerTypeFromProjectType(String templateId, FacetMatcher facetMatcher)
+  {
+    IServerType serverType = null;
+    Set facets = FacetUtils.getInitialFacetVersionsFromTemplate(templateId);
+    if (facetMatcher.getFacetsToAdd() != null)
+    {
+      Iterator itr = facetMatcher.getFacetsToAdd().iterator();
+      while (itr.hasNext())
+      {
+        facets.add(itr.next());  
+      }            
+    }
+    //TODO Instead of passing in a single set of facets, pass in multiple sets, if the
+    //jst.java facet is one of them and the clientRuntimeId allows newer.
+    serverType = getServerTypeFromFacets(facets);
+    return serverType;    
+  }
+  
+  private String getDefaultClientProjectTemplate()
+  {
+    String[] templates = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(clientIds_.getTypeId(), clientIds_.getRuntimeId());
+    
+    //Walk the list of client project types in the project topology preference
+    ProjectTopologyContext ptc= WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
+    String[] preferredTemplateIds = ptc.getClientTypes();
+    for (int j=0; j<preferredTemplateIds.length; j++)
+    {
+      for (int i=0; i<templates.length; i++)
+      {
+        String templateId = templates[i];
+        if (templateId.equals(preferredTemplateIds[j]))
+        {
+          
+          boolean matches = WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportTemplate(clientRuntimeId_, templateId);
+          if (matches)
+          {
+            return templates[i];            
+          }
+        }                                    
+      }      
+    }
+
+    //Since the preferredTemplateIds contains the union of all project types for all client runtimes, we are
+    //guaranteed to have returned by now, so the code below will never be executed under normal
+    //circumstances. Just return something to satisfy the compiler.    
+    if (templates.length > 0)
+      return templates[0];
+    
+    return "";
+  }
+  
+  private String getDefaultClientProjectName()
+  {
+    ValidationUtils vu = new ValidationUtils();
+    IProject[] projects = FacetUtils.getAllProjects();
+    ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_);
+    RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions();
+    
+    //Check each project and its facetRuntime for compatibility with the clientRuntime
+    for (int i=0; i<projects.length; i++)
+    {
+      if (!vu.isProjectServiceProject(projects[i], wsdlURI_, parser_))
+      {
+        Set facetVersions = FacetUtils.getFacetsForProject(projects[i].getName());
+        org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = null;
+        String fRuntimeName = null;
+        fRuntime = FacetUtils.getFacetRuntimeForProject(projects[i].getName());
+        if (fRuntime != null)
+        {
+          fRuntimeName = fRuntime.getName();
+        }
+
+        if (facetVersions != null)
+        {
+
+          // FacetMatcher fm = FacetUtils.match(rfvs, facetVersions);
+          FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(true, clientRuntimeId_, projects[i].getName());
+          boolean facetRuntimeMatches = true;
+          if (fRuntimeName != null)
+          {
+            facetRuntimeMatches = FacetUtils.isFacetRuntimeSupported(rfvs, fRuntimeName);
+          }
+
+          if (fm.isMatch() && facetRuntimeMatches)
+          {
+            clientFacetMatcher_ = fm;
+            return projects[i].getName();
+          }
+        }
+      }
+    }
+    
+    //No project was suitable, return a new project name
+    return ResourceUtils.getDefaultWebProjectName();
+    
+  }
+  
+  private DefaultRuntimeTriplet getDefaultClientRuntimeForFixedRuntimeAndServer(IProject project)
+  {
+    String[] clientRuntimes = WebServiceRuntimeExtensionUtils2.getClientRuntimesByType(clientIds_.getTypeId());
+    ArrayList validClientRuntimes = new ArrayList();
+    for (int i=0; i<clientRuntimes.length; i++ )
+    {
+      ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimes[i]);
+      if (desc.getRuntime().getId().equals(clientIds_.getRuntimeId()))
+      {
+        //Check if this client runtime supports the server
+        if (WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportServer(desc.getId(), clientIds_.getServerId()))
+        {
+          validClientRuntimes.add(desc.getId());
+          if (project != null && project.exists())
+          {
+            //RequiredFacetVersion[] rfv = desc.getRequiredFacetVersions();
+            Set facetVersions = FacetUtils.getFacetsForProject(project.getName());
+            if (facetVersions != null)
+            {
+              //FacetMatcher fm = FacetUtils.match(rfv, facetVersions);
+              FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(true, clientRuntimes[i], project.getName());
+              if (fm.isMatch())
+              {
+                DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+                drt.setFacetMatcher(fm);
+                drt.setProjectName(project.getName());
+                drt.setRuntimeId(desc.getId());
+                return drt;                
+              }                      
+            }
+          }
+          
+        }
+      }
+      
+    }
+    
+    if (validClientRuntimes.size() > 0)
+    {
+      //We couldn't match to the initially selected project so return the first valid runtime.
+      DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+      drt.setFacetMatcher(null);
+      drt.setProjectName(null);
+      drt.setRuntimeId(((String[])validClientRuntimes.toArray(new String[0]))[0]);
+      return drt;            
+    }
+    else
+    {
+      //There are no client runtimes that match the fixed runtime and server. Fall back to original algorithm
+      clientIdsFixed_ = false;
+      return getDefaultRuntime(project, clientIds_.getTypeId(), true);
+    }
+  }  
+    
+  protected DefaultRuntimeTriplet getDefaultRuntime(IProject project, String typeId, boolean isClient)
+  {
+    String[] runtimes = null;
+    if (isClient)
+    {
+      runtimes = WebServiceRuntimeExtensionUtils2.getClientRuntimesByType(typeId);
+    }
+    else
+    {
+      runtimes = WebServiceRuntimeExtensionUtils2.getServiceRuntimesByServiceType(typeId);
+    }
+        
+    //Split the array of service/client runtimes into one containing the preferred set and one containing the rest.
+    PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+    String preferredRuntimeId = context.getRuntimeId();
+    ArrayList preferredRuntimeIdsList = new ArrayList();
+    ArrayList otherRuntimeIdsList = new ArrayList();
+    for (int k=0; k<runtimes.length; k++ )
+    {
+      String descRuntimeId = null;
+      if (isClient)
+      {
+        ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(runtimes[k]);
+        descRuntimeId = desc.getRuntime().getId();
+      }
+      else
+      {
+        ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(runtimes[k]);
+        descRuntimeId = desc.getRuntime().getId();
+      }
+      
+      if (descRuntimeId.equals(preferredRuntimeId))
+      {
+        preferredRuntimeIdsList.add(runtimes[k]);
+      }
+      else
+      {
+        otherRuntimeIdsList.add(runtimes[k]);
+      }
+    }
+    String[] preferredRuntimeIds = (String[])preferredRuntimeIdsList.toArray(new String[0]);
+    String[] otherRuntimeIds = (String[])otherRuntimeIdsList.toArray(new String[0]);
+    
+    Set facetVersions = null;
+    org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = null;
+    String fRuntimeName = null;
+    
+    //If the initially selected project exists and facets can be inferred from it, look for
+    //a service/client runtime that matches the project's facets and also, if possible, its facet runtime.
+    //Preference should be given to the preferred service/client runtimes. 
+    if (project != null && project.exists())
+    {
+      facetVersions = FacetUtils.getFacetsForProject(project.getName());
+      fRuntime = FacetUtils.getFacetRuntimeForProject(project.getName());
+      fRuntimeName = null;
+      if (fRuntime != null)
+      {
+        fRuntimeName = fRuntime.getName();        
+      }
+      
+      if (facetVersions != null)
+      {
+        //1. First check to see if one of the preferred service/client runtimes matches the existing
+        //project's facets and runtime.
+        for (int p = 0; p < preferredRuntimeIds.length; p++)
+        {
+          RequiredFacetVersion[] prfv = null;
+          if (isClient)
+          {
+            prfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(preferredRuntimeIds[p]).getRequiredFacetVersions();
+          }
+          else
+          {
+            prfv = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(preferredRuntimeIds[p]).getRequiredFacetVersions();
+          }
+          
+          //FacetMatcher fm = FacetUtils.match(prfv, facetVersions);
+          FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(isClient, preferredRuntimeIds[p], project.getName());
+          boolean facetRuntimeMatches = true;
+          if (fRuntimeName != null)
+          {
+            facetRuntimeMatches = FacetUtils.isFacetRuntimeSupported(prfv, fRuntimeName);  
+          }          
+          
+          if (fm.isMatch() && facetRuntimeMatches)
+          {
+            DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+            drt.setFacetMatcher(fm);
+            drt.setProjectName(project.getName());
+            drt.setRuntimeId(preferredRuntimeIds[p]);
+            return drt;
+          }
+        }
+        
+        //2. Second, check to see if one of the other clientRuntimes matches the existing
+        //project's facets and runtime.        
+        for (int i=0; i<otherRuntimeIds.length; i++)
+        {        
+          RequiredFacetVersion[] rfv = null;
+          if (isClient)
+          {
+            rfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(otherRuntimeIds[i]).getRequiredFacetVersions();  
+          }
+          else
+          {
+            rfv = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(otherRuntimeIds[i]).getRequiredFacetVersions();
+          }
+          
+          FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(isClient, otherRuntimeIds[i], project.getName());
+          boolean facetRuntimeMatches = true;
+          if (fRuntimeName != null)
+          {
+            facetRuntimeMatches = FacetUtils.isFacetRuntimeSupported(rfv, fRuntimeName);  
+          }                      
+          if (fm.isMatch() && facetRuntimeMatches)
+          {
+            DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+            drt.setFacetMatcher(fm);
+            drt.setProjectName(project.getName());
+            drt.setRuntimeId(otherRuntimeIds[i]);
+            return drt;
+          }                              
+        }
+        
+        //3. Third, check to see if one of the preferred clientRuntimes matches the existing
+        //project's facets.
+        for (int p = 0; p < preferredRuntimeIds.length; p++)
+        {
+            FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(isClient, preferredRuntimeIds[p], project.getName()); 
+            if (fm.isMatch())
+            {
+              DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+              drt.setFacetMatcher(fm);
+              drt.setProjectName(project.getName());
+              drt.setRuntimeId(preferredRuntimeIds[p]);
+              return drt;
+            }         
+        }
+        
+        //4. Fourth, check to see if the one the other clientRuntimes matches the existing
+        //project's facets.        
+        for (int i=0; i<otherRuntimeIds.length; i++)
+        {
+            FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(isClient, otherRuntimeIds[i], project.getName()); 
+            if (fm.isMatch())
+            {
+              DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+              drt.setFacetMatcher(fm);
+              drt.setProjectName(project.getName());
+              drt.setRuntimeId(otherRuntimeIds[i]);
+              return drt;
+            }        
+        }        
+      }            
+    }
+    
+    //Haven't returned yet so this means that the intitially selected project cannot be used
+    //to influence the selection of the service/client runtime. 
+    
+      //Use the preferred project types to influence the selection of a runtime.
+      ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
+      String[] preferredTemplateIds = null;
+      if (isClient)
+      {
+        preferredTemplateIds = ptc.getClientTypes();  
+      }
+      else
+      {
+        preferredTemplateIds = ptc.getServiceTypes();
+      }
+      
+    
+      for (int n=0; n<preferredTemplateIds.length; n++)
+      {
+        String preferredTemplateId = preferredTemplateIds[n];
+
+        for (int m=0; m<preferredRuntimeIds.length; m++)
+        {
+          //If this client or service runtime supports this template, choose it and exit.        
+          boolean matches = false;
+          if (isClient)
+          {
+            matches = WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportTemplate(preferredRuntimeIds[m], preferredTemplateId);            
+          }
+          else
+          {
+            matches = WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportTemplate(preferredRuntimeIds[m], preferredTemplateId);
+          }
+          
+          if (matches)
+          {
+            DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+            drt.setFacetMatcher(null);
+            //If the project doesn't exist, use the name of the project that was passed in.
+            //If the project exists, it means that previous code in this method
+            //determined it to not be a suitable project. Clear the project name.
+            if (project==null || project.exists())
+            {
+              drt.setProjectName(null);
+            }
+            else
+            {
+              drt.setProjectName(project.getName());
+            }
+            drt.setRuntimeId(preferredRuntimeIds[m]);
+            return drt;            
+          }        
+        }
+      }
+    
+    
+    //Still haven't returned. Return the first preferred service/client runtime id.
+    if (preferredRuntimeIds.length > 0)
+    {
+      DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+      drt.setFacetMatcher(null);
+      //If the project doesn't exist, use the name of the project that was passed in.
+      //If the project exists, it means that previous code in this method
+      //determined it to not be a suitable project. Clear the project name.      
+      if (project==null || project.exists())
+      {
+        drt.setProjectName(null);
+      }
+      else
+      {
+        drt.setProjectName(project.getName());
+      }
+      drt.setRuntimeId(preferredRuntimeIds[0]);
+      return drt;      
+    }
+      
+    if (runtimes.length > 0)
+    {
+      DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+      drt.setFacetMatcher(null);
+      //If the project doesn't exist, use the name of the project that was passed in.
+      //If the project exists, it means that previous code in this method
+      //determined it to not be a suitable project. Clear the project name.
+      if (project==null || project.exists())
+      {
+        drt.setProjectName(null);
+      }
+      else
+      {
+        drt.setProjectName(project.getName());
+      }
+      drt.setRuntimeId(runtimes[0]);
+      return drt;
+    }
+    else
+    {
+      DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+      drt.setFacetMatcher(null);
+      //If the project doesn't exist, use the name of the project that was passed in.
+      //If the project exists, it means that previous code in this method
+      //determined it to not be a suitable project. Clear the project name.
+      if (project==null || project.exists())
+      {
+        drt.setProjectName(null);
+      }
+      else
+      {
+        drt.setProjectName(project.getName());
+      }
+      drt.setRuntimeId(null);
+      return drt;
+    }    
+  }
+  /**
+ * 
+ * @param project
+ * @return
+ */
+  protected SelectionListChoices getProjectEARChoice(IProject project)
+  {
+    String[] flexProjects = getAllFlexibleProjects();
+    SelectionList list = new SelectionList(flexProjects, 0);
+    return new SelectionListChoices(list, null);
+  }
+  
+  protected SelectionList getEARProjects()
+  {
+    String[] flexProjects = getAllFlexibleProjects();
+    return new SelectionList(flexProjects, 0);
+  }
+  
+  protected IResource getResourceFromInitialSelection(IStructuredSelection selection)
+  {
+    if (selection != null && selection.size() == 1)
+    {
+      Object obj = selection.getFirstElement();
+      if (obj != null) 
+      {
+        try
+        { 
+          IResource resource = ResourceUtils.getResourceFromSelection(obj);
+          return resource;
+        } catch(CoreException e)
+        {
+          return null;
+        }        
+      }
+    }
+    return null;
+  }
+  
+  
+      
+  /*
+   * Set defaults for the client-side from the service-side if possible.
+   * Sets clientProjectName_ to a value based on the service project name.
+   * 
+   * Returns an IStatus.OK if the service side values for server and Web 
+   * service runtime can be used to set the values for clientRuntimeId_,
+   * clientComponentType_, all the values in clientIds_, and clientEarProjectName_.
+   * 
+   * Returns an IStatus.ERROR otherwise, leaving only the clientProjectName_ set. 
+   */
+  protected IStatus defaultClientSideFromServiceSide(String serviceProjectName, TypeRuntimeServer serviceIds, boolean serviceNeedEAR, String serviceEarProjectName)
+  {
+    //1. Start with setting the default client project name based on the service project name.
+    boolean isEJB = false;
+    String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(serviceIds.getTypeId());
+    isEJB = (implId.equals("org.eclipse.jst.ws.wsImpl.ejb"));
+    String[] updatedNames = ResourceUtils.getClientProjectComponentName(serviceProjectName, serviceProjectName, isEJB);
+    clientProjectName_ = updatedNames[0];
+    
+    //2. Ideally, the server and runtime on the client-side will be defaulted
+    //   to the same values as the service side. If a client runtime id that 
+    //   supports clientProjectName_ and the service-side server and runtime defaults
+    //   can be found, choose it.
+    IProject clientProject = ProjectUtilities.getProject(clientProjectName_);
+    TypeRuntimeServer testIds = new TypeRuntimeServer();
+    testIds.setTypeId(clientIds_.getTypeId());
+    testIds.setRuntimeId(serviceIds.getRuntimeId());
+    testIds.setServerId(serviceIds.getServerId());
+    testIds.setServerInstanceId(serviceIds.getServerInstanceId());
+    
+    if (clientProject.exists())
+    {
+      clientComponentType_ = "";
+      clientRuntimeId_ = WebServiceRuntimeExtensionUtils2.getClientRuntimeId(testIds, serviceProjectName, clientComponentType_);
+      if (clientRuntimeId_ != null && clientRuntimeId_.length()>0)
+      {
+        clientIds_.setRuntimeId(serviceIds.getRuntimeId());
+        clientIds_.setServerId(serviceIds.getServerId());
+        clientIds_.setServerInstanceId(serviceIds.getServerInstanceId());
+      }      
+    }
+    else
+    {
+      //See if there is a client project type that supports the service-side
+      //server and runtime defaults. Pick a client project type based on project topology preferences.
+      //Choose the clientRuntimeId_ accordingly.
+      String[] templateIds = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(clientIds_.getTypeId(), testIds.getRuntimeId());
+      if (templateIds != null && templateIds.length > 0)
+      {
+        ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
+        String[] preferredTemplateIds = ptc.getClientTypes();
+        outer: for (int j = 0; j < preferredTemplateIds.length; j++)
+        {
+          for (int i = 0; i < templateIds.length; i++)
+          {
+            String templateId = templateIds[i];
+            if (templateId.equals(preferredTemplateIds[j]))
+            {
+              // Get a clientRuntimeId for this template
+              String newClientRuntimeId = WebServiceRuntimeExtensionUtils2.getClientRuntimeId(testIds, clientProjectName_,
+                  templateId);
+              if (newClientRuntimeId.length() > 0)
+              {
+                clientRuntimeId_ = newClientRuntimeId;
+                clientComponentType_ = templateId;
+                clientIds_.setRuntimeId(serviceIds.getRuntimeId());
+                clientIds_.setServerId(serviceIds.getServerId());
+                clientIds_.setServerInstanceId(serviceIds.getServerInstanceId());                
+                break outer;
+              }
+            }
+          }
+        }
+      }
+    } 
+    
+    //3. If step 2 was successful, clientRuntimeId_ should now be set, along with clientProjectName_,
+    //   clientComponentType_, and all the values in clientIds_. All that remains is setting the EAR.
+    if (clientRuntimeId_ != null && clientRuntimeId_.length()>0)
+    {
+      setDefaultClientEarProject();
+      //Update the client side EAR from the service side EAR if necessary.
+      if (serviceNeedEAR)
+      {
+        defaultClientEarFromServiceEar(serviceProjectName, serviceEarProjectName); 
+      }
+      return Status.OK_STATUS;
+    }
+    else
+    {
+      //Step 2 was not successful. Client side defaulting cannot be done using the service side server
+      //and web service runtime defaults. Return an error status.
+      return StatusUtils.errorStatus("");
+    }
+  }
+  
+  protected void defaultClientEarFromServiceEar(String serviceProjectName, String serviceEarProjectName)
+  {
+    //Client side
+    if (clientNeedEAR_)
+    {
+      IProject clientProject = ProjectUtilities.getProject(clientProjectName_);
+      if(clientProject==null || !clientProject.exists() 
+        || !(clientEarProjectName_.equalsIgnoreCase(serviceEarProjectName)))
+      {
+        ProjectTopologyContext ptc= WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();         
+        if (!ptc.isUseTwoEARs()) 
+        {
+          clientEarProjectName_ = serviceEarProjectName;
+        }
+        else 
+        {
+          IProject proxyEARProject = getUniqueClientEAR(clientEarProjectName_, serviceEarProjectName, clientProjectName_, serviceProjectName);
+          clientEarProjectName_ = proxyEARProject.getName();
+        }     
+      }
+    }
+    
+  }
+  
+  private IProject getUniqueClientEAR(String earProjectName, String serviceEARProject, String clientProjectName, String serviceProjectName) {
+
+    String projectName = new String();
+    //If the client project doesn't exist and the service project does, ensure the
+    //the client side EAR's J2EE level is such that the service project could be added to it.
+    //This will ensure we don't default the page with a client project EAR at a lower
+    //J2EE level than the service side.
+    boolean goodJ2EELevel = true;
+    if (!earProjectName.equalsIgnoreCase(serviceEARProject))
+    {
+      IProject clientProject = ProjectUtilities.getProject(clientProjectName);
+      IProject serviceProject = ProjectUtilities.getProject(serviceProjectName);
+      IProject earProject = ProjectUtilities.getProject(earProjectName);
+      if (!clientProject.exists() && serviceProject.exists())
+      {
+        IStatus associationStatus = J2EEUtils.canAssociateProjectToEAR(serviceProject, earProject);
+        goodJ2EELevel = (associationStatus.getSeverity() == IStatus.OK);
+      }
+    }
+    
+    if (!earProjectName.equalsIgnoreCase(serviceEARProject) && goodJ2EELevel) {
+      projectName = earProjectName;
+    }    
+    else {
+      projectName = clientProjectName+DEFAULT_CLIENT_EAR_PROJECT_EXT;
+      int i=1;      
+      while (projectName.equalsIgnoreCase(serviceEARProject)) {
+        projectName = projectName+i;
+        i++;
+      }
+    }
+    return projectName.equals("") ? null : ResourceUtils.getWorkspaceRoot().getProject(projectName);
+    
+  }
+  
+  private void setDefaultsForExtension(IEnvironment env)
+  {
+    IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils2.getClientRuntime(clientRuntimeId_);
+    if (wsrt != null)
+    {
+      WebServiceClientInfo wsInfo = new WebServiceClientInfo();      
+      wsInfo.setServerFactoryId(clientIds_.getServerId());
+      wsInfo.setServerInstanceId(clientIds_.getServerInstanceId());
+      wsInfo.setState(WebServiceState.UNKNOWN_LITERAL);
+      wsInfo.setWebServiceRuntimeId(clientIds_.getRuntimeId());
+      wsInfo.setWsdlURL(wsdlURI_);
+
+      webServiceClient_ = wsrt.getWebServiceClient(wsInfo);
+      WebServiceScenario scenario = WebServiceScenario.CLIENT_LITERAL;
+      if (resourceContext_ != null)
+      {
+        context_ = new SimpleContext(true, true, true, true, true, true, test_, false, scenario, resourceContext_.isOverwriteFilesEnabled(), resourceContext_
+            .isCreateFoldersEnabled(), resourceContext_.isCheckoutFilesEnabled());
+      }
+    }
+  
+  }
+  
+  public void setClientInitialSelection(IStructuredSelection selection)
+  {
+    if (clientInitialProject_ == null)
+    {
+      clientInitialProject_ = getProjectFromInitialSelection(selection);
+    }
+  }
+  
+  // This is for the Ant scenario where the client project name can be set in the property file.
+  // If the user has set the ClientProjectName use it for defaulting purposes
+  public void setClientProjectName(String name)
+  {
+	  clientProjectName_ = name;
+  }
+
+  public void setClientInitialProject(IProject clientInitialProject)
+  {
+    clientInitialProject_ = clientInitialProject;
+  }
+  
+  /**
+   * @param initialInitialSelection_ The initialInitialSelection_ to set.
+   */
+  public void setInitialInitialSelection(IStructuredSelection initialInitialSelection)
+  {
+    initialProject_ = getProjectFromInitialSelection(initialInitialSelection);
+  }
+  
+  public boolean getClientNeedEAR()
+  {
+    return clientNeedEAR_;
+  }
+
+  /**
+   * @param parser_ The parser_ to set.
+   */
+  public void setWebServicesParser(WebServicesParser parser) {
+    parser_ = parser;
+  }
+  
+  public void setWsdlURI(String wsdlURI)
+  {
+    wsdlURI_ = wsdlURI;
+  }
+  
+  public void setTestService(boolean testService)
+  {
+    test_ = testService;
+  }   
+  
+  public void setResourceContext( ResourceContext resourceContext )
+  {
+    resourceContext_ = resourceContext;   
+  }  
+  
+  private IProject getProjectFromInitialSelection(IStructuredSelection selection)
+  {
+    if (selection != null && selection.size() == 1)
+    {
+      Object obj = selection.getFirstElement();
+      if (obj != null) 
+      {
+        try
+        { 
+          IResource resource = ResourceUtils.getResourceFromSelection(obj);
+          if (resource==null) 
+            return null;
+          IProject p = ResourceUtils.getProjectOf(resource.getFullPath());
+          return p;
+        } catch(CoreException e)
+        {
+          return null;
+        }        
+      }
+    }
+    return null;
+  }
+  
+  protected String[] getAllFlexibleProjects()
+  {
+    Vector v = new Vector();
+    IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+    for (int i = 0; i < projects.length; i++)
+    {
+      if (!projects[i].getName().equals("Servers") && !projects[i].getName().startsWith("."))
+      {
+        v.add(projects[i].getName());
+      }
+    }    
+    
+    return (String[])v.toArray(new String[0]);
+    
+  }
+  
+  protected class FacetRuntimeMatcher
+  {
+    FacetMatcher facetMatcher;
+    boolean runtimeMatches;
+    
+    public FacetMatcher getFacetMatcher()
+    {
+      return facetMatcher;
+    }
+    public void setFacetMatcher(FacetMatcher facetMatcher)
+    {
+      this.facetMatcher = facetMatcher;
+    }
+    public boolean isRuntimeMatches()
+    {
+      return runtimeMatches;
+    }
+    public void setRuntimeMatches(boolean runtimeMatches)
+    {
+      this.runtimeMatches = runtimeMatches;
+    }   
+  }
+  
+  protected class DefaultRuntimeTriplet
+  {
+    FacetMatcher facetMatcher_;
+    String projectName_;
+    String runtimeId_;
+    
+    
+    public DefaultRuntimeTriplet()
+    {
+    }
+    
+    public FacetMatcher getFacetMatcher()
+    {
+      return facetMatcher_;
+    }
+    public void setFacetMatcher(FacetMatcher facetMatcher_)
+    {
+      this.facetMatcher_ = facetMatcher_;
+    }
+    public String getProjectName()
+    {
+      return projectName_;
+    }
+    public void setProjectName(String projectName_)
+    {
+      this.projectName_ = projectName_;
+    }
+    public String getRuntimeId()
+    {
+      return runtimeId_;
+    }
+    public void setRuntimeId(String runtimeId_)
+    {
+      this.runtimeId_ = runtimeId_;
+    }        
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java
new file mode 100644
index 0000000..cd10cfe
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060606   105045 mahutch@ca.ibm.com - Mark Hutchinson          
+ * 20070328   172339 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+
+package org.eclipse.jst.ws.internal.consumption.ui.wizard;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.webservice.wsdd.BeanLink;
+import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+
+
+public class TypeSelectionFilter2
+{
+  // Copyright
+  public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
+
+  public String[] getWebServiceTypeByInitialSelection(IStructuredSelection initialSelection, ArrayList webServiceTypeList)
+  {
+        
+    ArrayList supportedTypes = new ArrayList();
+    if (initialSelection != null && initialSelection.size() == 1)
+    {
+      
+      // Check for null initial selection
+      Object initialObject = initialSelection.getFirstElement();
+      if (initialObject == null)
+      {
+        return null;
+      }
+      // Match up resource type metadata with initial selection
+      Iterator iter = webServiceTypeList.iterator();
+      while (iter.hasNext())
+      {
+        String wst = (String)iter.next();
+        String scenario = wst.substring(0,wst.indexOf("/"));
+        String implId = wst.substring(wst.indexOf("/")+1);        
+        //IWebServiceType wst = (IWebServiceType)iter.next();
+        //String typeId = (String)wst.getId();
+        if (scenario.equals(String.valueOf(WebServiceScenario.BOTTOMUP)) && !supportedTypes.contains(wst))
+        {
+
+          
+          WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.getWebServiceImplById(implId);
+          String[] resourceTypes = wsimpl.getResourceTypeMetadata();
+          for (int i=0; i<resourceTypes.length; i++)
+          {
+            if (resourceTypes[i]!=null)
+            {              
+              if ((initialObject.getClass().getName()).endsWith(resourceTypes[i]))
+              {
+                String name = null;
+                IResource resource = null;
+
+                try
+                {                  
+                  resource = ResourceUtils.getResourceFromSelection(initialObject);
+                }
+                catch( CoreException exc )
+                {
+                  resource = null;
+                }
+
+                if (resource instanceof IContainer)
+                {
+                  name = initialObject.getClass().getName();
+                }
+                else if( resource != null )
+                {
+                  name = resource.getFullPath().toString();
+                }
+                else
+                {
+                  name = initialObject.getClass().getName();
+                }
+                String[] extensions = wsimpl.getExtensionMetadata();
+                if (acceptsName(name, extensions))
+                {
+                  supportedTypes.add(wst);
+                }
+              }
+              
+            }
+          }
+          
+          //TODO: Bug 179751 - Need to make checking for types recognized as bottom-up to be more extensible         
+          
+          if (supportedTypes.isEmpty()) {
+        	  if (initialObject instanceof BeanLink || initialObject instanceof ServiceImplBean) {
+        		  supportedTypes.add(wst);
+        	  }
+          }
+          // end of TODO for bug 179751
+        }
+      }
+      
+      //If no wsImpls have accepted this selection, check if this is WSDL. If it is,
+      //add the top-down Java service type to the list.
+      if (supportedTypes.isEmpty())
+      {
+        String[] resourceTypes = {"File", "IResource", "String", "ServiceImpl", "ServiceRefImpl", "WSDLResourceImpl"};
+        for (int i=0; i<resourceTypes.length; i++)
+        {
+          if (resourceTypes[i]!=null)
+          {              
+            if ((initialObject.getClass().getName()).endsWith(resourceTypes[i]))
+            {
+              String name = null;
+              IResource resource = null;
+
+              try
+              {                  
+                resource = ResourceUtils.getResourceFromSelection(initialObject);
+              }
+              catch( CoreException exc )
+              {
+                resource = null;
+              }
+
+              if (resource instanceof IContainer)
+              {
+                name = initialObject.getClass().getName();
+              }
+              else if( resource != null )
+              {
+                name = resource.getFullPath().toString();
+              }
+              else if (initialObject instanceof String)
+              { //the initialObject could be a path name that is a string
+                //bug 105045
+            	name = (String)initialObject;
+              }
+              else
+              {
+                name = initialObject.getClass().getName();
+              }    
+              
+              String[] extensions = {".wsdl", ".wsil", ".html", ".ServiceImpl", ".ServiceRefImpl", ".WSDLResourceImpl"};
+              if (acceptsName(name, extensions))
+              {
+                StringBuffer entrybuff = new StringBuffer();
+                entrybuff.append(String.valueOf(WebServiceScenario.TOPDOWN));
+                entrybuff.append("/");
+                entrybuff.append("org.eclipse.jst.ws.wsImpl.java");
+                String entry = entrybuff.toString();                
+                supportedTypes.add(entry);
+              }
+            }
+            
+          }
+        }      
+      }
+      
+    }    
+  
+
+    
+    if (supportedTypes.isEmpty())
+    {
+      //It's not a registered implementation and its not WSDL so return null;
+      return null;
+    }
+    else
+    {
+      return (String[])supportedTypes.toArray(new String[0]);
+    }
+  }
+  //
+  // Checks if the given name is acceptable based upon its extension
+  //
+  private boolean acceptsName ( String name, String[] extensions)
+  {
+    //Return true if "all" extensions are supported.
+
+    if (extensions[0]!=null)
+    {
+      if (extensions[0].equals("all"))
+      {
+        return true;
+      }
+    }
+
+    for (int i=0; i<extensions.length; i++)
+    {
+      if (extensions[i]!=null)
+      {
+        if (name.endsWith(extensions[i]))
+          return true;
+      }
+    }
+    return false;
+  }
+
+
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java
new file mode 100644
index 0000000..c0047b1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java
@@ -0,0 +1,1952 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060131 121071   rsinha@ca.ibm.com - Rupam Kuehner     
+ * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060227   124392 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060324   116750 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060427   126780 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20070119   159458 mahutch@ca.ibm.com - Mark Hutchinson
+ *******************************************************************************/
+
+package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.server.core.FacetUtil;
+import org.eclipse.jst.ws.internal.consumption.common.FacetMatcher;
+import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
+import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
+import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.wizard.TypeSelectionFilter2;
+import org.eclipse.jst.ws.internal.data.LabelsAndIds;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.command.internal.env.core.selection.SelectionList;
+import org.eclipse.wst.command.internal.env.core.selection.SelectionListChoices;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+
+/**
+ * This class contains numerous utility methods that
+ * process the information provided through extension points
+ * which are read in WebServiceRuntimeExtensionRegistry2:
+ * <ul>
+ * <li> org.eclipse.jst.ws.consumption.ui.wsImpl </li>
+ * <li> org.eclipse.jst.ws.consumption.ui.wsClientImpl </li>
+ * <li> org.eclipse.jst.ws.consumption.ui.runtimes </li>
+ * <li> org.eclipse.jst.ws.consumption.ui.serviceRuntimes </li>
+ * <li> org.eclipse.jst.ws.consumption.ui.clientRuntimes </li>
+ * </ul>
+ * 
+ * to provide answers to common questions regarding which servers,
+ * projects, and project types a particular Web service runtime
+ * supports.
+ * <br/><br/>
+ * Teminology used in the javadoc in this class:
+ * <ul>
+ * <li><b>Web service scenario</b>: One of WebServiceScenario.BOTTOM_UP or WebServiceScenario.TOP_DOWN.</li> 
+ * <li><b>Web service implementation type</b>: extension to org.eclipse.jst.ws.consumption.ui.wsImpl.
+ * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl.</li>
+ * <li><b>Web service type</b>: Forward slash separated concatenation of the String representation
+ * of a Web service scenario and a Web service implementation type id.
+ * For example, "0/org.eclipse.jst.ws.wsImpl.java", represents the bottom up Java bean Web service type.</li>
+ * <li><b>Web service client implementation type</b>: extension to org.eclipse.jst.ws.consumption.ui.wsClientImpl.
+ * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceClientImpl.</li>
+ * <li><b>Web service runtime</b>: extension to org.eclipse.jst.ws.consumption.ui.runtimes. 
+ * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor</li> 
+ * <li><b>serviceRuntime</b>: extension to org.eclipse.jst.ws.consumption.ui.serviceRuntimes.
+ * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor</li>
+ * <li><b>clientRuntime</b>: extension to org.eclipse.jst.ws.consumption.ui.clientRuntimes.
+ * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor</li>
+ * <li><b>server type</b>: This is a server tools artifact. You see a list of these when creating a new server
+ * in the tool.</li>
+ * <li><b>server runtime</b>: This is a server tools artifact. You see a list of these if you go to Preferences, 
+ * Server > Installed Runtimes in the tool. The Java representation of this is org.eclipse.wst.server.core.IRuntime</li>
+ * <li><b>facet runtime</b>: The facet equivalent of a server runtime. The Java representation of this is 
+ * org.eclipse.wst.common.project.facet.core.runtime.IRuntime. org.eclipse.jst.server.core.FacetUtil
+ * provides methods to translate from a server runtime to a facet runtime and vice-versa.</li>
+ * </ul>
+ */
+public class WebServiceRuntimeExtensionUtils2
+{
+  private static WebServiceRuntimeExtensionRegistry2 registry = WebServiceRuntimeExtensionRegistry2.getInstance();
+  
+  /**
+   * Returns the RuntimeDescriptor representing the Web service runtime
+   * with an id attribute equal to the provided id
+   * @param id
+   * @return RuntimeDescriptor representing the Web service runtime
+   * with an id attribute equal to the provided id. Returns null
+   * if such a RuntimeDescriptor cannot be found.
+   */  
+  public static RuntimeDescriptor getRuntimeById(String id)
+  {
+    Object result = registry.runtimes_.get(id);
+    if (result!=null)
+    {
+      return (RuntimeDescriptor)result;
+    }
+    return null;        
+  }
+  
+  /**
+   * Returns the union of all project types supported by all serviceRuntimes. Used by the
+   * ProjectTopology preference page. 
+   * @return String[] array of template ids. The array may have 0 elements.
+   */
+  public static String[] getAllServiceProjectTypes()
+  {
+    ArrayList finalTemplateIdList = new ArrayList();
+    Iterator iter = registry.serviceRuntimes_.values().iterator();
+
+    //Loop through all the serviceRuntimes
+    while (iter.hasNext())   
+    {
+      ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
+      
+      //Get the templates for this serviceRuntime
+      Set templates = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(desc.getId());
+      
+      //Add the template ids to the list if they have not already been added
+      Iterator itr = templates.iterator();
+      while (itr.hasNext())
+      {
+        IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next();
+        if (!finalTemplateIdList.contains(template.getId()))
+        {
+          finalTemplateIdList.add(template.getId());
+        }
+      }            
+    }
+    
+    return (String[])finalTemplateIdList.toArray(new String[]{});
+  }
+  
+  /**
+   * Returns the union of all project types supported by all clientRuntimes. Used by the
+   * ProjectTopology preference page. 
+   * @return String[] array of template ids. The array may have 0 elements.
+   */
+  public static String[] getAllClientProjectTypes()
+  {
+    ArrayList finalTemplateIdList = new ArrayList();
+    Iterator iter = registry.clientRuntimes_.values().iterator();
+
+    //Loop through all the clientRuntimes
+    while (iter.hasNext())   
+    {
+      ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+      
+      //Get the templates for this clientRuntime
+      Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(desc.getId());
+      
+      //Add the template ids to the list if they have not already been added
+      Iterator itr = templates.iterator();
+      while (itr.hasNext())
+      {
+        IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next();
+        if (!finalTemplateIdList.contains(template.getId()))
+        {
+          finalTemplateIdList.add(template.getId());
+        }
+      }            
+    }
+    
+    return (String[])finalTemplateIdList.toArray(new String[]{});
+  }
+  
+  /**
+   * Returns the label of a Web service runtime given its id
+   * @param runtimeId id of a Web service runtime
+   * @return String the label of the Web service runtime with an id equal to runtimeId.
+   * Returns null if such a Web service runtime cannot be found.
+   */
+  public static String getRuntimeLabelById(String runtimeId) 
+  {
+    RuntimeDescriptor desc = getRuntimeById(runtimeId);
+    if (desc == null)
+      return null;
+    
+    return desc.getLabel();
+  }    
+  
+  /**
+   * Returns the RuntimeDescriptor corresponding to the Web service runtime with the provided label
+   * @param label label of a Web service runtime
+   * @return RuntimeDescriptor corresponding to the Web service runtime with the provided label
+   * Returns null if such a Web service runtime cannot be found.
+   */
+  public static RuntimeDescriptor getRuntimeByLabel(String label)
+  {
+    Iterator iter = registry.runtimes_.values().iterator();
+    while (iter.hasNext())
+    {
+      RuntimeDescriptor descriptor = (RuntimeDescriptor)iter.next();
+      if (descriptor!=null) {
+        if (label.equals(descriptor.getLabel()))
+          return descriptor;
+      }
+    }
+    return null;      
+  }      
+
+  /**
+   * Returns the label of an server type given its id
+   * @param serverFactoryId id of a server type
+   * @return String label of the server type with an id equal to serverFactoryId.
+   * Returns null if such a server type cannot be found.
+   */
+  public static String getServerLabelById(String serverFactoryId)
+  {
+    IServerType serverType = ServerCore.findServerType(serverFactoryId);
+    if (serverType == null)
+      return null;
+    
+    String serverLabel = ServerUICore.getLabelProvider().getText(serverType);   
+    return serverLabel;
+  }
+  
+  /**
+   * Returns the label of an IServer given its id
+   * @param instanceId id of an IServer
+   * @return String label of the IServer with an id equal to instanceId.
+   */  
+  public static String getServerInstanceLabelFromInstanceId( String instanceId )
+  {
+    IServer server = ServerCore.findServer( instanceId );    
+    return server.getName();
+  }  
+
+  /**
+   * Returns the union of all server type ids corresponding to the facet runtimes
+   * in the provided set.
+   * @param facetRuntimes a set containing elements of type {@link IRuntime}.
+   * @return an array of IServerType ids. The array may have 0 elements.
+   */
+  private static String[] getServerFactoryIdsByFacetRuntimes(Set facetRuntimes)
+  {
+    
+    ArrayList supportedServerFactoryIds = new ArrayList();
+    String[] serverTypeIds = getAllServerFactoryIdsWithRuntimes();
+    Iterator itr = facetRuntimes.iterator();
+    while(itr.hasNext())
+    {
+      IRuntime fRuntime = (IRuntime)itr.next();
+      org.eclipse.wst.server.core.IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+      for (int i=0; i<serverTypeIds.length; i++)
+      {
+        IServerType serverType = ServerCore.findServerType(serverTypeIds[i]);
+        IRuntimeType runtimeType = serverType.getRuntimeType();
+        if (runtimeType != null)
+        {
+	        String runtimeTypeId = runtimeType.getId();
+	        if (sRuntime != null && sRuntime.getRuntimeType() != null && runtimeTypeId.equals(sRuntime.getRuntimeType().getId()))
+	        {
+	          supportedServerFactoryIds.add(serverTypeIds[i]);          
+	        }      
+        }
+      }
+    }
+    
+    return (String[])supportedServerFactoryIds.toArray(new String[0]);
+    
+    //Temporarily return all factory ids with runtimes
+    //return getAllServerFactoryIdsWithRuntimes();    
+  }
+  
+  //Service-side utilities
+  /**
+   * Returns a WebServiceImpl given the id of a Web service implementation type.
+   * @param id 
+   * @return WebServiceImpl with the given id
+   * Returns null if such a WebServiceImpl cannot be found.
+   */
+  public static WebServiceImpl getWebServiceImplById(String id)
+  {
+    Object result = registry.webServiceImpls_.get(id);
+    if (result!=null)
+    {
+      return (WebServiceImpl)result;
+    }
+    return null;    
+  }
+  
+  /**
+   * Returns a {@link ServiceRuntimeDescriptor} given the id of a servicRuntime.
+   * @param id of a serviceRuntime
+   * @return ServiceRuntimeDescriptor with the given id
+   * Returns null if such a ServiceRuntimeDescriptor cannot be found.
+   */
+  public static ServiceRuntimeDescriptor getServiceRuntimeDescriptorById(String id)
+  {
+    Object result = registry.serviceRuntimes_.get(id);
+    if (result!=null)
+    {
+      return (ServiceRuntimeDescriptor)result;
+    }
+    return null;        
+  }  
+  
+  /**
+   * Returns the {@link IWebServiceRuntime} of the given serviceRuntime. Extenders provide the fully 
+   * qualified name of a concrete IWebServiceRuntime in the class attribute of a serviceRuntimes extension.
+   * @param serviceRuntimeId id of a serviceRuntime
+   * @return IWebServiceRuntime
+   */
+  public static IWebServiceRuntime getServiceRuntime( String serviceRuntimeId )
+  {
+    ServiceRuntimeDescriptor descriptor = getServiceRuntimeDescriptorById(serviceRuntimeId);
+    IWebServiceRuntime    webserviceRuntime     = null;
+    if (descriptor != null)
+    {
+        webserviceRuntime = descriptor.getWebServiceRuntime();
+    }
+    
+    return webserviceRuntime;
+  }
+  
+  /**
+   * Returns the id of a serviceRuntime that supports the provided Web service type, Web service runtime,
+   * server type/server instance (if present), project or project type.
+   * @param trs an instance of {@link TypeRuntimeServer} containing a Web service type id, Web service runtime id,
+   * server type id and server instance id. The Web service type id and Web service runtime id must be non-null 
+   * and non-empty. The server type id and server instance id may be null or empty.
+   * @param projectName the name of an IProject thay may or mat not exist in the workspace. Must be non-null and 
+   * non-empty.
+   * @param templateId the id of an {@link IFacetedProjectTemplate}. Must be non-null and non-empty if
+   * an IProject with the name projectName does not exist in the workspace. 
+   * @return String id of a serviceRuntime that supports the provided Web service type, Web service runtime,
+   * server type/server instance (if present), project or project type. Returns an empty String if no 
+   * such serviceRuntime could be found.
+   */
+  public static String getServiceRuntimeId(TypeRuntimeServer trs, String projectName, String templateId)
+  {
+    boolean serverSelected = (trs.getServerId() != null) && (trs.getServerId().length() > 0); 
+    //Find the first serviceRuntime that supports the implementation type, runtime, server, and project
+    String[] descs = getServiceRuntimesByServiceType(trs.getTypeId());
+    for (int i=0; i<descs.length; i++)
+    {
+      ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(descs[i]);      
+      if (desc.getRuntime().getId().equals(trs.getRuntimeId()))
+      {
+        if (serverSelected)
+        {
+          boolean supportsServer = doesServiceRuntimeSupportServer(desc.getId(), trs.getServerId());
+          if (!supportsServer)
+          {
+            continue;
+          }
+        }
+        
+        IProject project = ProjectUtilities.getProject(projectName);
+        if (project.exists())
+        {
+          if (doesServiceRuntimeSupportProject(desc.getId(), projectName))
+          {
+            return desc.getId();
+          }
+        }
+        else
+        {
+          //Check if template is supported
+          if (doesServiceRuntimeSupportTemplate(desc.getId(), templateId))
+          {
+            return desc.getId();
+          }
+        }
+      }
+    }
+    
+    return "";
+    
+  }  
+  
+  /**
+   * Returns the Web service scenario from the Web service type.
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * @return int scenario (e.g. WebServiceScenario.BOTTOM_UP or WebServiceScenario.TOP_DOWN)
+   */        
+  public static int getScenarioFromTypeId(String typeId)
+  {
+    return Integer.parseInt(typeId.substring(0,typeId.indexOf("/")));
+  }
+  
+  /**
+   * Returns the Web service implemenation type id fron the Web service type id.
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * @return String the WebServiceImpl id.
+   */        
+  public static String getWebServiceImplIdFromTypeId(String typeId)
+  {
+    return typeId.substring(typeId.indexOf("/")+1);
+  }    
+  
+  /**
+   * Returns the ids of all Web service runtimes that support the given
+   * Web service type.
+   * 
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * 
+   * @return String[] array containing the ids of all Web service runtimes that
+   * support the given Web service type. The array may have 0 elements.
+   */
+  public static String[] getRuntimesByServiceType(String typeId) 
+  {
+    int scenario = getScenarioFromTypeId(typeId);
+    String implId = getWebServiceImplIdFromTypeId(typeId);    
+    ArrayList ids = new ArrayList();
+    Iterator iter = registry.serviceRuntimes_.values().iterator();
+    while (iter.hasNext())   
+    {
+      ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
+      //Check if this serviceRuntime supports the implementation type
+      if (desc.getServiceImplementationType().getId().equals(implId))
+      {
+        switch (scenario)
+        {
+          case WebServiceScenario.BOTTOMUP:
+            if (desc.getBottomUp())
+            {
+              String runtimeId = desc.getRuntime().getId(); 
+              if (!ids.contains(runtimeId))
+              {
+                ids.add(runtimeId);
+              }
+            }
+            break;
+          case WebServiceScenario.TOPDOWN:
+            if (desc.getTopDown())
+            {
+              String runtimeId = desc.getRuntime().getId(); 
+              if (!ids.contains(runtimeId))
+              {
+                ids.add(runtimeId);
+              }
+            }
+            break;
+          default:          
+        }
+      }
+    }
+    
+    return (String[])ids.toArray(new String[]{});
+  }
+  
+  /**
+   * Returns the ids of all serviceRuntimes that support the given
+   * Web service type.
+   * 
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * 
+   * @returns String[] array containing the ids of all serviceRuntimes that
+   * support the given Web service type. The array may have 0 elements.
+   */
+  public static String[] getServiceRuntimesByServiceType(String typeId) 
+  {
+    int scenario = getScenarioFromTypeId(typeId);
+    String implId = getWebServiceImplIdFromTypeId(typeId);    
+    ArrayList ids = new ArrayList();
+    Iterator iter = registry.serviceRuntimes_.values().iterator();
+    while (iter.hasNext())   
+    {
+      ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
+      //Check if this serviceRuntime supports the implementation type
+      if (desc.getServiceImplementationType().getId().equals(implId))
+      {
+        switch (scenario)
+        {
+          case WebServiceScenario.BOTTOMUP:
+            if (desc.getBottomUp())
+            {
+              String serviceRuntimeId = desc.getId(); 
+              ids.add(serviceRuntimeId);
+            }
+            break;
+          case WebServiceScenario.TOPDOWN:
+            if (desc.getTopDown())
+            {
+              String serviceRuntimeId = desc.getId(); 
+              ids.add(serviceRuntimeId);
+            }
+            break;
+          default:          
+        }
+      }
+    }
+    
+    return (String[])ids.toArray(new String[]{});
+  }  
+  
+  /**
+   * Returns whether or not the given Web service runtime supports the given 
+   * Web service type.
+   * 
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * 
+   * @param runtimeId id of a Web service runtime
+   * 
+   * @return boolean <code>true</code> if the given Web service runtime supports the given 
+   * Web service type. <code>false</code> otherwise.
+   */ 
+  public static boolean isRuntimeSupportedForServiceType(String typeId, String runtimeId)
+  {
+    String[] serviceRuntimeIds = getServiceRuntimesByServiceType(typeId);
+    if (serviceRuntimeIds!=null)
+    {
+      for (int i=0; i < serviceRuntimeIds.length; i++)
+      {
+        ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeIds[i]);
+        if (desc.getRuntime().getId().equals(runtimeId))
+        {
+          return true;
+        }
+      }
+    }
+    
+    return false;
+  }  
+  
+  /**
+   * Returns the ids of all server types that support the given
+   * Web service type.
+   * 
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * 
+   * @returns String[] array containing the ids of all server types that
+   * support the given Web service type. The array may have 0 elements. 
+   */
+  public static String[] getServerFactoryIdsByServiceType(String typeId)
+  {
+    ArrayList serverFactoryIds = new ArrayList();
+    String[] srts = getServiceRuntimesByServiceType(typeId);
+    if (srts != null)
+    {
+      for (int i = 0; i < srts.length; i++)
+      {
+        //Get the runtimes that work for the facets required for this serviceRuntime        
+        String[] fIds = getServerFactoryIdsByServiceRuntime(srts[i]);
+        for (int j=0; j<fIds.length; j++)
+        {
+          if (!serverFactoryIds.contains(fIds[j]))
+          {
+            serverFactoryIds.add(fIds[j]);            
+          }
+        }
+      }
+    }
+    
+    return (String[])serverFactoryIds.toArray(new String[]{});
+    
+    //Temporarily return all server type ids.
+    //return getAllServerFactoryIdsWithRuntimes();
+  }
+  
+  /**
+   * Returns whether or not the given server type supports the given 
+   * Web service type.
+   * 
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * 
+   * @param serverFactoryId id of a server type
+   * 
+   * @return boolean <code>true</code> if the given server type supports the given 
+   * Web service type. <code>false</code> otherwise.
+   */
+  public static boolean isServerSupportedForChosenServiceType(String typeId, String serverFactoryId)
+  {
+    String[] fIds = getServerFactoryIdsByServiceType(typeId);
+    if (fIds == null)
+    {
+      return false;
+    }
+
+    for (int i=0;i<fIds.length;i++)
+    {
+      if (serverFactoryId.equals(fIds[i]))
+      {
+        return true;
+      }      
+    }
+    
+    return false;
+  }
+  
+  /**
+   * Returns the ids of all server types that support the given
+   * serviceRuntime.
+   * 
+   * @param serviceRuntimeId id of a serviceRuntime
+   * 
+   * @returns String[] array containing the ids of all server types that
+   * support the given serviceRuntime. The array may have 0 elements. 
+   */   
+  public static String[] getServerFactoryIdsByServiceRuntime(String serviceRuntimeId)
+  {       
+    ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeId);
+    Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions());
+            
+    //Temporarily return all server types
+    //return getAllServerFactoryIdsWithRuntimes();
+    return getServerFactoryIdsByFacetRuntimes(facetRuntimes);
+  } 
+  
+
+  
+  /**
+   * Returns whether or not the given server type supports the given 
+   * serviceRuntime.
+   * 
+   * @param serviceRuntimeId id of a serviceRuntime
+   * @param serverFactoryId id of a server type
+   * 
+   * @return boolean <code>true</code> if the given server type supports the given 
+   * serviceRuntime. <code>false</code> otherwise.
+   */  
+  public static boolean doesServiceRuntimeSupportServer(String serviceRuntimeId, String serverFactoryId)
+  {
+    String[] serverIds = getServerFactoryIdsByServiceRuntime(serviceRuntimeId);
+    for (int i=0; i<serverIds.length; i++)
+    {
+      if (serverIds[i].equals(serverFactoryId))
+      {
+        return true;
+      }
+    }
+    
+    return false;
+  }
+    
+  /**
+   * Returns the labels and ids of all Web service types. Used to populate the Web service type combo box on
+   * page 1 of the Web service wizard.
+   * @return {@link LabelsAndIds}
+   */
+  public static LabelsAndIds getServiceTypeLabels()
+  {   
+    LabelsAndIds labelIds = new LabelsAndIds();
+    Iterator     iterator = registry.webServiceTypesList_.iterator();
+    int          size     = registry.webServiceTypesList_.size();
+    String[]     labels   = new String[size];
+    String[]     ids      = new String[size];
+    int          index    = 0;
+    
+    labelIds.setLabels_( labels );
+    labelIds.setIds_( ids );
+    
+    while( iterator.hasNext() ) 
+    {
+      String wst = (String)iterator.next();
+      int scenario = getScenarioFromTypeId(wst);
+      String implId = getWebServiceImplIdFromTypeId(wst);
+      WebServiceImpl wsimpl = getWebServiceImplById(implId);
+      String impllabel = wsimpl.getLabel();
+      ids[index]    = wst;
+      String scenLabel = "";
+      switch(scenario)
+      {
+      case WebServiceScenario.BOTTOMUP:
+        scenLabel = NLS.bind(ConsumptionUIMessages.BOTTOMUP_LABEL, new String[0]);
+        break;
+      case WebServiceScenario.TOPDOWN:
+        scenLabel = NLS.bind(ConsumptionUIMessages.TOPDOWN_LABEL, new String[0]);
+        break; 
+      default:
+      }
+      labels[index] = NLS.bind(ConsumptionUIMessages.COMBINED_TYPE_AND_RUNTIME_LABEL, new String[]{ scenLabel, impllabel });
+      index++;
+    }    
+    
+    return labelIds;
+  }
+  
+  /**
+   * Returns the id of a Web service runtime that supports the given Web service type.
+   *  
+   * @param typeId will be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * 
+   * @return String id of a Web service runtime that supports the given Web service type. 
+   * Returns null if such a Web service runtime cannot be found.
+   */
+  public static String getDefaultRuntimeValueFor(String typeId)
+  {
+    String[] srIds = getServiceRuntimesByServiceType(typeId);
+    if (srIds == null)
+    {
+      return null;
+    }
+    
+    ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(srIds[0]);
+    return desc.getRuntime().getId();
+  }      
+
+  /**
+   * Returns the id of a server type that supports the given Web service type.
+   *  
+   * @param typeId will be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * 
+   * @return String id of a id of a server type that supports the given Web service type. 
+   * Returns null if such a server type cannot be found.
+   */    
+  public static String getDefaultServerValueFor(String typeId)
+  {
+    String[] fIds = getServerFactoryIdsByServiceType(typeId);
+    if (fIds==null || fIds.length==0)
+      return null;
+    
+    return fIds[0];
+  }    
+  
+  /**
+   * Returns whether or not the given combination of server type, Web service runtime, and Web service type is
+   * supported. Used for validation.
+   * 
+   * @param serverFactoryId id of a server type
+   * @param runtimeId id of a Web service runtime
+   * @param typeId will be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * 
+   * @return boolean <code>true</code> if the given combination of server type, Web service runtime, and Web service type is
+   * supported. <code>false</code> otherwise.
+   */
+  public static boolean isServerRuntimeTypeSupported(String serverFactoryId, String runtimeId, String typeId)  
+  {
+    //Ensure there is at least one serviceRuntime that supports the given type
+    String[] serviceRuntimes = getServiceRuntimesByServiceType(typeId);
+    if (serviceRuntimes!=null && serviceRuntimes.length>0)
+    {
+      //Ensure that at least one of these server runtimes supports the given server
+      for (int i=0; i<serviceRuntimes.length; i++)
+      {
+        ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimes[i]);
+        if (desc.getRuntime().getId().equals(runtimeId))
+        {
+          //Matches the type and the runtime. Check if it matches the server
+          Set runtimes = getRuntimes(desc.getRequiredFacetVersions());
+          String[] fIds = getServerFactoryIdsByFacetRuntimes(runtimes);
+          for (int j=0; j<fIds.length; j++)
+          {
+            if (fIds[j].equals(serverFactoryId))
+            {
+              return true;
+            }
+          }          
+        }        
+      }
+    }
+    
+    //didn't find a match. return false.
+    return false;
+  }  
+  
+  /**
+   * Returns an array of Web service type ids that are suitable for the provided selection.
+   * Used to default the Web service type combo box on page 1 of the Web service wizard
+   * based on the user's initial selection.
+   * @param selection
+   * @return String[] an array of Web service type ids that are suitable for the provided selection.
+   * Returns null if the selection is empty or no suitable Web service types are found.
+   */
+  public static String[] getWebServiceTypeBySelection(IStructuredSelection selection)
+  {
+    TypeSelectionFilter2 tsf = new TypeSelectionFilter2();
+    String[] wst = tsf.getWebServiceTypeByInitialSelection(selection, registry.webServiceTypesList_);
+    return wst == null ? null : wst;
+  }    
+  
+  /**
+   * Returns whether or not the given server type supports the given Web service runtime
+   * 
+   * @param runtimeId : id of a Web service runtime
+   * @param factoryId : id of a server type
+   * @return boolean <code>true</code> if the given server type supports the given 
+   * Web service runtime for the service side. <code>false</code> otherwise.
+   */
+  public static boolean doesRuntimeSupportServerForServiceSide(String runtimeId, String factoryId)
+  {
+    //Get all the ServiceRuntimeDescriptors that point to this runtimeId
+    Iterator iter = registry.serviceRuntimes_.values().iterator();
+    while (iter.hasNext())   
+    {
+      ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
+      //check if this serviceRuntime points to runtimeId
+      String thisRuntimeId = desc.getRuntime().getId();
+      if (thisRuntimeId.equals(runtimeId))
+      {
+        Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions());
+        String[] fIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes);
+        for (int j=0; j<fIds.length; j++)
+        {
+          if (fIds[j].equals(factoryId))
+          {
+            return true;
+          }
+        }              
+      }            
+    }
+    
+    //No serviceRuntime matched. Return false.
+    return false;
+  }
+  
+  /**
+   * Returns the id of a server type that supports the given Web service runtime
+   * on the service side.
+   * 
+   * @param runtimeId id of a Web service runtime
+   * @return String the id of a server type that supports the given Web service runtime.
+   * Returns null if such a server type cannot be found. 
+   */
+  public static String getFirstSupportedServerForServiceSide(String runtimeId)
+  {
+    //Get all the ServiceRuntimeDescriptors that point to this runtimeId
+    Iterator iter = registry.serviceRuntimes_.values().iterator();
+    while (iter.hasNext())   
+    {
+      ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
+      //check if this serviceRuntime points to runtimeId
+      String thisRuntimeId = desc.getRuntime().getId();
+      if (thisRuntimeId.equals(runtimeId))
+      {
+        Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions());
+        String[] factoryIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes);
+        if (factoryIds!=null && factoryIds.length >0)
+        {
+          return factoryIds[0];
+        }
+      }            
+    }
+    
+    //didn't get a single suitable server type id, return null.
+    return null;
+  }  
+  
+  /**
+   * Returns the names of all projects in the workspace which support the given Web service type
+   * and Web service runtime.
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * @param runtimeId id of a Web service runtime
+   * @return String[] array of project names. The array may have 0 elements.
+   */
+  public static String[] getProjectsForServiceTypeAndRuntime(String typeId, String runtimeId)
+  {
+    IProject[] projects = FacetUtils.getAllProjects();
+    ArrayList validProjects = new ArrayList();
+    
+    for (int i=0; i<projects.length;i++)
+    {
+      if (doesServiceTypeAndRuntimeSupportProject(typeId, runtimeId, projects[i].getName()))
+      {
+        validProjects.add(projects[i].getName());        
+      }      
+    }
+    
+    return (String[])validProjects.toArray(new String[0]);
+    
+  }
+  
+  /**
+   * Returns whether or not the given project supports the given Web service type and Web service runtime.
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * @param runtimeId id of a Web service runtime
+   * @param projectName name of an IProject in the workspace
+   * @return boolean <code>true</code> if the project supports the given Web service type and 
+   * Web service runtime. Returns <code>false</code>
+   * <ul> 
+   * <li>if the project does not support the given Web service type and Web service runtime or</li>
+   * <li>if the project does not exist or</li>
+   * <li>if projectName is null or empty</li>
+   * </ul>
+   */
+  public static boolean doesServiceTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName)
+  {
+    String[] descs = getServiceRuntimesByServiceType(typeId);
+    for (int j = 0; j < descs.length; j++)
+    {
+      ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(descs[j]);
+      if (desc.getRuntime().getId().equals(runtimeId))
+      {
+        if (doesServiceRuntimeSupportProject(descs[j], projectName))
+        {
+          return true;
+        }
+      }
+    }
+    
+    return false;    
+    
+  }  
+  
+  /**
+   * Returns whether or not the given project supports the given serviceRuntime.
+   * @param serviceRuntimeId id of a serviceRuntime
+   * @param projectName name of an IProject in the workspace
+   * @return boolean <code>true</code> if the project supports the given
+   * serviceRuntime. Returns <code>false</code>
+   * <ul> 
+   * <li>if the project does not support the given serviceRuntime or</li>
+   * <li>if the project does not exist or</li>
+   * <li>if projectName is null or empty</li>
+   * </ul>
+   */  
+  public static boolean doesServiceRuntimeSupportProject(String serviceRuntimeId, String projectName)
+  {
+    FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(false, serviceRuntimeId, projectName);
+    if (fm != null)
+    {
+      return fm.isMatch();
+    }
+    else
+    {
+      return false;
+    }    
+  }  
+  
+
+  /**
+   * Returns an array of {@link IFacetedProjectTemplate} ids that support the given Web service type
+   * and Web service runtime.
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * @param runtimeId id of a Web service runtime
+   * @return String[] array of {@link IFacetedProjectTemplate} ids that support the given Web service type
+   * and Web service runtime. The array may have 0 elements. Returns null if no serviceRuntimes supporting
+   * the given Web service type could be found.
+   */
+  public static String[] getServiceProjectTemplates(String typeId, String runtimeId)
+  {
+    String[] srIds = getServiceRuntimesByServiceType(typeId);
+    if (srIds == null)
+    {
+      return null;
+    }
+
+    ArrayList templateIdList = new ArrayList();
+    for (int i = 0; i < srIds.length; i++)
+    {
+      ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(srIds[i]);
+      String thisRuntimeId = desc.getRuntime().getId();
+      if (thisRuntimeId.equals(runtimeId))
+      {
+        //Get the templates for this serviceRuntime
+        Set templates = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(desc.getId());
+        
+        //Add the template ids to the list if they have not already been added
+        Iterator itr = templates.iterator();
+        while (itr.hasNext())
+        {
+          IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next();
+          if (!templateIdList.contains(template.getId()))
+          {
+            templateIdList.add(template.getId());
+          }
+        }
+      }
+      
+    }  
+    
+    return (String[])templateIdList.toArray(new String[]{});    
+  }
+
+  /**
+   * Returns whether or not the given {@link IFacetedProjectTemplate} supports the given Web service type
+   * and Web service runtime.
+   * @param typeId must be a String of the format "0/implId"
+   * where the digit before the "/" represents the scenario
+   * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the Web service implementation type id.
+   * @param runtimeId id of a Web service runtime
+   * @param templateId id of a {@link IFacetedProjectTemplate}
+   * @return boolean <code>true</code> if the given {@link IFacetedProjectTemplate} supports the given 
+   * Web service type and Web service runtime. Returns <code>false</code> otherwise. 
+   */
+  public static boolean doesServiceTypeAndRuntimeSupportTemplate(String typeId, String runtimeId, String templateId)
+  {
+    String[] srIds = getServiceRuntimesByServiceType(typeId);
+    if (srIds == null)
+    {
+      return false;
+    }
+
+    for (int i = 0; i < srIds.length; i++)
+    {
+      ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(srIds[i]);
+      String thisRuntimeId = desc.getRuntime().getId();
+      if (thisRuntimeId.equals(runtimeId))
+      {
+        //Get the templates for this serviceRuntime
+        Set templates = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(srIds[i]);
+        
+        //Check if any of the template ids match the given one.
+        Iterator itr = templates.iterator();
+        while (itr.hasNext())
+        {
+          IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next();
+          if (template.getId().equals(templateId))
+          {
+            return true;
+          }
+
+        }
+      }
+      
+    }  
+    
+    return false;    
+  }
+  
+  /**
+   * Returns whether or not the given {@link IFacetedProjectTemplate} supports the given serviceRuntime.
+   * @param serviceRuntimeId id of a serviceRuntime
+   * @param templateId id of a {@link IFacetedProjectTemplate}
+   * @return boolean <code>true</code> if the given {@link IFacetedProjectTemplate} supports the given 
+   * serviceRuntime. Returns <code>false</code> otherwise.
+   */
+  public static boolean doesServiceRuntimeSupportTemplate(String serviceRuntimeId, String templateId)
+  {
+    //Get the templates for this serviceRuntime
+    Set templates = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(serviceRuntimeId);
+    IFacetedProjectTemplate checkingTemplate = ProjectFacetsManager.getTemplate(templateId);
+    return templates.contains(checkingTemplate);
+  }  
+  
+  //Client-side utilities
+  /**
+   * Returns a WebServiceClientImpl given the id of a Web service client implementation type.
+   * @param id 
+   * @return {@link WebServiceClientImpl} with the given id
+   * Returns null if such a WebServiceClientImpl cannot be found.
+   */  
+  public static WebServiceClientImpl getWebServiceClientImplById(String id)
+  {
+    Object result = registry.webServiceClientImpls_.get(id);
+    if (result!=null)
+    {
+      return (WebServiceClientImpl)result;
+    }
+    return null;    
+  }
+  
+  /**
+   * Returns a {@link ClientRuntimeDescriptor} given the id of a clientRuntime.
+   * @param id of a clientRuntime
+   * @return ClientRuntimeDescriptor with the given id
+   * Returns null if such a ClientRuntimeDescriptor cannot be found.
+   */  
+  public static ClientRuntimeDescriptor getClientRuntimeDescriptorById(String id)
+  {
+    Object result = registry.clientRuntimes_.get(id);
+    if (result!=null)
+    {
+      return (ClientRuntimeDescriptor)result;
+    }
+    return null;        
+  }    
+  
+  /**
+   * Returns the {@link IWebServiceRuntime} of the given clientRuntime. Extenders provide the fully 
+   * qualified name of a concrete IWebServiceRuntime in the class attribute of a clientRuntimes extension.
+   * @param clientRuntimeId id of a clientRuntime
+   * @return IWebServiceRuntime
+   */  
+  public static IWebServiceRuntime getClientRuntime( String clientRuntimeId )
+  {
+    ClientRuntimeDescriptor descriptor = getClientRuntimeDescriptorById(clientRuntimeId);
+    IWebServiceRuntime    webserviceRuntime     = null;
+    if (descriptor != null)
+    {
+        webserviceRuntime = descriptor.getWebServiceRuntime();
+    }
+    
+    return webserviceRuntime;
+  }
+  
+  /**
+   * Returns the id of a clientRuntime that supports the provided Web service client implementation type, Web service runtime,
+   * server type/server instance (if present), project or project type.
+   * @param trs an instance of {@link TypeRuntimeServer} containing a Web service client implementation type id, Web service runtime id,
+   * server type id and server instance id. The Web service client implementation type id and Web service runtime id must be non-null 
+   * and non-empty. The server type id and server instance id may be null or empty.
+   * @param projectName the name of an IProject thay may or mat not exist in the workspace. Must be non-null and 
+   * non-empty.
+   * @param templateId the id of an {@link IFacetedProjectTemplate}. Must be non-null and non-empty if
+   * an IProject with the name projectName does not exist in the workspace. 
+   * @return String id of a clientRuntime that supports the provided Web service client implementation type, Web service runtime,
+   * server type/server instance (if present), project or project type. Returns an empty String if no 
+   * such clientRuntime could be found.
+   */  
+  public static String getClientRuntimeId(TypeRuntimeServer trs, String projectName, String templateId)
+  {
+    boolean serverSelected = (trs.getServerId()!=null) && (trs.getServerId().length()>0);
+    //Find the first clientRuntime that supports the implementation type, runtime, server, and project
+    String[] descs = getClientRuntimesByType(trs.getTypeId());
+    for (int i=0; i<descs.length; i++)
+    {
+      ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[i]);      
+      if (desc.getRuntime().getId().equals(trs.getRuntimeId()))
+      {
+        if (serverSelected)
+        {
+          boolean supportsServer = doesClientRuntimeSupportServer(desc.getId(), trs.getServerId());
+          if (!supportsServer)
+          {
+            continue;
+          }
+        }
+        
+        IProject project = ProjectUtilities.getProject(projectName);
+        if (project.exists())
+        {
+          if (doesClientRuntimeSupportProject(desc.getId(), projectName))
+          {
+            return desc.getId();
+          }
+        }
+        else
+        {
+          //Check if template is supported
+          if (doesClientRuntimeSupportTemplate(desc.getId(), templateId))
+          {
+            return desc.getId();
+          }
+        }
+      }
+    }
+    
+    return "";
+    
+  }
+  
+  /**
+   * Returns all Web service runtime ids for the client side.
+   * @return String[] array of Web service runtime ids for the client side.
+   * The array may have 0 elements. 
+   */
+  public static String[] getAllRuntimesForClientSide() 
+  {
+    ArrayList runtimeIds = new ArrayList();
+    Iterator iter = registry.clientRuntimes_.values().iterator();
+    while (iter.hasNext())   
+    {
+      ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+      String thisRuntimeId = desc.getRuntime().getId(); 
+      if (!runtimeIds.contains(thisRuntimeId))
+      runtimeIds.add(thisRuntimeId);
+    }      
+    return (String[])runtimeIds.toArray(new String[]{});
+  }
+  
+  /**
+   * Returns the ids of all clientRuntimes that support the given
+   * Web service client implementation type.
+   * @param clientImplId id of a Web service client implementation type
+   * @returns String[] array containing the ids of all clientRuntimes that
+   * support the given Web service client implementation type. The array may have 0 elements.
+   */
+  public static String[] getClientRuntimesByType(String clientImplId) 
+  {
+    ArrayList ids = new ArrayList();
+    Iterator iter = registry.clientRuntimes_.values().iterator();
+    while (iter.hasNext())   
+    {
+      ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+      //Check if this serviceRuntime supports the implementation type
+      if (desc.getClientImplementationType().getId().equals(clientImplId))
+      {
+        ids.add(desc.getId());
+      }
+    }
+    
+    return (String[])ids.toArray(new String[]{});
+  }  
+  
+  /**
+   * Returns the ids of all Web service runtimes that support the given
+   * Web service client implementation type.
+   * @param clientImplId id of a Web service client implementation type
+   * @return String[] array containing the ids of all Web service runtimes that
+   * support the given Web service client implementation type. The array may have 0 elements.
+   */
+  public static String[] getRuntimesByClientType(String clientImplId) 
+  {
+    ArrayList runtimeIds = new ArrayList();
+    Iterator iter = registry.clientRuntimes_.values().iterator();
+    while (iter.hasNext())   
+    {
+      ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+      //Check if this serviceRuntime supports the implementation type
+      if (desc.getClientImplementationType().getId().equals(clientImplId))
+      {
+        if (!runtimeIds.contains(desc.getRuntime().getId()))
+        {
+          runtimeIds.add(desc.getRuntime().getId());
+        }
+      }
+    }
+    
+    return (String[])runtimeIds.toArray(new String[]{});
+  }
+  
+  /**
+   * Returns whether or not the given Web service runtime supports the given 
+   * Web service client implementation type.
+   * @param clientImplId id of a Web service client implementation type
+   * @param runtimeId id of a Web service runtime
+   * @return boolean <code>true</code> if the given Web service runtime supports the given 
+   * Web service client implementation type. <code>false</code> otherwise.
+   */
+  public static boolean isRuntimeSupportedForClientType(String clientImplId, String runtimeId)
+  {
+    String[] clientRuntimeIds = getClientRuntimesByType(clientImplId);
+    if (clientRuntimeIds!=null)
+    {
+      for (int i=0; i < clientRuntimeIds.length; i++)
+      {
+        ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeIds[i]);
+        if (desc.getRuntime().getId().equals(runtimeId))
+        {
+          return true;
+        }
+      }
+    }
+    
+    return false;
+  }
+  
+  /**
+   * Returns all server type ids with configured server runtimes.
+   * @return String[] array of server type ids. The array may have 0 elements.
+   */
+  public static String[] getAllClientServerFactoryIds() 
+  {    
+    //Iterator iter = registry.clientRuntimes_.values().iterator();
+    //while (iter.hasNext())   
+    //{
+      //TODO iterate over all the server types and see if their runtime types have an
+      //id that matches the runtime type of any of the runtimes.            
+      // ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+      // Set runtimes = getRuntimes(desc.getRequiredFacetVersions());
+      // IServerType[] allServerTypes = ServerCore.getServerTypes();
+    //}
+    //return (String[])serverFactoryIds.toArray(new String[]{});
+    //Temporarily return all server types
+    return getAllServerFactoryIdsWithRuntimes();    
+  }
+  
+  /**
+   * Returns the ids of all server types that support the given
+   * Web service client implementation type.
+   *  
+   * @param clientImplId id of a Web service client implementation type
+   * @return String[] array containing the ids of all server types that
+   * support the given Web service client implementation type. The array may have 0 elements.
+   */
+  public static String[] getServerFactoryIdsByClientType(String clientImplId)
+  {
+    ArrayList serverFactoryIds = new ArrayList();
+    String[] crts = getClientRuntimesByType(clientImplId);
+    if (crts != null)
+    {
+      for (int i = 0; i < crts.length; i++)
+      {
+        //Get the runtimes that work for the facets required for this serviceRuntime        
+        String[] fIds = getServerFactoryIdsByClientRuntime(crts[i]);
+        for (int j=0; j<fIds.length; j++)
+        {
+          if (!serverFactoryIds.contains(fIds[j]))
+          {
+            serverFactoryIds.add(fIds[j]);            
+          }
+        }
+      }        
+    }
+    
+    return (String[])serverFactoryIds.toArray(new String[]{});
+  }  
+  
+  /**
+   * Returns whether or not the given server type supports the given 
+   * Web service client implementation type.
+   * @param clientImplId id of a Web service client implementation type
+   * @param serverFactoryId id of a server type
+   * @return <code>true</code> if the given server type supports the given 
+   * Web service client implementation type. <code>false</code> otherwise.
+   */
+  public static boolean isServerSupportedForChosenClientType(String clientImplId, String serverFactoryId)
+  {
+    String[] fIds = getServerFactoryIdsByClientType(clientImplId);
+    if (fIds == null)
+    {
+      return false;
+    }
+
+    for (int i=0;i<fIds.length;i++)
+    {
+      if (serverFactoryId.equals(fIds[i]))
+      {
+        return true;
+      }      
+    }
+    
+    return false;
+  }  
+  
+  /**
+   * Returns the ids of all server types that support the given
+   * clientRuntime.
+   * 
+   * @param clientRuntimeId id of a clientRuntime
+   * @return String[] array containing the ids of all server types that
+   * support the given clientRuntime. The array may have 0 elements.
+   */
+  public static String[] getServerFactoryIdsByClientRuntime(String clientRuntimeId)
+  {       
+    ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId);
+    Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions());
+
+    String[] fIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes);
+    return fIds;    
+  }    
+
+  /**
+   * Returns whether or not the given server type supports the given 
+   * clientRuntime.
+   * 
+   * @param clientRuntimeId id of a clientRuntime
+   * @param serverFactoryId id of a server type
+   * @return boolean <code>true</code> if the given server type supports the given 
+   * clientRuntime. <code>false</code> otherwise.
+   */
+  public static boolean doesClientRuntimeSupportServer(String clientRuntimeId, String serverFactoryId)
+  {
+    String[] serverIds = getServerFactoryIdsByClientRuntime(clientRuntimeId);
+    for (int i=0; i<serverIds.length; i++)
+    {
+      if (serverIds[i].equals(serverFactoryId))
+      {
+        return true;
+      }
+    }
+    
+    return false;
+  }
+  
+  /**
+   * Returns whether or not the given server type supports the given Web service runtime
+   * 
+   * @param runtimeId id of a Web service runtime
+   * @param factoryId id of a server type
+   * @return boolean <code>true</code> if the given server type supports the given 
+   * Web service runtime for the client side. <code>false</code> otherwise.
+   */
+  public static boolean doesRuntimeSupportServerForClientSide(String runtimeId, String factoryId)
+  {
+    //Get all the ClientRuntimeDescriptors that point to this runtimeId
+    Iterator iter = registry.clientRuntimes_.values().iterator();
+    while (iter.hasNext())   
+    {
+      ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+      //check if this clientRuntime points to runtimeId
+      String thisRuntimeId = desc.getRuntime().getId();
+      if (thisRuntimeId.equals(runtimeId))
+      {
+        Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions());
+        String[] fIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes);
+        for (int i=0; i<fIds.length; i++)
+        {
+          if (fIds[i].equals(factoryId))
+          {
+            return true;
+          }
+        }
+      }            
+    }
+    
+    //No match.
+    return false;
+  }    
+  
+  /**
+   * Returns the id of a server type that supports the given Web service runtime
+   * on the client side.
+   * 
+   * @param runtimeId id of a Web service runtime
+   * @return String the id of a server type that supports the given Web service runtime
+   * on the client side. Returns null if such a server type cannot be found.
+   */
+  public static String getFirstSupportedServerForClientSide(String runtimeId)
+  {
+    //Get all the ClientRuntimeDescriptors that point to this runtimeId
+    Iterator iter = registry.clientRuntimes_.values().iterator();
+    while (iter.hasNext())   
+    {
+      ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+      //check if this clientRuntime points to runtimeId
+      String thisRuntimeId = desc.getRuntime().getId();
+      if (thisRuntimeId.equals(runtimeId))
+      {
+        Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions());
+        String[] factoryIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes);
+        if (factoryIds!=null && factoryIds.length >0)
+        {
+          return factoryIds[0];
+        }
+      }            
+    }
+    
+    //No suitable servers found. Return null.
+    return null;
+
+  }
+  
+
+  /**
+   * Returns whether or not the given combination of server type, Web service runtime, and 
+   * Web service client implementation type is supported. Used for validation.
+   * 
+   * @param serverFactoryId id of a server type
+   * @param runtimeId id of a Web service runtime
+   * @param clientImplId id of a Web service client implementation type
+   * @return boolean <code>true</code> if the given combination of server type, Web service runtime, 
+   * and Web service client implementation type is supported. <code>false</code> otherwise.
+   */
+  public static boolean isServerClientRuntimeTypeSupported(String serverFactoryId, String runtimeId, String clientImplId)  
+  {
+    //Ensure there is at least one clientRuntime that supports the given type
+    String[] clientRuntimes = getClientRuntimesByType(clientImplId);
+    if (clientRuntimes!=null && clientRuntimes.length>0)
+    {
+      //Ensure that at least one of these server runtimes supports the given server
+      for (int i=0; i<clientRuntimes.length; i++)
+      {
+        ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimes[i]);
+        if (desc.getRuntime().getId().equals(runtimeId))
+        {
+          //Matched type and runtime. Check the server.
+          String[] factoryIds = getServerFactoryIdsByClientRuntime(desc.getId());
+          for (int j=0; j<factoryIds.length; j++)
+          {
+            if (factoryIds[j].equals(serverFactoryId))
+            {
+              return true;
+            }
+          }
+        }
+      }
+    }
+    
+    //No match found. return false.
+    return false;
+  }    
+  
+  /**
+   * Returns an array of {@link IFacetedProjectTemplate} ids that support the given Web service client implementation type
+   * and Web service runtime.
+   * 
+   * @param clientImplId id of a Web service client implementation type
+   * @param runtimeId id of a Web service runtime
+   * @return String[] array of {@link IFacetedProjectTemplate} ids that support the given Web service client implementation type
+   * and Web service runtime. The array may have 0 elements. Returns null if no clientRuntimes supporting
+   * the given Web service client implementation type could be found.
+   */
+  public static String[] getClientProjectTemplates(String clientImplId, String runtimeId)
+  {
+    String[] crIds = getClientRuntimesByType(clientImplId);
+    if (crIds == null)
+    {
+      return null;
+    }
+
+    ArrayList templateIdList = new ArrayList();
+    for (int i = 0; i < crIds.length; i++)
+    {
+      ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(crIds[i]);
+      String thisRuntimeId = desc.getRuntime().getId();
+      if (thisRuntimeId.equals(runtimeId))
+      {
+        //Get the templates for this clientRuntime
+        Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(desc.getId());
+        
+        //Add the template ids to the list if they have not already been added
+        Iterator itr = templates.iterator();
+        while (itr.hasNext())
+        {
+          IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next();
+          if (!templateIdList.contains(template.getId()))
+          {
+            templateIdList.add(template.getId());
+          }
+        }
+      }
+      
+    }  
+    
+    return (String[])templateIdList.toArray(new String[]{});    
+  }  
+  
+  /**
+   * Returns whether or not the given {@link IFacetedProjectTemplate} supports the given 
+   * Web service client implementation type and Web service runtime.
+   * 
+   * @param clientImplId id of a Web service client implementation type
+   * @param runtimeId id of a Web service runtime
+   * @param templateId id of a {@link IFacetedProjectTemplate}
+   * @return boolean <code>true</code> if the given {@link IFacetedProjectTemplate} supports the given 
+   * Web service client implementation type and Web service runtime. Returns <code>false</code> otherwise. 
+   */
+  public static boolean doesClientTypeAndRuntimeSupportTemplate(String clientImplId, String runtimeId, String templateId)
+  {
+    String[] crIds = getClientRuntimesByType(clientImplId);
+    if (crIds == null)
+    {
+      return false;
+    }
+
+    for (int i = 0; i < crIds.length; i++)
+    {
+      ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(crIds[i]);
+      String thisRuntimeId = desc.getRuntime().getId();
+      if (thisRuntimeId.equals(runtimeId))
+      {
+        //Get the templates for this clientRuntime
+        Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(crIds[i]);
+        
+        //Check if the template ids contains the template we're checking for
+        Iterator itr = templates.iterator();
+        while (itr.hasNext())
+        {
+          IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next();
+          if (template.getId().equals(templateId))
+          {
+            return true;
+          }
+        }
+      }
+      
+    }  
+    
+    return false;    
+  }  
+  
+
+  /**
+   * Returns whether or not the given {@link IFacetedProjectTemplate} 
+   * supports the given clientRuntime
+   *  
+   * @param clientRuntimeId id of a clientRuntime
+   * @param templateId id of a {@link IFacetedProjectTemplate}
+   * @return boolean <code>true</code> if the given {@link IFacetedProjectTemplate} supports the given 
+   * clientRuntime. Returns <code>false</code> otherwise.
+   */
+  public static boolean doesClientRuntimeSupportTemplate(String clientRuntimeId, String templateId)
+  {
+    //Get the templates for this clientRuntime
+    Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(clientRuntimeId);
+    IFacetedProjectTemplate checkingTemplate = ProjectFacetsManager.getTemplate(templateId);
+    return templates.contains(checkingTemplate);
+  }
+  
+  /**
+   * Returns the labels and ids of all Web service client implementation types. 
+   * Used to populate the Web service client type combo box on
+   * page 1 of the Web service wizard and Web service client wizard.
+   * @return {@link LabelsAndIds}
+   */  
+  public static LabelsAndIds getClientTypeLabels()
+  {
+    
+    LabelsAndIds labelIds = new LabelsAndIds();
+    String[] idsArray = new String[0];
+    String[] labelsArray = new String[0];
+    labelIds.setIds_(idsArray);
+    labelIds.setLabels_(labelsArray);
+  
+    ArrayList ids = new ArrayList();
+    ArrayList labels = new ArrayList();
+  
+    Iterator itr = registry.clientRuntimes_.values().iterator();
+    while(itr.hasNext())
+    {
+      ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)itr.next();
+      WebServiceClientImpl thisClientImpl = desc.getClientImplementationType();
+      if (!ids.contains(thisClientImpl.getId()))
+      {
+        ids.add(thisClientImpl.getId());
+        labels.add(thisClientImpl.getLabel());
+      }
+    }
+
+    if (ids.size() > 0)
+    {
+      idsArray = (String[]) ids.toArray(new String[0]);
+      labelsArray = (String[]) labels.toArray(new String[0]);
+      labelIds.setIds_(idsArray);
+      labelIds.setLabels_(labelsArray);
+    }
+
+    return labelIds;
+
+  }  
+  
+  /**
+   * Returns all server type ids for which there are configured server runtimes
+   * present in the workspace.
+   * 
+   * @return String[] array of server type ids for which there are configured server runtimes
+   * present in the workspace. The array may have 0 elements.
+   */
+  public static String[] getAllServerFactoryIdsWithRuntimes()
+  {
+    ArrayList fids = new ArrayList();
+    IServerType[] sts = ServerCore.getServerTypes();
+    org.eclipse.wst.server.core.IRuntime[] rts = ServerCore.getRuntimes();
+    
+    for (int i=0; i<sts.length; i++)
+    {
+      IServerType st = sts[i];
+      for (int j=0; j<rts.length; j++)
+      {
+    	if (st == null || st.getRuntimeType() == null) break;    	  
+        org.eclipse.wst.server.core.IRuntime rt = rts[j];
+        // If the server type has the same runtime type as this runtime, add it to the list
+        String serverTypeRuntimeTypeId = st.getRuntimeType().getId();
+        
+        if (rt != null)
+        {
+        	IRuntimeType rtType = rt.getRuntimeType();
+        	if (rtType != null)
+        	{
+		        String runtimeRuntimeTypeId = rtType.getId();
+		        if (serverTypeRuntimeTypeId.equals(runtimeRuntimeTypeId))
+		        {
+		          if (!fids.contains(st.getId()))
+		          {
+		            fids.add(st.getId());
+		          }
+		        }
+        	}
+        }
+      }
+    }
+   
+    return (String[])fids.toArray(new String[0]);
+  }
+  
+  /**
+   * Returns the names of all projects in the workspace which support the given Web service client 
+   * implementation type and Web service runtime.
+   * 
+   * @param typeId id of a Web service client implementation type
+   * @param runtimeId id of a Web service runtime
+   * @return String[] array of project names. The array may have 0 elements.
+   */
+  public static String[] getProjectsForClientTypeAndRuntime(String typeId, String runtimeId)
+  {
+    IProject[] projects = FacetUtils.getAllProjects();
+    ArrayList validProjects = new ArrayList();
+    
+    for (int i=0; i<projects.length;i++)
+    {
+      if (doesClientTypeAndRuntimeSupportProject(typeId, runtimeId, projects[i].getName()))
+      {
+        validProjects.add(projects[i].getName());        
+      }      
+    }
+    
+    return (String[])validProjects.toArray(new String[0]);
+    
+  }  
+  
+  /**
+   * Returns whether or not the given project supports the given Web service client implementation type 
+   * and Web service runtime.
+   * 
+   * @param typeId id of a Web service client implementation type
+   * @param runtimeId id of a Web service runtime
+   * @param projectName name of an IProject in the workspace
+   * @return boolean <code>true</code> if the project supports the given Web service type and 
+   * Web service runtime. Returns <code>false</code>
+   * <ul> 
+   * <li>if the project does not support the given Web service client implementation type and 
+   * Web service runtime or</li>
+   * <li>if the project does not exist or</li>
+   * <li>if projectName is null or empty</li>
+   * </ul>
+   */
+  public static boolean doesClientTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName)
+  {
+    String[] descs = getClientRuntimesByType(typeId);
+    for (int j = 0; j < descs.length; j++)
+    {
+      ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[j]);
+      if (desc.getRuntime().getId().equals(runtimeId))
+      {
+        if (doesClientRuntimeSupportProject(descs[j], projectName))
+        {
+          return true;
+        }
+      }
+    }
+    
+    return false;
+    
+    
+  }  
+  
+  
+  /**
+   * Returns whether or not the given project supports the given clientRuntime.
+   * @param clientRuntimeId id of a clientRuntime
+   * @param projectName name of an IProject in the workspace
+   * @return boolean <code>true</code> if the project supports the given
+   * clientRuntime. Returns <code>false</code>
+   * <ul> 
+   * <li>if the project does not support the given clientRuntime or</li>
+   * <li>if the project does not exist or</li>
+   * <li>if projectName is null or empty</li>
+   * </ul>
+   */
+  public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName)
+  {
+    FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(true, clientRuntimeId, projectName);
+    if (fm != null)
+    {
+      return fm.isMatch();
+    }
+    else
+    {
+      return false;
+    }
+  }
+  
+  //Utilities used by the ServerRuntimePreferencePage
+  
+  private static SelectionListChoices serverToRuntimeToJ2EE_;
+  private static Hashtable serverFactoryIdByLabel_;
+  private static Hashtable runtimeIdByLabel_;
+  
+  /**
+   * Returns the {@link SelectionListChoices} data structure representing the 
+   * server type > Web service runtime > J2EE cascading lists .
+   * {@link SelectionListChoices} is a data structure  which is like a cascading
+   * set of lists useful for populating a group of combo boxes in which the 
+   * selection in a given combo box determines the list of items used to populate
+   * the combo box below it. The Server Runtime preference page contains two combo
+   * boxes: one for server types and, below it, one for Web service runtimes.
+   * The server type combo box is meant to contain the list of all available server types
+   * that support at least one Web service runtime on either the client or service side. 
+   * The Web service runtime combo box is meant to contain the subset of Web service runtimes
+   * supported by the server type selected in the server type combo box.
+   * The SelectionListChoices returned by this method has three lists: server types, Web service runtimes,
+   * and J2EE levels. The first two lists correspond to the combo boxes on the preference
+   * page and are used to populate them. The J2EE levels list is a historical remnant from
+   * when J2EE levels used to be displayed on the preference page. It remains in this 
+   * data structure with some hard-coded values but is not rendered to the user. 
+   * 
+   * @return SelectionListChoices representing the server type > Web service runtime > J2EE cascading lists
+   */
+  public static SelectionListChoices getServerToRuntimeToJ2EE()
+  {
+    if (serverToRuntimeToJ2EE_!=null)
+    {
+      return serverToRuntimeToJ2EE_;
+    }
+    
+    //TODO (see bug 116025): Instead of all server type ids, we should be calculating the set of server
+    //types that support at least one Web service runtime on either the client or service side.
+    //Getting all server types for now.
+    String[] servers = getAllServerFactoryIds();
+    
+    SelectionList serversList = new SelectionList(servers, 0);
+    Vector choices = new Vector();
+    for (int i=0; i<servers.length; i++)
+    {
+      choices.add(getRuntimeChoices(servers[i]));
+    }
+    serverToRuntimeToJ2EE_ = new SelectionListChoices(serversList, choices);
+    return serverToRuntimeToJ2EE_;
+    
+  }
+
+  private static SelectionListChoices getRuntimeChoices(String serverFactoryId)
+  {
+	//TODO (see bug 116025): Instead of all Web service runtimes, we should be 
+	//calculating the subset of Web service runtimes supported by the server type
+	//with id equal to serverFactoryId. Getting all the Web service runtimes for now.
+    Set runtimes = registry.runtimes_.keySet();
+    Iterator itr = registry.runtimes_.keySet().iterator();
+    String[] runtimeIds = new String[runtimes.size()];    
+    int i = 0;
+    while (itr.hasNext())
+    {
+      String runtimeId = (String)itr.next();
+      runtimeIds[i] = runtimeId;
+      i++;     
+    }
+
+    SelectionList runtimesList = new SelectionList(runtimeIds, 0);
+    Vector choices = new Vector();
+    for (int j=0; j<runtimeIds.length; j++)
+    {
+      choices.add(getJ2EEChoices(runtimeIds[j]));
+    }
+    return new SelectionListChoices(runtimesList, choices);    
+  }  
+  
+  private static SelectionListChoices getJ2EEChoices(String runtimeId)
+  {
+    //J2EE levels have been removed from the Server Runtime preference page.
+    //Return some hard coded values. These will not be rendered on the preference page.
+    String[] j2eeVersions = new String[]{"13", "14"};
+    SelectionList j2eeVersionsList = new SelectionList(j2eeVersions, 0);
+    return new SelectionListChoices(j2eeVersionsList, null);        
+  }  
+  
+  private static String[] getAllServerFactoryIds()
+  {
+    //TODO (see bug 116025): Instead of all server type ids, we should be calculating the set of server
+	//types that support at least one Web service runtime on either the client or service side.
+	//Return all server type ids for now.
+    ArrayList ids = new ArrayList();
+    if (serverFactoryIdByLabel_ == null)
+    {
+      serverFactoryIdByLabel_ = new Hashtable();
+      IServerType[] serverTypes = ServerCore.getServerTypes();
+      for (int i=0; i<serverTypes.length; i++)
+      {
+        String id = serverTypes[i].getId();
+        String label = getServerLabelById(id);
+        serverFactoryIdByLabel_.put(label, id);
+        ids.add(id);
+      }    
+    }
+    else
+    {
+      Iterator fids =  serverFactoryIdByLabel_.values().iterator();
+      while (fids.hasNext())
+      {
+        String fid = (String)fids.next();
+        ids.add(fid);
+      }           
+    }
+    
+    if (ids.size() > 0)
+    {
+      String[] serverFactoryIds = (String[])ids.toArray(new String[0]);
+      return serverFactoryIds;
+    }
+    
+    return null;
+  }  
+    
+  /**
+   * Returns a server type id given the server type's label
+   * @param label server type label
+   * @return server type id or null if no server type with the given 
+   * label is found.
+   */
+  public static String getServerFactoryId(String label)
+  {
+    if (label==null || label.length()==0)
+      return null;
+    
+    if (serverFactoryIdByLabel_ == null)
+    {
+      getAllServerFactoryIds();
+    }
+    
+    if (serverFactoryIdByLabel_.containsKey(label))
+    {
+      return (String)serverFactoryIdByLabel_.get(label);  
+    }
+    else
+    {
+      return null;
+    }       
+  }  
+  
+  /**
+   * Returns a Web service runtime's id given its label 
+   * @param label Web service runtime label
+   * @return Web service runtime id or null if no
+   * Web service runtime with the given label is found.
+   */
+  public static String getRuntimeId(String label)
+  {
+    
+    if (label==null || label.length()==0)
+      return null;
+    
+    if (runtimeIdByLabel_ == null)
+    {
+      runtimeIdByLabel_ = new Hashtable();
+      Iterator iter = registry.runtimes_.values().iterator();
+      while (iter.hasNext())
+      {
+        RuntimeDescriptor desc = (RuntimeDescriptor)iter.next();
+        runtimeIdByLabel_.put(desc.getLabel(), desc.getId());        
+      }      
+    }
+    
+    return (String)runtimeIdByLabel_.get(label);    
+  }    
+  
+    
+  /**
+   * Returns a set of facet runtimes that support the given
+   * required facet versions.
+   * @param requiredFacetVersions an array containing elements of type {@link RequiredFacetVersion}
+   * @return Set set of facet runtimes that support the given required facet versions.
+   * (element type: {@link IRuntime}) 
+   */
+  private static Set getRuntimes(RequiredFacetVersion[] requiredFacetVersions)
+  {
+    return FacetUtils.getRuntimes(requiredFacetVersions);
+  }
+}
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.creation.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..851a68f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.creation.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,48 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %PLUGIN_NAME
+Bundle-SymbolicName: org.eclipse.jst.ws.creation.ui; singleton:=true
+Bundle-Version: 1.0.105.qualifier
+Bundle-Activator: org.eclipse.jst.ws.internal.creation.ui.plugin.WebServiceCreationUIPlugin
+Bundle-Vendor: %PLUGIN_PROVIDER
+Bundle-Localization: plugin
+Export-Package: org.eclipse.jst.ws.internal.creation.ui;x-internal:=true,
+ org.eclipse.jst.ws.internal.creation.ui.ant;x-internal:=true,
+ org.eclipse.jst.ws.internal.creation.ui.extension;x-internal:=true,
+ org.eclipse.jst.ws.internal.creation.ui.plugin;x-internal:=true,
+ org.eclipse.jst.ws.internal.creation.ui.preferences;x-internal:=true,
+ org.eclipse.jst.ws.internal.creation.ui.server;x-internal:=true,
+ org.eclipse.jst.ws.internal.creation.ui.widgets;x-internal:=true,
+ org.eclipse.jst.ws.internal.creation.ui.widgets.binding;x-internal:=true,
+ org.eclipse.jst.ws.internal.creation.ui.widgets.runtime;x-internal:=true,
+ org.eclipse.jst.ws.internal.creation.ui.widgets.test;x-internal:=true
+Require-Bundle: org.eclipse.wst.command.env;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.wst.command.env.ui;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.wst.command.env.core;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.wst.wsdl;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.wst.ws;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.wst.ws.explorer;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.jst.ws;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.jst.ws.consumption;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.wst.ws.parser;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.jst.ws.ui;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.jst.ws.consumption.ui;bundle-version="[1.0.101,1.1.0)",
+ org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,3.3.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,3.3.0)",
+ org.eclipse.emf.common;bundle-version="[2.2.0,2.3.0)",
+ org.eclipse.jem.util;bundle-version="[1.2.0,1.3.0)",
+ org.eclipse.jem.workbench;bundle-version="[1.2.0,1.3.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.102,1.1.0)",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.core;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.ejb;bundle-version="[1.1.0,1.2.0)",
+ org.wsdl4j;bundle-version="[1.4.0,1.5.0)",
+ org.eclipse.wst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.environment;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.wst.common.project.facet.core;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.ui.forms;bundle-version="[3.2.0,3.3.0)",
+ org.eclipse.wst.ws.ui;bundle-version="[1.0.103,1.1.0)"
+Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceDevelopCommand.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceDevelopCommand.java
new file mode 100644
index 0000000..e243a3d
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceDevelopCommand.java
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060131 121071   rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060516   126965 kathy@ca.ibm.com - Kathy Chan
+ * 20060529   141422 kathy@ca.ibm.com - Kathy Chan
+ * 20070123   167487 makandre@ca.ibm.com - Andrew Mak
+ * 20070403   173654 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+
+package org.eclipse.jst.ws.internal.creation.ui.extension;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.ws.internal.consumption.command.common.CreateFacetedProjectCommand;
+import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
+import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
+import org.eclipse.wst.common.environment.IEnvironment;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.ws.internal.common.HTTPUtility;
+import org.eclipse.wst.ws.internal.wsrt.IContext;
+import org.eclipse.wst.ws.internal.wsrt.ISelection;
+import org.eclipse.wst.ws.internal.wsrt.IWebService;
+import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime;
+import org.eclipse.wst.ws.internal.wsrt.SimpleContext;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceState;
+
+public class PreServiceDevelopCommand extends AbstractDataModelOperation 
+{
+  private TypeRuntimeServer typeRuntimeServer_;
+  private String            serviceRuntimeId_;
+  private IContext          context_;
+  private ISelection        selection_;
+  private String			project_;
+  private String            module_;
+  private String			moduleType_;
+  private String			earProject_;
+  private String            ear_;
+	
+  private IWebService       webService_;
+  private String            j2eeLevel_;
+  private ResourceContext   resourceContext_;
+  
+  private boolean develop_;
+  private boolean assemble_;
+  private boolean deploy_;
+  private boolean install_;
+  private boolean run_;
+  private boolean client_;
+  private boolean test_;
+  private boolean publish_;
+  
+
+  public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
+  {
+	  IStatus status = Status.OK_STATUS;
+	  if (develop_) {
+		  IEnvironment environment = getEnvironment();
+
+		  // Split up the project and module
+		  int index = module_.indexOf("/");
+		  if (index!=-1){
+			  project_ = module_.substring(0,index);
+			  module_ = module_.substring(index+1);
+		  }
+
+		  if (ear_!=null && ear_.length()>0)
+		  {
+			  int earIndex = ear_.indexOf("/");
+			  if (earIndex!=-1) {
+				  earProject_ = ear_.substring(0,earIndex);
+				  ear_ = ear_.substring(earIndex+1);
+			  }
+		  }
+
+
+		  IWebServiceRuntime wsrt   = WebServiceRuntimeExtensionUtils2.getServiceRuntime( serviceRuntimeId_ );
+		  WebServiceInfo     wsInfo = new WebServiceInfo();
+
+		  wsInfo.setServerFactoryId( typeRuntimeServer_.getServerId() );
+		  wsInfo.setServerInstanceId( typeRuntimeServer_.getServerInstanceId());
+		  wsInfo.setState( WebServiceState.UNKNOWN_LITERAL );
+		  wsInfo.setWebServiceRuntimeId( typeRuntimeServer_.getRuntimeId() );
+
+		  webService_  = wsrt.getWebService( wsInfo );
+
+		  //Set up the IContext
+		  WebServiceScenario scenario = null;
+		  int scenarioInt = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(typeRuntimeServer_.getTypeId());
+		  if (scenarioInt == WebServiceScenario.BOTTOMUP)
+		  {
+			  scenario = WebServiceScenario.BOTTOMUP_LITERAL;
+			  String impl = (String)(selection_.getSelection())[0];
+			  wsInfo.setImplURL(impl);
+		  }
+		  else if (scenarioInt == WebServiceScenario.TOPDOWN)
+		  {
+			  scenario = WebServiceScenario.TOPDOWN_LITERAL;
+			  String wsdlURL = (String)(selection_.getSelection())[0];
+			  
+			  // check for redirection in the wsdl
+			  HTTPUtility httpUtil = new HTTPUtility();
+			  wsInfo.setWsdlURL(httpUtil.handleRedirect(wsdlURL));      
+		  }
+
+		  context_     = new SimpleContext(develop_, assemble_, deploy_, install_, run_, client_, test_, publish_, 
+				  scenario, 
+				  resourceContext_.isOverwriteFilesEnabled(),
+				  resourceContext_.isCreateFoldersEnabled(),
+				  resourceContext_.isCheckoutFilesEnabled());
+
+		  // Create the service module if needed.
+		  IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(project_);
+		  RequiredFacetVersion[] rfv = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimeId_).getRequiredFacetVersions();
+		  if (!project.exists())
+		  {
+			  boolean matches = WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportTemplate(serviceRuntimeId_, moduleType_);
+			  if (matches)
+			  {				  
+				  CreateFacetedProjectCommand command = new CreateFacetedProjectCommand();
+				  command.setProjectName(project_);
+				  command.setTemplateId(moduleType_);
+				  command.setRequiredFacetVersions(rfv);
+				  command.setServerFactoryId(typeRuntimeServer_.getServerId());
+				  command.setServerInstanceId(typeRuntimeServer_.getServerInstanceId());
+				  status = command.execute( monitor, adaptable );
+				  if (status.getSeverity() == Status.ERROR)
+				  {
+					  environment.getStatusHandler().reportError( status );
+					  return status;
+				  }        
+			  }            
+		  } else {
+			// add facets required by Web service runtime
+		        if (rfv.length != 0) {
+		        	status = FacetUtils.addRequiredFacetsToProject(project, rfv, monitor);
+		        	if (status.getSeverity() == Status.ERROR)
+		        	{
+		        		environment.getStatusHandler().reportError( status );
+		        		return status;
+		        	}      
+		        }
+		  }
+	  }
+	  return status;
+
+  }
+  
+  public void setServiceTypeRuntimeServer( TypeRuntimeServer typeRuntimeServer )
+  {
+	  typeRuntimeServer_ = typeRuntimeServer;  
+  }
+  
+  public void setServiceRuntimeId(String id)
+  {
+    serviceRuntimeId_ = id;
+  }
+	  
+  public void setServiceJ2EEVersion( String j2eeLevel )
+  {
+	j2eeLevel_ = j2eeLevel;  
+  }
+  
+  public String getJ2eeLevel()
+  {
+	  return j2eeLevel_;  
+  }
+	
+  public IWebService getWebService()
+  {
+	return webService_;  
+  }
+  
+  public IContext getContext()
+  {
+    return context_;
+  }
+  
+  public void setResourceContext( ResourceContext resourceContext )
+  {
+    resourceContext_ = resourceContext;	  
+  }
+  
+  public ISelection getSelection()
+  {
+    return selection_;	  
+  }
+  
+  public void setSelection( ISelection selection )
+  {
+	selection_ = selection;  
+  }
+  
+  public String getProject()
+  {
+    return project_;	  
+  }
+	 
+  public String getModule()
+  {
+    return module_;	  
+  }
+	
+  public void setModule( String module )
+  {
+	  module_ = module;
+  }
+  
+  public void setModuleType(String type)
+  {
+	  moduleType_ = type;
+  }
+	
+  public String getEarProject()
+  {
+    return earProject_;	  
+  }
+	
+  public String getEar()
+  {
+	  return ear_;  
+  }
+  
+  public void setEar( String ear )
+  {
+	  ear_ = ear;  
+  }
+  
+  public void setInstallService(boolean installService)
+	{
+		install_ = installService;
+	}
+
+	public void setDevelopService(boolean developService) {
+		develop_ = developService;
+	}	
+	
+	public void setAssembleService(boolean assembleService) {
+		assemble_ = assembleService;
+	}
+
+	public void setDeployService(boolean deployService) {
+		deploy_ = deployService;
+	}
+  
+	public void setStartService(boolean startService)
+	{
+		run_ = startService;
+	}
+	
+	public void setTestService(boolean testService)
+	{
+		test_ = testService;
+	}	
+	
+  public void setPublishService(boolean publishService)
+  {
+    publish_ = publishService;
+  }
+	
+  public void setGenerateProxy(boolean genProxy)
+  {
+    client_ = genProxy;  
+  }	
+	
+
+}
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java
new file mode 100644
index 0000000..a5861e7
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060524   142635 gilberta@ca.ibm.com - Gilbert Andrews
+ * 20060529   141422 kathy@ca.ibm.com - Kathy Chan
+ * 20070327   172339 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.creation.ui.widgets;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetDefaultingCommand;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.context.ScenarioContext;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.wst.ws.internal.ui.utils.AdapterUtils;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+
+public class ServerWizardWidgetDefaultingCommand extends ClientWizardWidgetDefaultingCommand
+{    
+  private TypeRuntimeServer typeRuntimeServer_;
+  private IStructuredSelection initialSelection_;
+  private int serviceGeneration_;
+  private boolean developService_;
+  private boolean assembleService_;
+  private boolean deployService_;
+  
+  public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
+  {    
+  
+    String type      = getScenarioContext().getWebServiceType();
+    String runtime   = WebServiceRuntimeExtensionUtils2.getDefaultRuntimeValueFor( type );
+	
+    String factoryID = WebServiceRuntimeExtensionUtils2.getDefaultServerValueFor(type);    
+    typeRuntimeServer_ = new TypeRuntimeServer();
+    
+    typeRuntimeServer_.setTypeId( type );
+    typeRuntimeServer_.setRuntimeId( runtime );
+    typeRuntimeServer_.setServerId( factoryID );
+    
+    //Default the typeId from the initial selection
+    String[] typeIds = WebServiceRuntimeExtensionUtils2.getWebServiceTypeBySelection(initialSelection_);
+
+    if (typeIds!=null && typeIds.length>0)
+    {
+      typeRuntimeServer_.setTypeId(typeIds[0]);
+  } else {
+	  if (initialSelection_ != null && !initialSelection_.isEmpty())
+	  { 
+		  Object initialObject = initialSelection_.getFirstElement(); 
+		  // initialObject would not be null since !initialSelection_.isEmpty()
+		  Object adaptedObject = AdapterUtils.getAdaptedObject(initialObject);
+		  if (adaptedObject != null) {
+			  StringBuffer entrybuff = new StringBuffer();
+			  entrybuff.append(String.valueOf(WebServiceScenario.TOPDOWN));
+			  entrybuff.append("/");
+			  entrybuff.append("org.eclipse.jst.ws.wsImpl.java");
+			  String entry = entrybuff.toString();     
+			  typeRuntimeServer_.setTypeId(entry);
+		  }
+	  }
+  }
+    
+    serviceGeneration_ = getScenarioContext().getGenerateWebService();
+    	
+	developService_ = serviceGeneration_ <= ScenarioContext.WS_DEVELOP;
+	assembleService_ = serviceGeneration_ <= ScenarioContext.WS_ASSEMBLE;
+	deployService_ = serviceGeneration_ <= ScenarioContext.WS_DEPLOY;
+    
+	defaultClientScale();
+	
+    return Status.OK_STATUS;
+  }
+  
+  public void setInitialSelection(IStructuredSelection selection)
+  {
+    initialSelection_ = selection;
+  }
+  
+  public IStructuredSelection getInitialSelection()
+  {
+    return initialSelection_ ;
+  }
+  
+  IProject project_;  
+  
+  public IProject getInitialProject()
+  {
+	  if (project_==null)
+	  {
+	    project_ = getProjectFromObjectSelection(initialSelection_);
+	  }  
+	  
+	  return project_;
+  }
+  
+  private IProject getProjectFromObjectSelection(IStructuredSelection selection)
+  {
+    if (selection != null && selection.size() == 1)
+    {
+      Object obj = selection.getFirstElement();
+      if (obj != null) 
+      {
+        try
+        { 
+          IResource resource = ResourceUtils.getResourceFromSelection(obj);
+          if (resource==null) 
+            return null;
+          IProject p = ResourceUtils.getProjectOf(resource.getFullPath());
+          return p;
+        } catch(CoreException e)
+        {
+          return null;
+        }        
+      }
+    }
+    return null;
+  }
+  
+  public TypeRuntimeServer getServiceTypeRuntimeServer()
+  { 
+    return typeRuntimeServer_;
+  }
+
+  public Boolean getInstallService()
+  {
+    return new Boolean( getScenarioContext().getInstallWebService() );  
+  }
+  
+  public Boolean getStartService()
+  {
+    return new Boolean( getScenarioContext().getStartWebService() );  
+  }
+  
+  public Boolean getTestService()
+  {
+    return new Boolean( getScenarioContext().getTestWebService() );  
+  }
+  
+  public Boolean getPublishService()
+  {
+    return new Boolean( getScenarioContext().getLaunchWebServiceExplorer() );
+  }
+
+  public Boolean getGenerateProxy()
+  {
+    return new Boolean( getScenarioContext().getGenerateProxy() );  
+  }
+  
+  public boolean getRunTestClient()
+  {
+    return  getScenarioContext().isLaunchSampleEnabled();  
+  }
+  
+  public Boolean getMonitorService()
+  {
+    return new Boolean(getScenarioContext().getMonitorWebService());
+  }
+  
+  public int getServiceGeneration()
+  {
+	  return serviceGeneration_;
+  }
+  
+  public int getClientGeneration()
+  {
+	  return getScenarioContext().getGenerateClient();
+  }
+  
+  public boolean getDevelopService() {
+	  return developService_;
+  }
+  
+  public boolean getAssembleService() {
+	  return assembleService_;
+  }
+  
+  public boolean getDeployService() {
+	  return deployService_;
+  }
+  
+}
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java
new file mode 100644
index 0000000..90a8f52
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java
@@ -0,0 +1,622 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug      Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060131 121071   rsinha@ca.ibm.com - Rupam Kuehner     
+ * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060227   124392 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060315   131963 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060418   129688 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060427   126780 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060427   138058 joan@ca.ibm.com - Joan Haggarty
+ * 20060523   133714 joan@ca.ibm.com - Joan Haggarty
+ * 20060525   143843 joan@ca.ibm.com - Joan Haggarty
+ * 20060905   156230 kathy@ca.ibm.com - Kathy Chan, Handling projects with no target runtime
+ * 20070319	  159458 mahutch@ca.ibm.com - Mark Hutchinson added in some null checks
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.creation.ui.widgets.runtime;
+
+import java.util.ArrayList;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.common.ServerUtils;
+import org.eclipse.jst.ws.internal.consumption.common.FacetMatcher;
+import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
+import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
+import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.common.DefaultingUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
+import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext;
+import org.eclipse.jst.ws.internal.consumption.ui.preferences.ProjectTopologyContext;
+import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidgetDefaultingCommand;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.FacetMatchCache;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.eclipse.wst.common.environment.IEnvironment;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
+
+public class ServerRuntimeSelectionWidgetDefaultingCommand extends ClientRuntimeSelectionWidgetDefaultingCommand
+{	
+  private boolean           generateProxy_=true; //jvh
+  
+  private TypeRuntimeServer serviceIds_;
+  private boolean serviceIdsFixed_ = false;
+  private String serviceRuntimeId_;
+  private String serviceProjectName_;
+  private String serviceEarProjectName_;
+  private String serviceComponentType_;
+  private IProject initialProject_;
+  private boolean serviceNeedEAR_ = true;
+  private FacetMatcher serviceFacetMatcher_;
+
+  public ServerRuntimeSelectionWidgetDefaultingCommand()
+  {
+    super();
+  }
+  
+  
+  /**
+   * Defaults the following bits of information in the following order:
+   * serviceRuntimeId_ : the serviceRuntimeId. Must be defaulted to non-empty String.
+   * serviceIds_.runtimeId_: the Web service runtime id. Must be defaulted to non-empty String.
+   * serviceProjectName_ : the name of the service project. Must be non-empty. May or may not exist.
+   * serviceComponentType_: the id of the service project template. Must be empty if the service
+   *                        project exists. Must be non-empty of the service project does not exist.
+   * serviceIds_.serverId_: the server type id. May be an empty String if the defaulted Web service runtime
+   *                        does not require a server.
+   * serviceIds_.serverInstanceId_: the server id. May be null or an empty String.
+   * serviceNeedEAR_: true if an EAR is needed. False otherwise.
+   * serviceEarProjectName_: the service EAR project. Must be empty if the serviceNeedEAR_ is false.
+   *                         Must be non-empty if the serviceNeedEAR_ is true.
+   * Defaults the parallel information on the client-side if needed 
+   * (@see ClientRuntimeSelectionWidgetDefaultingCommand#execute).                                                 
+   */
+  public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
+  {    
+    IEnvironment env = getEnvironment();
+    
+    try
+    {    	
+     
+     //**Step 1** Default the serviceRuntime and the Web service runtime.
+     //serviceIdsFixed_ is set to true for the Ant scenario. It's always false for the wizard
+     //scenarios.    	
+     if (serviceIdsFixed_)
+     {
+       //Set the serviceRuntime based on the runtime and server.
+       //If user set a service project use that as initial project otherwise default from initial selection.
+    	 if (serviceProjectName_ != null) 
+    	 {
+    		 initialProject_ = ResourcesPlugin.getWorkspace().getRoot().getProject(serviceProjectName_);
+    		 
+    		 DefaultRuntimeTriplet drt = getDefaultRuntime(initialProject_, serviceIds_.getTypeId(), false);
+             serviceFacetMatcher_ = drt.getFacetMatcher();
+    	     serviceProjectName_ = drt.getProjectName();
+    	     serviceRuntimeId_ = drt.getRuntimeId();       
+
+    	       if (serviceRuntimeId_ != null)
+    	       {
+    	    	   serviceIds_.setRuntimeId(WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimeId_).getRuntime()
+    	      	         .getId());
+    	       }
+    	 }
+    	 else
+    	 {
+    		 DefaultRuntimeTriplet drt = getDefaultServiceRuntimeForFixedRuntimeAndServer(initialProject_);  
+    	     serviceFacetMatcher_ = drt.getFacetMatcher();
+    	     serviceProjectName_ = drt.getProjectName();
+    	     serviceRuntimeId_ = drt.getRuntimeId();	 
+    	 }   
+     }
+     else
+     {
+       // Set the runtime based on the initial selection
+       DefaultRuntimeTriplet drt = getDefaultRuntime(initialProject_, serviceIds_.getTypeId(), false);
+       serviceFacetMatcher_ = drt.getFacetMatcher();
+       serviceProjectName_ = drt.getProjectName();
+       serviceRuntimeId_ = drt.getRuntimeId();       
+
+       if (serviceRuntimeId_ != null)
+       {
+    	   serviceIds_.setRuntimeId(WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimeId_).getRuntime()
+    		         .getId()); 
+       } 
+     }
+     
+     //**Step 2** Default the service project if it was not already defaulted 
+     //as part of defaulting the Web service runtime.
+     if (serviceProjectName_ == null)
+     {
+       // Project name did not get set when the runtime was set, so set it now
+       serviceProjectName_ = getDefaultServiceProjectName();
+     }
+
+     //**Step 3** Default the service project type.
+     IProject serviceProject = ResourcesPlugin.getWorkspace().getRoot().getProject(serviceProjectName_); 
+     if (!serviceProject.exists())
+     {
+       // Set the project template
+       serviceComponentType_ = getDefaultServiceProjectTemplate();
+     }
+     else
+     {
+       //Set it to an empty String
+       serviceComponentType_ = "";
+     }
+     //**Step 4** Default the server if this is not an Ant scenario.
+     if (!serviceIdsFixed_)
+     {
+       // Set the server
+       IStatus serverStatus = setServiceDefaultServer();
+       if (serverStatus.getSeverity() == Status.ERROR)
+       {
+         env.getStatusHandler().reportError(serverStatus);
+         return serverStatus;
+       }
+     }
+     
+     //**Step 5** Default clientNeedEAR and client EAR if an EAR is needed
+     setDefaultServiceEarProject();
+     
+     // jvh - for now comment out generate proxy
+     //   need to look at defaulting based on an event
+     //    on page 1 - when client generation goes from none
+     //    to develop...
+     /*if (generateProxy_)
+     {*/
+    	 //Default the client-side.
+    	 IStatus clientSideStatus = defaultClientSide(monitor);
+         if (clientSideStatus.getSeverity() == Status.ERROR)
+         {
+           return clientSideStatus;
+         }                  
+    // }
+          
+     return Status.OK_STATUS;
+     
+    } catch (Exception e)
+    {
+      // Catch all Exceptions in order to give some feedback to the user
+      IStatus errorStatus = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_ERROR_TASK_EXCEPTED,
+          new String[] { e.getMessage() }), e);
+      env.getStatusHandler().reportError(errorStatus);
+      return errorStatus;
+    }
+  }
+
+  private IStatus defaultClientSide(IProgressMonitor monitor)
+  {
+    IStatus clientDefaultFromServiceStatus = defaultClientSideFromServiceSide(serviceProjectName_, serviceIds_, serviceNeedEAR_, serviceEarProjectName_);
+
+    // If an error status is returned, the only property that was set on 
+    // ClientRuntimeSelectionWidgetDefaultingCommand is clientProjectName_. 
+    // The rest of the properties including clientRuntimeId_, clientComponentType_, 
+    // all the values in clientIds_, clientNeedEAR_, and clientEarProjectName_ 
+    // have not been set because the service side server and
+    // web service runtime could not be used on the client side. Run the entire
+    // client-side defaulting algorithm using clientProjectName_ as the 
+    // clientInitialProject_. Then update the clientEarProjectName_ based on the
+    // service side EAR.
+    if (clientDefaultFromServiceStatus.getSeverity() == IStatus.ERROR)
+    {
+      // 1. Run client side defaulting from scratch with clientInitialProject_
+      // set to the new clientProjectName_.
+      IProject clientProject = ResourcesPlugin.getWorkspace().getRoot().getProject(getClientProjectName());
+      setClientInitialProject(clientProject);
+      IStatus clientExecuteStatus = super.execute(monitor, null);
+      if (clientExecuteStatus.getSeverity() == Status.ERROR)
+      {
+        return clientExecuteStatus;
+      }
+
+      // 2. Update the client-side EAR if serviceNeedEAR_ is true;
+      if (serviceNeedEAR_)
+      {
+        defaultClientEarFromServiceEar(serviceProjectName_, serviceEarProjectName_);
+      }
+    }
+    
+    return Status.OK_STATUS;
+	  
+  }
+  
+  private void setDefaultServiceEarProject()
+  {
+    //Don't need an ear if this is a Java project, or if the selected template is jst.utility
+    IProject serviceProject = ResourcesPlugin.getWorkspace().getRoot().getProject(serviceProjectName_);
+    if (serviceProject.exists())
+    {
+      serviceNeedEAR_ = !(FacetUtils.isJavaProject(serviceProject));
+    }
+    else
+    {
+      serviceNeedEAR_ = !(FacetUtils.isUtilityTemplate(serviceComponentType_));  
+    }    
+    
+    //If serviceNeedEAR_ is still true, it means that we're not dealing with a Java project
+    //or Java project type. Check the server.
+    
+    
+    if (serviceNeedEAR_)
+    {
+      
+      // Determine if an ear selection is needed based on the server type.      
+      String serverId = serviceIds_.getServerId();
+      if (serverId != null)
+      {
+        // Use the server type
+        String serverTargetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverId);
+        if (serverTargetId != null && serverTargetId.length() > 0)
+        {
+          if (!ServerUtils.isTargetValidForEAR(serverTargetId, "13"))
+          {
+            // Default the EAR selection to be empty
+            serviceNeedEAR_ = false;
+          }
+        }
+      } else { // serverId == null, assume that it does not need EAR
+    	  serviceNeedEAR_ = false;
+      }
+    }
+    
+    if (serviceNeedEAR_)
+    {
+      serviceEarProjectName_ = DefaultingUtils.getDefaultEARProjectName(serviceProjectName_);
+    }
+    else
+    {
+      serviceEarProjectName_ = "";
+    }   
+  }
+  
+  private IStatus setServiceDefaultServer()
+  {
+    //Choose an existing server the module is already associated with if possible
+    IProject serviceProject = ResourcesPlugin.getWorkspace().getRoot().getProject(serviceProjectName_);
+    IServer[] configuredServers = ServerUtil.getServersByModule(ServerUtils.getModule(serviceProject), null);
+    if (configuredServers!=null && configuredServers.length>0)
+    {
+      serviceIds_.setServerId(configuredServers[0].getServerType().getId());
+      serviceIds_.setServerInstanceId(configuredServers[0].getId());
+      return Status.OK_STATUS;              
+    }
+    
+    //If the project exists, choose a suitable server or server type based on the existing project's runtime or facets
+    if (serviceProject.exists())
+    {
+      IServer server = getServerFromProject(serviceProjectName_, serviceFacetMatcher_);
+      if (server != null)
+      {
+        serviceIds_.setServerId(server.getServerType().getId());
+        serviceIds_.setServerInstanceId(server.getId());
+        return Status.OK_STATUS;
+      }
+      else
+      {
+        IServerType serverType = getServerTypeFromProject(serviceProjectName_, serviceFacetMatcher_);
+        if (serverType != null)
+        {
+          serviceIds_.setServerId(serverType.getId());
+          return Status.OK_STATUS;
+        }
+      }
+    }
+    
+    //Haven't picked a server/server type on the basis of the project. Pick a server/server type
+    //that is compatible with the serviceRuntimeId.
+    IServer server = getServerFromServiceRuntimeId();
+    if (server!=null)
+    {
+      serviceIds_.setServerId(server.getServerType().getId());
+      serviceIds_.setServerInstanceId(server.getId());
+      return Status.OK_STATUS;
+    }
+    
+    IServerType serverType = getServerTypeFromServiceRuntimeId();
+    if (serverType != null)
+    {
+      serviceIds_.setServerId(serverType.getId());
+      return Status.OK_STATUS;
+    }    
+
+    //No suitable server was found. Popup an error.
+    RuntimeDescriptor runtimeDescriptor = WebServiceRuntimeExtensionUtils2.getRuntimeById(serviceIds_.getRuntimeId());
+    if (runtimeDescriptor.getServerRequired())
+    {    
+      String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(serviceIds_.getRuntimeId());    
+      IStatus status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_ERROR_NO_SERVER_RUNTIME, new String[]{runtimeLabel}) );
+      return status;
+    }
+    
+    return Status.OK_STATUS;
+  }  
+  
+  private IServer getServerFromServiceRuntimeId()
+  {
+    IServer[] servers = ServerCore.getServers();
+    if (servers != null && servers.length > 0) 
+    {
+      PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+      String preferredServerFactoryId = context.getServerFactoryId();
+
+      //If a server of the preferred server type is present, check that one first
+      for (int j = 0; j < servers.length; j++)
+      {
+    	if (servers[j] != null && servers[j].getServerType() != null)
+    	{
+	        String serverFactoryId = servers[j].getServerType().getId();
+	        if (serverFactoryId == preferredServerFactoryId)
+	        {
+	          if (WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportServer(serviceRuntimeId_, serverFactoryId))
+	          {
+	            return servers[j];
+	          }
+	        }  
+    	}
+      }
+      
+      //A server of the preferred server type could not be found or did not match. Check all the existing servers.    
+      for (int i = 0; i < servers.length; i++)
+      {
+    	if (servers[i] != null && servers[i].getServerType() != null)
+    	{
+	        String serverFactoryId = servers[i].getServerType().getId();
+	        if (WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportServer(serviceRuntimeId_, serverFactoryId))
+	        {
+	          return servers[i];
+	        }
+    	}
+      }
+    }
+    return null;    
+  }
+  
+  private IServerType getServerTypeFromServiceRuntimeId()
+  {
+    String[] serverTypes = WebServiceRuntimeExtensionUtils2.getServerFactoryIdsByServiceRuntime(serviceRuntimeId_);
+    if (serverTypes!=null && serverTypes.length>0)
+    {
+      //Return the preferred one if it is in the list
+      PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+      String preferredServerFactoryId = context.getServerFactoryId();
+      for (int i=0; i<serverTypes.length; i++)
+      {
+        if (serverTypes[i].equals(preferredServerFactoryId))
+        {
+          return ServerCore.findServerType(serverTypes[i]);
+        }
+      }
+      
+      return ServerCore.findServerType(serverTypes[0]);
+    }    
+    
+    return null;
+  }  
+  
+  
+  private String getDefaultServiceProjectTemplate()
+  {
+    String[] templates = WebServiceRuntimeExtensionUtils2.getServiceProjectTemplates(serviceIds_.getTypeId(), serviceIds_.getRuntimeId());    
+    
+    //Walk the list of service project types in the project topology preference
+    ProjectTopologyContext ptc= WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
+    String[] preferredTemplateIds = ptc.getServiceTypes();
+    for (int j = 0; j < preferredTemplateIds.length; j++)
+    {
+      for (int i = 0; i < templates.length; i++)
+      {
+        String templateId = templates[i];
+        if (templateId.equals(preferredTemplateIds[j]))
+        {
+          boolean matches = WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportTemplate(serviceRuntimeId_, templateId);
+          if (matches)
+          {
+            return templates[i];
+          }
+        }
+      }
+    }
+    
+    //Since the preferredTemplateIds contains the union of all project types for all service runtimes, we are
+    //guaranteed to have returned by now, so the code below will never be executed under normal
+    //circumstances. Just return something to satisfy the compiler.
+    if (templates.length > 0)
+      return templates[0];
+    
+    return "";    
+    
+  }  
+  
+  private String getDefaultServiceProjectName()
+  {
+    IProject[] projects = FacetUtils.getAllProjects();
+    ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimeId_);
+    RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions();
+    
+    //Check each project for compatibility with the serviceRuntime
+    for (int i=0; i<projects.length; i++)
+    {
+      Set facetVersions = FacetUtils.getFacetsForProject(projects[i].getName());
+      org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = null;
+      String fRuntimeName = null;
+      fRuntime = FacetUtils.getFacetRuntimeForProject(projects[i].getName());
+      if (fRuntime != null)
+      {
+        fRuntimeName = fRuntime.getName();        
+      }              
+      
+      if (facetVersions != null)
+      {
+        FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(false, serviceRuntimeId_, projects[i].getName());
+        boolean facetRuntimeMatches = true;
+        if (fRuntimeName != null)
+        {
+          facetRuntimeMatches = FacetUtils.isFacetRuntimeSupported(rfvs, fRuntimeName);  
+        }
+        
+        if (fm.isMatch() && facetRuntimeMatches)
+        {
+          serviceFacetMatcher_ = fm;
+          return projects[i].getName();
+        }                    
+      }
+    }
+    
+    //No project was suitable, return a new project name
+    return ResourceUtils.getDefaultWebProjectName();
+    
+  }  
+  
+  private DefaultRuntimeTriplet getDefaultServiceRuntimeForFixedRuntimeAndServer(IProject project)
+  {
+    String[] serviceRuntimes = WebServiceRuntimeExtensionUtils2.getServiceRuntimesByServiceType(serviceIds_.getTypeId());
+    ArrayList validServiceRuntimes = new ArrayList();
+    for (int i=0; i<serviceRuntimes.length; i++ )
+    {
+      ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimes[i]);
+      if (desc.getRuntime().getId().equals(serviceIds_.getRuntimeId()))
+      {
+        //Check if this service runtime supports the server
+        if (WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportServer(desc.getId(), serviceIds_.getServerId()))
+        {
+          validServiceRuntimes.add(desc.getId());
+          if (project != null && project.exists())  
+          {
+            Set facetVersions = FacetUtils.getFacetsForProject(project.getName());
+            if (facetVersions != null)
+            {
+              FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(false, serviceRuntimes[i], project.getName());
+              if (fm.isMatch())
+              {
+                DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+                drt.setFacetMatcher(fm);
+                drt.setProjectName(project.getName());
+                drt.setRuntimeId(desc.getId());
+                return drt;
+              }                      
+            }
+          }
+          
+        }
+      }
+      
+    }
+    
+    if (validServiceRuntimes.size() > 0)
+    {
+      //We couldn't match to the initially selected project so return the first valid runtime.
+      DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
+      drt.setFacetMatcher(null);
+      drt.setProjectName(null);
+      drt.setRuntimeId(((String[])validServiceRuntimes.toArray(new String[0]))[0]);
+      return drt;      
+    }
+    else
+    {
+      //There are no service runtimes that match the fixed runtime and server. Fall back to original algorithm.
+      serviceIdsFixed_ = false;
+      return getDefaultRuntime(project, serviceIds_.getTypeId(), false);
+    }
+  }
+  
+
+  
+  public void setInitialSelection(IStructuredSelection selection)
+  {
+  }
+  
+  public void setInitialProject(IProject initialProject)
+  {
+    initialProject_ = initialProject;
+  }
+  
+  public void setInitialComponentName(String name)
+  {
+    //TODO This method and any mappings to it
+	// should be removed if no longer needed.
+  }
+  
+  public void setServiceTypeRuntimeServer( TypeRuntimeServer ids )
+  {
+    serviceIds_ = ids;
+  }
+  
+  public void setServiceIdsFixed(boolean b)
+  {
+    serviceIdsFixed_ = b;  
+  }
+  
+  public TypeRuntimeServer getServiceTypeRuntimeServer()
+  {
+    return serviceIds_; 
+  }
+
+  public String getServiceRuntimeId()
+  {
+    return serviceRuntimeId_;
+  }
+  /**
+   * @return Returns the generateProxy_.
+   */
+  public boolean getGenerateProxy()
+  {
+    return generateProxy_;
+  }
+  /**
+   * @param generateProxy_ The generateProxy_ to set.
+   */
+  public void setGenerateProxy(boolean generateProxy_)
+  {
+    this.generateProxy_ = generateProxy_;
+  }
+  
+  public String getServiceProjectName()
+  {
+    return serviceProjectName_;  
+  }
+  
+  public String getServiceEarProjectName()
+  {
+    return serviceEarProjectName_;
+  }
+  
+  public String getServiceComponentType()
+  {
+    return serviceComponentType_;
+  }
+  
+  public boolean getServiceNeedEAR()
+  {
+    return serviceNeedEAR_;
+  }
+  
+  // This is for the Ant scenario where the service project name can be set in the property file.
+  // If the user has set the ServiceProjectName use it for defaulting purposes
+  public void setServiceProjectName(String name)
+  {
+	  serviceProjectName_ = name;
+  }
+  
+}