Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 243286

Summary: Wrong project defaults when switching TOP-DOWN runtimes
Product: [WebTools] WTP Webservices Reporter: Shane Clarke <shane_clarke>
Component: jst.wsAssignee: Eric Peters <ericdp>
Status: RESOLVED WONTFIX QA Contact: Keith Chong <keith.chong.ca>
Severity: major    
Priority: P3 CC: keith.chong.ca, oisin.hurley, pmoogk, shane_clarke
Version: 3.0   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Added project mapping to data mapping registry none

Description Shane Clarke CLA 2008-08-06 06:55:53 EDT
Created attachment 109293 [details]
Added project mapping to data mapping registry

Build ID: I20080617-2000

Steps To Reproduce:
1. Have two dynamic web projects in a workspace. "a" and "b".
2. Select a WSDL file in "b" and open the Web Service wizard.
3. Switch from one top-down web service type to another.

The service project defaults back to "a"

More information:
Tested against latest from HEAD 6th Aug 08.

setProject() in ServerWizardWidget isn't called when the wizard is first shown.

So when switching from one top-down web service type to another the ServerRuntimeSelectionWidgetDefaultingCommand that's created in refreshServerRuntimeSelection is seeded with an initial project of null.

This leads to the ServerRuntimeSelectionWidgetDefaultingCommand
being unable to set the runtime based on the initial selection.

So the service project name ends up being defaulted in getDefaultServiceProjectName() which is the first web service friendly project it finds in the workspace.

Adding patch.
Comment 1 Shane Clarke CLA 2008-08-06 06:59:02 EDT
Additional info:

I'm adding support for CXF in the web service wizard and i've added an additional web service type.
Comment 2 Peter Moogk CLA 2008-08-07 13:17:47 EDT
Thanks, Shane, for finding this bug.  We'll look at incorporating the fix in the V3.1 WTP release.
Comment 3 Peter Moogk CLA 2008-08-07 13:39:08 EDT
Hi Eric,
   Can you review and test Shane's patch for this defect.  Thanks.
Comment 4 Keith Chong CLA 2009-03-05 09:17:27 EST
We're tentatively targetting this fix for 3.1 M6
Comment 5 Keith Chong CLA 2009-03-17 15:51:07 EDT
Defer to 3.1 M7.
Comment 6 Eric Peters CLA 2009-04-06 12:56:31 EDT
The behavior is consistent with the existing design/paradigm that when controls which affect defaulting behavior change, the defaulting takes place again. The flow/design is consistent- the changed field is above the project field so defaulting may change the project when wsdl changes. If we were to "weight" the pre-existing project in the defaulting commands/behavior this would be a lot of change to the defaulting commands.
Comment 7 Shane Clarke CLA 2009-04-07 11:45:04 EDT
Hi Eric,

Was hoping to see this one fixed.

>the changed field is above the project field so
>defaulting may change the project when wsdl changes.

The wsdl hasn't changed though. The above scenario details a user explicitly selecting a wsdl file in project "b" and then opening the web services wizard with that selection.

If i change the Top down type after opening the web services wizard i'd expect my service project to remain as is. The initial wsdl selection is still the same, still originating from project "b".

But as the description above outlines the service project in the configuration switches back to project "a".

>The behavior is consistent with the existing design/paradigm that when controls
>which affect defaulting behavior change, the defaulting takes place again.

Given the following scenario, should i not expect to see to same behavior as before?

Environment Eclipse 3.5M6, WTP 3.1M6. Same setup as that above i.e. 
* 2 web projects "a" and "b" in your workspace.
* wsdl file in project "b"

Open the web services wizard after selecting project "a" or begin with no initial selection. Basically a weaker initial selection that the first scenario. (in any case this will result in the service project in the configuration being set to "a").

Assuming default preferences are set you should first have to switch the "Web service type" to a Top down type. Select "Top down Java bean Web Service".

Service project in the configuration is still set to "a".

Hit browse and select the wsdl file in project "b". Or you could type or paste in the path to the wsdl file into the service implementation text field.

Service project in the configuration is still set to "a".

Now switch the Top down type to another Top down type.

This time the Service project in the configuration is switched to "b".

Both scenarios use the same wsdl path and in both the Top down type was changed. 2 different outcomes.

Now the key difference is the service implementation text field was edited in scenario 2 before the top down type was changed.

But that field was initialized with the same path in scenario 1 before changing the Top down type there.

Should i not see the same result?

Thanks,
Shane