OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Using OOo from ASP .NET

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
JacquesDuPreez
General User
General User


Joined: 05 Nov 2004
Posts: 8
Location: South Africa

PostPosted: Fri Nov 05, 2004 4:46 am    Post subject: Using OOo from ASP .NET Reply with quote

Hi there!

I want to use OOo from an ASP .NET environment. My code works fine when I run it from a standard Windows concole application. But when I try to run the same code from aspx I get the following error:

Could not create an object of type 'com.sun.star.ServiceManager'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Could not create an object of type 'com.sun.star.ServiceManager'.

Code:
Dim objSM As Object = objServer.CreateObject("com.sun.star.ServiceManager")


Where objServer is an instance of HttpServerUtility, and assigned ByRef from Page.Server ...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Fri Nov 05, 2004 10:23 am    Post subject: Reply with quote

Do you need to configure the "new" environment to know about the OOo clases and such? Including libraries, for example. I am only guessing
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
JacquesDuPreez
General User
General User


Joined: 05 Nov 2004
Posts: 8
Location: South Africa

PostPosted: Sun Nov 07, 2004 10:51 pm    Post subject: Reply with quote

pitonyak wrote:
Do you need to configure the "new" environment to know about the OOo clases and such? Including libraries, for example. I am only guessing


Maybe, maybe not ... I didn't configure the console app. Even if I could configure the ASP web app, I don't know how, because I can't reference OOo from it, because OOo is not really a true COM or .NET library...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Mon Nov 08, 2004 12:20 am    Post subject: Reply with quote

What do you mean with "is not a true COM library"?

Christian
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
Fallen
General User
General User


Joined: 08 Nov 2004
Posts: 5

PostPosted: Mon Nov 08, 2004 6:52 am    Post subject: Reply with quote

It is likley that the ASP.Net worker process does not have permission to automate that process. Run "dcomcnfg" from the Windows run dialog and grant the proper permission to IUSR_{machinename}, IWAM_{machinename}, and ASPNET. This works for Excel automation, but I can't say wether or not it will work for Oo.
Back to top
View user's profile Send private message
mneumann
General User
General User


Joined: 22 Sep 2003
Posts: 40
Location: Austria

PostPosted: Mon Nov 08, 2004 9:14 am    Post subject: Reply with quote

I guess the reference to the right library is the first step to do. I know in MS Office you have a reference for every application. I dont know which library you need to reference for OpenOffice, but this is the first step so that Com will recognize what you need. I have read something that there is a com to UNO bridge that takes care of this job, but I have no clue how the libary would be named. But with some research on the OO website or the SDK that should be found.
Back to top
View user's profile Send private message
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Mon Nov 08, 2004 11:07 am    Post subject: Reply with quote

mneumann: You're wrong with that. What you describe is only one way of connecting to a COM server, this one way is called early binding and is not possible with OOo, because OOo has not a specific .dll for this, in contrast to Excel or Word which do have those.
Statements like CreateObject(...) do use the late binding way thus getting the library during runtime by sending a specific request that is handled inside of OOo very specifically and if the connection is established this means the COM-UNO bridge is activated.

Christian
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
mneumann
General User
General User


Joined: 22 Sep 2003
Posts: 40
Location: Austria

PostPosted: Mon Nov 08, 2004 11:24 am    Post subject: Reply with quote

Well, I am just getting in that field of understanding automation server for myself. Do you say that late binding does not need to know any reference to the used library? How does VB then know which object to call? Is that all handled completely by COM? Just want to know.
Back to top
View user's profile Send private message
JacquesDuPreez
General User
General User


Joined: 05 Nov 2004
Posts: 8
Location: South Africa

PostPosted: Tue Nov 09, 2004 3:26 am    Post subject: Reply with quote

Fallen wrote:
It is likley that the ASP.Net worker process does not have permission to automate that process. Run "dcomcnfg" from the Windows run dialog and grant the proper permission to IUSR_{machinename}, IWAM_{machinename}, and ASPNET. This works for Excel automation, but I can't say wether or not it will work for Oo.


Have have changed the Access Permissions, and Launch and Activation Permissions for these users on the My Computer > COM Security at the Console's Concolse Services.

I have also made the same changes for these users for the OpenOffice.org 1.1.0 Text Document under DCOM Config ... no success ... same error message is displayed. Crying or Very sad
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
JacquesDuPreez
General User
General User


Joined: 05 Nov 2004
Posts: 8
Location: South Africa

PostPosted: Tue Nov 09, 2004 3:28 am    Post subject: Reply with quote

Cybb20 wrote:
What do you mean with "is not a true COM library"?

Christian


It wasn't specifically developed as a COM component, it uses the COM-UNO bridge ...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
nfsilva
Newbie
Newbie


Joined: 25 Nov 2004
Posts: 1

PostPosted: Thu Nov 25, 2004 10:53 am    Post subject: The only way I found... Reply with quote

Hi!

The only way I found to do this:

1) Create a ActiveX in VB that use CreateObject to access OpenOffice
2) Call ActiveX (VB) from a ASP.NET page

The VB code I did:
Dim openOfficeObject As Object

Public Function CreateOpenOffice() As Object

Set openOfficeObject = CreateObject("com.sun.star.ServiceManager")
Set CreateOpenOffice = openOfficeObject

End Function

Public Sub RemoveOpenOffice()

Set openOfficeObject = Nothing

End Sub

Private Sub Class_Terminate()

Set openOfficeObject = Nothing

End Sub

My Project call "wrapperOpenOffice". In ASP call
Set o = CreateObject( "WrapperOpenOffice.Wrapper" )
if( o is nothing ) then
response.Write( "erro" )
else
Set c = o.CreateOpenOffice
o.RemoveOpenOffice
Set c = Nothing
Set o = Nothing
response.Write( "ok" )
end if

PS. Excuse my English. I'm from Brasil...

JacquesDuPreez wrote:
Cybb20 wrote:
What do you mean with "is not a true COM library"?

Christian


It wasn't specifically developed as a COM component, it uses the COM-UNO bridge ...
Back to top
View user's profile Send private message
JacquesDuPreez
General User
General User


Joined: 05 Nov 2004
Posts: 8
Location: South Africa

PostPosted: Fri Nov 26, 2004 3:05 am    Post subject: Reply with quote

Cool. thanX very much nfsilva... will try to do this during the next few days... it will be really cool to use OOo from ASP .NET.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
khaled_ik
Newbie
Newbie


Joined: 25 Apr 2006
Posts: 1
Location: israel

PostPosted: Tue Apr 25, 2006 5:25 am    Post subject: Reply with quote

JacquesDuPreez wrote:
Cool. thanX very much nfsilva... will try to do this during the next few days... it will be really cool to use OOo from ASP .NET.


hi i am khaled..

i want to ask you JacquesDuPreez .. if your try sucsess.
because i try to do the same thinks.
and i have an error .
if you can help me .

my mail is khaled_ik@yahoo.com
Back to top
View user's profile Send private message Send e-mail
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Tue Apr 25, 2006 10:28 am    Post subject: Reply with quote

khaled_ik wrote:
and i have an error .

It's hard to help with no problem description. Try a more elaborate description.

Just a tip because this is a rather old thread.

With kind regards
hol.sten
Back to top
View user's profile Send private message
LarsB
OOo Advocate
OOo Advocate


Joined: 31 Aug 2005
Posts: 445
Location: Hamburg, Germany

PostPosted: Tue Apr 25, 2006 11:58 am    Post subject: Without any more info Reply with quote

Hi,

also without any more information. I think I know what's the problem.
The ASP.NET User is with the standard settings to restricted and
don't have the permission to invoke the COM call. You first have to change
the processmodel in the machine.config. You can either let run the
ASP.NET process as System or as an User who has permission
to execute the internal COM call. Try searching this forum for details
on changing the processmodel. I wrote several answers on this knd
of questions.

Cheers,
LarsB
_________________
AODC - A free OpenDocument Converter
AODL - An independent OpenDocument Library C#
EmbeddedOpenOffice .net UserControl C#
EmbeddedOpenOffice Visual Studio .net Add In

http://www.OpenDocument4all.com/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group