Issue 79951 - load an OpenOffice document with webdav
Summary: load an OpenOffice document with webdav
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC All
: P3 Trivial
Target Milestone: ---
Assignee: jsc
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-24 09:54 UTC by nfrisoni
Modified: 2013-02-24 21:06 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
The dialogs when I open using File > Open (33.86 KB, image/png)
2007-07-26 17:13 UTC, pagalmes.lists
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description nfrisoni 2007-07-24 09:54:05 UTC
We are working on an integration of OpenOffice and Alfresco
(http://www.alfresco.com/), an Open Source CMS.
When trying to open an OpenOffice (2.2.0) document on a webdav server (url:
"http://myserver/webdav/myDoc.odt"), an error occured. 
	"Runtime error BASIC. 
	 Une exception s'est produite :
	 Type: com.sun.star.lang.ellegalArgumentException 
	 Message : URL seems to be an unsupported one.."
My webdav server works well, I can open document from Firefox which support
webdav protocol. 
I can open document in local (file:///C:/myDoc.odt) and on remote server
(http://myserver/myDoc.odt)

Here is the code I used in Basic: 

StarDesktop = CreateUnoService("com.sun.star.frame.Desktop")
newDoc =
StarDesktop.LoadComponentFromURL(ConvertToUrl("http://myserver/webdav/cahier.odt")
, "_blank", 0, Array())

You should be able to test the issue on the following server:
http://test.webdav.org/
Comment 1 pagalmes.lists 2007-07-24 10:27:27 UTC
I can confirm the issue on I386/Win XP.
Comment 2 jsc 2007-07-24 12:01:53 UTC
StarDesktop is an already set variable which can be used directly, you don't
have to create a Desktop

doc = StarDesktop.loadcompoinentFromUrl(...)

Anyway, i can't access a document on your test webdav server from Firefox as
well. Can you send me a working Url (at least working from Firefox) which i can
use to reproduce the issue.

Comment 3 nfrisoni 2007-07-24 13:53:28 UTC
I am looking for a webdav test environment. I am waiting an answer to use the
url I have given to you. I keep you in touch. You can try it on any webdav
server, if you have working one.
Comment 4 jsc 2007-07-25 10:11:25 UTC
i have test it on a local server (not public) which is configured as a webdav
server and it works as expected.
Comment 5 nfrisoni 2007-07-25 13:40:57 UTC
I tried with OpenOffice 2.2 and 2.04 on windows xp. I have tried with another
private webdav server, and I have the same problem.
Which version of OpenOffice do you use JSC?
Comment 6 jsc 2007-07-26 13:23:17 UTC
in my first test i used a src680 m221 but i did a second test with a StarOffice
8  update 7 which is the same as OO.org 2.2. Loading and saving works as
expected. The used webdav server was a default apache installation. I can't
reproduce your problem.
Comment 7 nfrisoni 2007-07-26 15:29:10 UTC
you can find at this url the same problem :
http://www.oooforum.org/forum/viewtopic.phtml?t=37981&view=previous
Comment 8 jsc 2007-07-26 16:05:39 UTC
well, i can't say anything else as that i can't reproduce the error with our
local server. I will do a last test with a current development build (src680m222
or 223) of OO.org tomorrow.
Comment 9 nfrisoni 2007-07-26 16:22:42 UTC
I am going to make a test environment with apache and webdav. So you could test
it on monday. 
Comment 10 jsc 2007-07-26 16:27:33 UTC
when you read all the comments on oooforum you can read as well that it works
with a different configuration. So in general webdav seems to work but depends
on the server.
Comment 11 pagalmes.lists 2007-07-26 16:40:32 UTC
Yes, it seems it depend on the server... As accessing to OOo docs in webdav with
Firefox works, I suppose that it might be something missing in OOo implementation.

What is also strange is that if I open the file using the OOo dialogs and
through: "File > Open" and then set the webdav URL. The file is opened nicely.

But if I try to load it using the OOo API with macros, it does not work.

jsc -> How did you access the webdav server? Using OOo macros or File > Open?
Comment 12 jsc 2007-07-26 16:54:21 UTC
i ran a Basic macro. 

From where did you try it? From a macro inside the office or from a remote
application? It sounds strange and we should definitely try to find it out.

Comment 13 pagalmes.lists 2007-07-26 16:58:54 UTC
I try it From a macro inside the office.
Comment 14 jsc 2007-07-26 17:08:47 UTC
really strange because it looks that you did the same test that i did. I must
confess that i have no idea at the moment.
Comment 15 pagalmes.lists 2007-07-26 17:12:14 UTC
Here is the macro line I used:

Sub Macro1
monDoc = StarDesktop.LoadComponentFromURL( 
ConvertToUrl("http://10.1.0.252:8080/alfresco/webdav/123.odt") , "_blank", 0,
Array()) 
End Sub

Is there an issue related to the fact that I need a password to access to the
server?
Comment 16 pagalmes.lists 2007-07-26 17:13:17 UTC
Created attachment 47116 [details]
The dialogs when I open using File > Open
Comment 17 jsc 2007-07-27 08:36:30 UTC
our test server doesn't require authentication. Anyway in this case the UCB
webdav provider is used for loading. The UCB uses an Interactionhandler (see
css.document.MediaDescriptor) to handle this kind of extra or exceptional
handling. You can implement an own InteractionHandler. I have never implemented
an InteractionHandler. If you test it, it would be nice to have a code snippet
in our snippet collection. 

It should be also possible to use a dispatch. The advantage of a dispatch here
is that you get all the defaults set in the same way as in the office UI. But
then you have to select/find your document for further operations :-(

sub loadViaDispatch
  dim urltransformer as object 
  dim url as new com.sun.star.util.URL

  urltransformer = createUnoService("com.sun.star.util.URLTransformer")
  url.Complete = "http://10.16.67.238/uploads/testdoc.odt"
  urltransformer.parseStrict(url)
  xdispatch = StarDesktop.queryDispatch(url, "_blank", 0)
  xdispatch.dispatch(url, DimArray())
end
Comment 18 pagalmes.lists 2007-07-27 10:26:21 UTC
Thank you JSC for helping us. Now I can open a document through a webdav url.
You rock ;-) But, wouldn't it be possible to use the parameter array from:

StarDesktop.LoadComponentFromURL(ConvertToUrl("http://myserver/webdav/cahier.odt")
, "_blank", 0, Array())

to set the login and password direcly, without needing the dispatch?

Testing your code, I think that a few enhancements should be done. 

Error message when trying to use LoadFromCOmponentUrl with webdav protocol is
impossible to understand (IllegalArgumentException, while it is related to
password). Is this an issue related to the webdav protocol or could this be
enhanced directly inside OOo?

I also posted issue 80101 related to another issue.


I am also wondering how could I save the document opened on webdav server using
the OOo API? We sould maybe continue this discussion on the dev mailing list.
Comment 19 jsc 2007-07-27 11:04:30 UTC
as i mentioned before it should be possible with an InteractionHandler to load
and save from a webdav server. But i haven't the time to check it in detail.

Related to your improvements i am not sure and we have to figure out how it can
be realized. When you want to use loadComponentFromURL you have to use the
Interactionhandler becasue that is the concept of the UCB (however it works in
detail)

But i agree that it is not easy currently and sometimes i am wondering about our
API :-) Yes we should continue the discussion on dev@api.openoffice.org
Comment 20 pagalmes.lists 2007-07-27 15:42:43 UTC
Here is the code that works with the interaction handler posted by "Danad"
(http://www.oooforum.org/forum/viewtopic.phtml?t=41948)


url = "http://localhost:8080/mydir/webdav/123.odt" 
Dim arg(0) As New com.sun.star.beans.PropertyValue 

OOServiceManager = CreateObject("com.sun.star.ServiceManager") 
iHandler = OOServiceManager.createInstance("com.sun.star.task.InteractionHandler") 

arg(0).Name = "InteractionHandler" 
arg(0).Value = iHandler 

StarDesktop.loadComponentFromURL(url,"_blank",0, arg )

I think that we can now close the issue. 

> But i agree that it is not easy currently and sometimes i am wondering about
our API :-)

:-)
Yes, maybe this could somehow be changed...
Comment 21 pagalmes.lists 2007-07-27 15:47:58 UTC
A solution was found.
Comment 22 jsc 2007-07-30 08:02:00 UTC
one last comment, it is not necessary or better no good idea to create a new
service manager. The default service manger is initialized with the right
environment and can be used directly. In Basic you can simpoly use
"createUnoService("com.sun.star.task.InteractionHandler)" and the correct global
service manger is used.
Comment 23 pagalmes.lists 2007-07-30 08:37:33 UTC
jsc -> Thanks for the advice and for the help to solve this "issue". It really
hleps, even if it is not bug.

Finally, the code would be:

url = "http://martini:8080/alfresco/webdav/123.odt" 
Dim arg(0) As New com.sun.star.beans.PropertyValue 
iHandler = createUnoService("com.sun.star.task.InteractionHandler") 
arg(0).Name = "InteractionHandler" 
arg(0).Value = iHandler 
StarDesktop.loadComponentFromURL(url,"_blank",0, arg )