www.webdeveloper.com
Results 1 to 13 of 13

Thread: new COM("com.sun.star.ServiceManager") Time Out Error

  1. #1
    Join Date
    Feb 2008
    Posts
    7

    new COM("com.sun.star.ServiceManager") Time Out Error

    Hi can somewone help out...
    I want to connect to openoffice using php
    But my code stucks at

    $osm = new COM("com.sun.star.ServiceManager") or die ("Please be sure that OpenOffice.org is installed.\n");

    with a Time out message!

    does anyone why this is???

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    you'll need to make sure that the java classes are on the classpath that PHP/COM can have access to...

    but... this means that OpenOffice/StarOffice are installed on the server that PHP is running on. is that what your intention is?

  3. #3
    Join Date
    Feb 2008
    Posts
    7
    Yes.. Ik have already installed OpenOffice on my localsystem, which is also my server...

  4. #4
    Join Date
    Feb 2008
    Posts
    7
    How do i put the java classes on the classpath??
    I am using Windows XP

  5. #5
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    Quote Originally Posted by Cribz
    How do i put the java classes on the classpath??
    I am using Windows XP
    I think it makes more sense to first ask what is it you're trying to do with open office?

  6. #6
    Join Date
    Feb 2008
    Posts
    7
    I'm Trying to generate openoffice writer's document with php. This document can for example be an invoice.

    -thanks in advance-

  7. #7
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    I'm guessing you're just following a tutorial? Maybe this one? http://www.oooforum.org/forum/viewtopic.phtml?t=3474

    Just to point out, if you are using this one, it's quite old and for OOo 1.1. Might behave differently if you're using 2.

  8. #8
    Join Date
    Feb 2008
    Posts
    7
    Is there another way to control OpenOffice from PHP?
    I'm now using version 2.3

  9. #9
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    Quote Originally Posted by Cribz
    Is there another way to control OpenOffice from PHP?
    I'm now using version 2.3
    Well, if you look at the forum I linked to, there's http://www.oooforum.org/forum/viewtopic.phtml?t=68902 this

    It looks like they have something working fairly well. Their description seems to work on linux, windows is probably slightly different (paths, etc).

  10. #10
    Join Date
    Feb 2008
    Posts
    7

    Thumbs up

    I will take a look at it...

    Thanks alot

  11. #11
    Join Date
    Nov 2008
    Posts
    2
    Any Solution? I also want to open a writer doc...and I got the same Problem.
    Where do i have to put which java files?
    I use OpenOffice 3, Windows XP and PHP 5.2.6

    thanks

  12. #12
    Join Date
    Nov 2008
    Posts
    2
    Quote Originally Posted by mychastic View Post
    Any Solution? I also want to open a writer doc...and I got the same Problem.
    Where do i have to put which java files?
    I use OpenOffice 3, Windows XP and PHP 5.2.6

    thanks
    I tried it with this code
    PHP Code:
    <?php

    // get the ServiceManager.
    // This step varies greatly from language to language.
    // This technique is specifically for PHP running on Windows,
    //   where OOo has been installed onto the *same* computer that is running PHP.
    $oServiceManager = new COM"com.sun.star.ServiceManager" );

    // Get the Desktop object
    $*****top $oServiceManager->createInstance"com.sun.star.frame.Desktop" );

    // Ask the Desktop object to create a new drawing.
    // Note the empty array of arguments.
    // This wold be an array of com.sun.star.beans.PropertyValue structs if
    //  you needed to specify additional arguments.
    $oArgs = array();
    $oDrawDoc $*****top->loadComponentFromURL"private:factory/sdraw"$oArgs ); 

    ?>
    and then this error: "Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\Test\test.php on line 19"

    So whats wrong here?

  13. #13
    Join Date
    Jun 2007
    Location
    Tangerang, Banten
    Posts
    258
    First,
    I want you take a look at http://www.webdeveloper.com/forum/sh...d.php?t=187281. There is 2 solution with OpenOffice. Using API or using MACRO. Macro is easiest way to do something like file conversion.

    Second,
    I want you take a look at PUNO : http://www.wstech2.net/index.php?do=puno. With PUNO, you can access OpenOffice API. I have using it quite a while.. The result is : i can control presentation file in a web browser. I have tested it using my ubuntu 7.10 + OpenOffice 2.4.1. Not test in OOo 3 yet, because no SDK at the moment. So, if there is another question about it, welcome... The COM windows tutorial in there is good too..

    Third,
    The main and usual problem call ServiceManager with COM extension is permission! Have you set the permission?? COM permission.

    Forth,
    There is a tool : JODConverter. You can take a tour on it and its guide(how to starting OOo as a service). http://www.artofsolving.com/opensource/jodconverter. This may insipire you..

    Fifth,
    For my experiment, the best result to control OOo is using java, not PHP! So, JSP or other technology may be suitable to you if you try to control OOo with its API.

    Sixth,
    Who is the man, installed OOo as a service, to satisfy web application, in a shared hosting?? None will!!

    Hope this help you all..

    @mychastic
    Of cource there will be an error occured. You have created unfinish code. After loadComponentFromURL, what will you do about it? If there is nothing, then close it!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles