Bug 193371 - Axis2: Should browse for services.xml in workspace
Summary: Axis2: Should browse for services.xml in workspace
Status: CLOSED FIXED
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: jst.ws (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Saminda Wijeratne CLA
QA Contact: Kathy Chan CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-06-19 14:01 EDT by Kathy Chan CLA
Modified: 2008-10-27 14:36 EDT (History)
3 users (show)

See Also:


Attachments
Fix for the Bug 193371 (8.32 KB, patch)
2007-06-25 11:27 EDT, Lahiru Sandakith CLA
no flags Details | Diff
fix to browse the services.xml only in the workspace (5.15 KB, patch)
2008-05-29 04:35 EDT, Saminda Wijeratne CLA
no flags Details | Diff
fix for bug 193371 (15.89 KB, patch)
2008-06-03 06:08 EDT, Saminda Wijeratne CLA
no flags Details | Diff
fix for bug 193371 (16.18 KB, patch)
2008-06-04 00:48 EDT, Saminda Wijeratne CLA
no flags Details | Diff
services.xml (484 bytes, text/plain)
2008-06-05 16:13 EDT, Kathy Chan CLA
no flags Details
working services.xml file (484 bytes, text/xml)
2008-06-06 01:00 EDT, Saminda Wijeratne CLA
no flags Details
fix for bug 193371 (16.29 KB, patch)
2008-06-06 08:21 EDT, Saminda Wijeratne CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kathy Chan CLA 2007-06-19 14:01:21 EDT
Currently, the Browse button for "Have a services.xml" in the bottom-up Axis2 page browse into the workspace.  The normal paradigm for operations within Eclipse is to browse into the workspace only.
Comment 1 Lahiru Sandakith CLA 2007-06-25 11:27:35 EDT
Created attachment 72369 [details]
Fix for the Bug 193371

Hi Kathy , 

I have fixed the issue using the FileFolderSelectionDialog pointing it to the workspace location with the help of the EFS. I tried to use the FileSelectionDialog and found that it was deprecated. I have tested this fix.
Also I have add some additional verification of the result file that we obtain form the browse so that user will immediately get the feedback. 

Please review and commit. 

Thanks

Lahiru
Comment 2 Kathy Chan CLA 2007-08-15 14:44:51 EDT

*** This bug has been marked as a duplicate of bug 184450 ***
Comment 3 Kathy Chan CLA 2007-08-17 14:48:51 EDT
Reopening.  This defect is not a dup of 184450.
Comment 4 Kathy Chan CLA 2007-09-10 17:08:52 EDT
I took a look at the patch.  There's a few issues with it:

1. With the way you are getting the IFileStore you are proposing:

IFileStore store = EFS.getStore(new URI("file://"+root.getLocation().toOSString()));

you are only getting projects that's directly under the workapace root.  So linked projects (projects not in the default location) are not included.

2. The current patch resulted in the following exception when running on Windows:

java.net.URISyntaxException: Illegal character in authority at index 7: file://D:\eclipse33\eclipse\runtime-WTP201_0907a
	at java.net.URI$Parser.fail(URI.java:2816)
	at java.net.URI$Parser.parseAuthority(URI.java:3154)
	at java.net.URI$Parser.parseHierarchical(URI.java:3065)
	at java.net.URI$Parser.parse(URI.java:3021)
	at java.net.URI.<init>(URI.java:578)
	at org.eclipse.jst.ws.internal.axis2.creation.ui.widgets.bean.ServicesXMLSelectBeanWidget.handleBrowse(ServicesXMLSelectBeanWidget.java:236)
	at org.eclipse.jst.ws.internal.axis2.creation.ui.widgets.bean.ServicesXMLSelectBeanWidget.access$6(ServicesXMLSelectBeanWidget.java:230)
	at org.eclipse.jst.ws.internal.axis2.creation.ui.widgets.bean.ServicesXMLSelectBeanWidget$3.widgetSelected(ServicesXMLSelectBeanWidget.java:148)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)

3. Exceptions are not returned to the user.  So when the user click the Browse button, unless the user has the console log on, they just get no response and is stuck on the same page. 

Please refer to WSDLSelctionWidget.handleWSDLButton() for an example of how to browse for a particular type of file in the workspace.

Retargetting to WTP 2.0.2 since we are running out of time for WTP 2.0.1 and this defect is not high in severity.
Comment 5 Kathy Chan CLA 2008-01-25 11:17:22 EST
The current patch does not work.  Please revise and resubmit.
Comment 6 Kathy Chan CLA 2008-05-20 14:15:57 EDT
Deferring to WTP 3.0.1.
Comment 7 Saminda Wijeratne CLA 2008-05-29 04:35:16 EDT
Created attachment 102583 [details]
fix to browse the services.xml only in the workspace

hi kathy,

I'm herewith resubmitting the patch sent by lahiru sandakith with the necessary changes to work with the current source and with the your suggestion of using the DialogResourceBrowser dialog. But i had the problem of how to define the resource to it such that even the imported projects or loaded projects which are not in the workspace are shown in the dialog. current patch will only show the projects in the workspace. any suggestions how to overcome the problem?
Comment 8 Kathy Chan CLA 2008-06-02 17:27:39 EDT
Hi Saminda,

The patch you provided already takes care of finding files in linked project (projects showing up in the workspace views but the physical location is not in the workspace).  I've tried it and it works fine.

You might want to reconsider the logic of only allowing files which ends with "services.xml".  Do you really need that?  Could user have the services.xml stored in a file with other name?  If you really want to restrict the file to only be called "services.xml", your current logic would allow for a file named "newservices.xml".  Also, how about files with different cases?

Once you've revisited the logic for giving the error message, you can have Lahiru commit that to the R3_0_maintenance branch.

Also, once the patch is ready to be review and committed, please "Accept" the bug to change it to assign state.
Comment 9 Saminda Wijeratne CLA 2008-06-03 06:08:02 EDT
Created attachment 103269 [details]
fix for bug 193371

I'm attaching the patch with the requested changes for accepting services.xml file having different names. the patch will also contain services.xml validation functions which is used to determine whether the selected xml file is valid.
Comment 10 Kathy Chan CLA 2008-06-03 10:18:09 EDT
Comment on attachment 72369 [details]
Fix for the Bug 193371

Marking old patch as obsolete.
Comment 11 Kathy Chan CLA 2008-06-03 10:36:03 EDT
Hi Saminda,

With the latest patch you are proposing, you are calling servicesXMLUtils.isValidateServicesXML() in ServicesXMLSelectBeanWidget.getStatus() even when the user do not specify their own services.xml.  Also, I tried to provide a valid services.xml and the validator still returns false.  What scenarios have you tested the patch with?  Please take a look at what could be causing the problem.  

Another point is do you intent to have ServiesXMLUtils be a stateful object or just a collection of utilities that various commands can call.  If it is the latter, then the isValidateServicesXML method should be a static method that takes in the path to the services.xml.
Comment 12 Saminda Wijeratne CLA 2008-06-03 23:09:59 EDT
Hi kathy,
Can u attach the services xml file u used to test? Also i forgot to mention in the patch comment. I used the services xml file created by the axis2 plugin in another web service to test this functionality. It didn't work at first, when i tried to find why it didn't work i saw that the services.xml i gave had a "Description" tag which was not defined in the services schema. the schema only defines the "description" tag. (may be this is a bug. i'll check).after making the tag to lower case the xml was validated successfully (sorry again that i forgot to mention this). (Other tags in the services xml was according to the schema). May be this was the problem in your case also.
You are right, i think i'll move this validation to the place where user selects the the file and clicks ok. it will validate the file. if it is invalid throw a message saying that the file is not valid and show the dialog again.

yeah it is most probably the latter case. i.e. just a collection of utilities that various commands can call. I was not sure whether there would arise an occasion which would want to process the services xml and retain the data to be passed on to other operations. but hwever my intension for using it is only as a collection of utilities. I'll check with sandakith and make it static if neccessary.
Comment 13 Saminda Wijeratne CLA 2008-06-04 00:48:22 EDT
Created attachment 103491 [details]
fix for bug 193371

in this patch I've fixed the problem of where the validation is done and making the validation function static. validation will only occur when user browses a services file.
Comment 14 Kathy Chan CLA 2008-06-05 16:13:34 EDT
Created attachment 103820 [details]
services.xml

I tried attachment 103491 [details] and still have problem.

Now it does not complain when I just leave it to "generate a default services.xml".  So I go through a bottom up Axis2 scenario with converter.java from the tutorial and got a services.xml file generated.  Then when I go through the scenario a second time browsing for that same services.xml file, I got the error:

You must select a valid services.xml file.

I did not even change the services.xml file.  Here's the services.xml file that's generated by Axis2.

The testing I did before is I filled in the Description tag with some input from an existing services.xml.

Please try the scenario again.
Comment 15 Saminda Wijeratne CLA 2008-06-06 01:00:00 EDT
Created attachment 103888 [details]
working services.xml file

Hi,
I tried the attached file. yes, it does not work. it is because of the "Description" tag. as i mentioned in the earlier comment, i changed the "Description" tag to "description" (only made the Capital letter "D" to a simple letter "d"). now it works fine. the problem is not in the patch, it is in the services.xml generation process. the patch fails to identify the xml correctly because of the case sensitivity of the contents in the file services.xml. so i'm currently looking in to the services.xml generation process also to fix that. 
(i tried to find a schema validation which does not consider case-sensitivity, but couldn't find a way)

Sorry for the late reply.
Comment 16 Saminda Wijeratne CLA 2008-06-06 08:21:29 EDT
Created attachment 103931 [details]
fix for bug 193371

Hi Kathy,
Sandakith suggested a better idea. Instead of changing the ServiceXml creation process i'm changing the schema to accept the "Description" tag also. I checked it will the file u sent and it work. Check this patch with yo original services file and let me know the result.

Saminda
Comment 17 Lahiru Sandakith CLA 2008-06-09 00:01:44 EDT
assigning the issue to samindaw..
Comment 18 Lahiru Sandakith CLA 2008-06-09 02:46:05 EDT
I have reviewed and committed the latest patch to the cvs. 
Saminda, do you have any other improvements to this. If not, we can verify and close this issue.
Comment 19 Saminda Wijeratne CLA 2008-06-11 02:19:46 EDT
I tried to reproduce the issues 2 and 3 (which was mentioned after the 1st patch is put). 

The 2nd issue may not be applicable since the code which throws the exception is no longer in the patch.
The 3rd issue i'm not sure how can occur with the current patch since by clicking on browse the swt control takes over until selection of the file and there is no try catch statements used to halt any exceptions thrown after the file selection. So i need the exact scenario of hw to reproduce this if it is not relevant to the 1st patch.

Other than that i think this issue is resolved.
Comment 20 Kathy Chan CLA 2008-06-11 09:34:58 EDT
Yes.  I was able to verify that the problem is fixed with attachment 103931 [details]. Thaks for the patch!
Comment 21 Lahiru Sandakith CLA 2008-06-12 00:12:59 EDT
Great .. I verified it too with the latest code base.
Thanks 
Lahiru Sandakith. 
Comment 22 Kathy Chan CLA 2008-10-27 14:36:04 EDT
Closing.