Bug 295695 - In Web Service Wizard, Server field should be cleared if Web Service type doesn't need a Server
Summary: In Web Service Wizard, Server field should be cleared if Web Service type doe...
Status: NEW
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: jst.ws (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: Future   Edit
Assignee: Project Inbox CLA
QA Contact: Keith Chong CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2009-11-20 04:55 EST by Tilak Sharma CLA
Modified: 2011-07-21 02:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tilak Sharma CLA 2009-11-20 04:55:22 EST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Build Identifier: Build id: M20090211-1700

I have contributed my custom Web Service type to the Web Service Wizard using the extension point: org.eclipse.jst.ws.consumption.ui.wsImpl.

Now in File> New > Web Service, the Web Service type lists "Bottom Up MyCustom Web Service" and "Top Down MyCustom Web Service" along with the existing Bottom Up Java Bean Web Service and Top Down Java Bean Web Service.

I have configured Tomcat server in the eclipse "Server and Runtime" preference and added Apache Tomcat in the "Runtime Environment" preference.

I have mentioned serverRequired = false in the extension point:
<extension point="org.eclipse.jst.ws.consumption.ui.runtimes">
    	<runtime id="com.custom.myWebServiceRT"
				 label="My Custom Runtime"
				 serverRequired="false"/>
    </extension>

Now when I select "Bottom Up MyCustom Web Service" as the Web Service type and  some Service implementation, "Server:" field on the first page of the Web Service wizard will be empty, because serverRequired = false.

But when I select "Bottom Up Java Bean Web Service" and "Server:" is populated with "Tomcat v5.5 Server". Now if I select "Bottom Up MyCustom Web Service"  again, "Server:" field is not cleared (is not made empty back).

Since I have configured my own runtime and Apache Tomcat doesn't support my runtime, wizard shows an  error message and user is forced to open the wizard again and select the "Bottom Up MyCustom Web Service" first and then proceed with the wizard.

So, "Server:" field should be reset to empty if the selected Web Service type doesn't need a Server.



Reproducible: Always

Steps to Reproduce:
1. Configure Tomcat server in Eclipse launch.

2. Contribute to the web service wizard using the extension point org.eclipse.jst.ws.consumption.ui.wsImpl

3. Contribute your custom runtime : <extension point="org.eclipse.jst.ws.consumption.ui.runtimes">
    	<runtime id="com.custom.myWebServiceRT"
				 label="My Custom Runtime"
				 serverRequired="false"/>
    </extension>

4. Open the Web Service Wizard from File > New > Web Service.

5. Select "Bottom Up Java Bean Web Service" and provide a Service Implementation (java class). "Server:" field will be populated with "Tomcat vX.X Server"

6. Now select "Bottom Up MyCustom Web Service" and provide a service implementation. Observe that "Server:" is still populated with previous value (Tomcat Server)

7. Observe that Wizard errors out saying Tomcat Server doesn't support My Custom Runtime.
Comment 1 Tilak Sharma CLA 2010-05-24 08:30:35 EDT
This seems to be an important issue for us. So, changing the Importance to Major.
Please let me know for which milestone this can be fixed.
Comment 2 Keith Chong CLA 2011-05-05 13:45:07 EDT
Hi Tilak, are you familiar with the code enough to complete this work?
Comment 3 Tilak Sharma CLA 2011-07-21 02:24:18 EDT
Hi Keith,

I am not sure the exact code where to put in the fix, but I tried to debug through the WTP sources and found out where the problem is:

Upon changing the Web Service type to one of my contributed type (ex: Top Down MyCustom Web Service), the setServiceTypeRuntimeServer() is called with parameter of TypeRuntimeServer object, which has the serverId_ field set to configured tomcat server id (in my case, org.eclipse.jst.server.tomcat.60).

Stack trace:
ServerRuntimeSelectionWidgetDefaultingCommand.setServiceTypeRuntimeServer(TypeRuntimeServer) line: 608	
ServerWizardWidget.refreshServerRuntimeSelection() line: 1556	
ServerWizardWidget.access$24(ServerWizardWidget) line: 1547	
ServerWizardWidget$1.widgetSelected(SelectionEvent) line: 371	

At this line (ServerWizardWidget.refreshServerRuntimeSelection() line: 1556):
TypeRuntimeServer object is retrieved by calling getServiceTypeRuntimeServer():

line 923: public TypeRuntimeServer getServiceTypeRuntimeServer() {
line 924: 		return ids_;
line 925: 	}

In the above code at line 924, ids_ object should have been reconstructed based on the web service type selected. That is, the serverId_ field should have been reset to null or empty string before returning.

That would solve the problem.