473,698 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error While Accessing VB COM from PHP.

3 New Member
Hi,

I am trying to connect to a COM component using PHP, but keep on recieving an "Unexpected error has occured" message.

The COM component code is

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Public Enum ApplicationErr
  4.     Unexpected = Error.Unexpected
  5. End Enum
  6.  
  7. Private Const m_csClassName As String = "XYZ.Application"
  8.  
  9. Public Sub Initialize(ByVal udl As String, ByVal log)
  10. On Error GoTo ErrInitialize
  11.     Dim enumErrorCode As xyzError
  12.     enumErrorCode = Success
  13.  
  14.     Dim oObjectContext As ObjectContext
  15.     Set oObjectContext = GetObjectContext()
  16.  
  17.     oObjectContext("Session")("ConString") = "FILE NAME=" & App.Path & "\" & udl
  18.     oObjectContext("Session")("ErrLog") = App.Path & "\" & log
  19.  
  20. ExitInitialize:
  21.     On Error Resume Next
  22.     Set oObjectContext = Nothing
  23.     If enumErrorCode <> Success Then
  24.         On Error GoTo 0
  25.         Call Err.Raise(enumErrorCode, m_csClassName, GetErrorDescription(enumErrorCode))
  26.     End If
  27.     Exit Sub
  28. ErrInitialize:
  29.     If Err.Source = m_csClassName Then
  30.         enumErrorCode = Err.Number
  31.     Else
  32.         enumErrorCode = Unexpected
  33.     End If
  34.     If Not (Err.Source = "XYZ.Application" And Err.Number = XYZ.ApplicationErr.Unexpected) Then Call LogError(m_csClassName & ".Initialize")
  35.     Resume ExitInitialize
  36. End Sub
  37.  
The PHP code used is :

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. try {
  4. $udl = new VARIANT("XYZ.udl",VT_BSTR);
  5. $errorlog = new VARIANT("ErrorLog.txt",VT_BSTR); 
  6.  
  7. $Q = new COM("XYZ.Application") or die("Cannot start XYZ");
  8. $lUserId = $Q->Initialize($udl,$errorlog);
  9.  
  10. echo $lUserId;
  11. catch (com_exception $e) 
  12. {
  13. $lUserId = array('errorCode' => $e->getCode(),
  14. 'errorMessage' => $e->getMessage(),
  15. 'errorFile' => $e->getFile(),
  16. 'errorLine' => $e->getLine());
  17. }
  18.  
  19. echo "<pre>";
  20. print_r($lUserId);
  21. echo "</pre>";
  22. ?>
  23.  
  24.  
It always generates an exception. Can someone please help me resolve this issue.

Also could it be a Type mismatch error?

thanks.
Feb 5 '09 #1
4 1741
Markus
6,050 Recognized Expert Expert
Does the error come as a PHP error or a VB error?
Feb 5 '09 #2
amey72
3 New Member
the error comes as a VB error.
Feb 6 '09 #3
amey72
3 New Member
Following is the exception generated :
Expand|Select|Wrap|Line Numbers
  1. Array
  2. (
  3.     [errorCode] => -2147352567
  4.     [errorMessage] => Source: FQAI.Application
  5. Description: Unexpected error has occured
  6.     [errorFile] => D:\WWW\AIWM\website\aiwmtest\index1.php
  7.     [errorLine] => 7
  8. )
  9.  
Feb 6 '09 #4
Markus
6,050 Recognized Expert Expert
Then it would make more sense to ask the question in our VB.NET forum.
Feb 6 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
13659
by: PW | last post by:
Hi, I'm using WinXP-Pro, ASP classic, IIS 5.0. I regularly get this error, but I know I am the only user accessing the website at the time of the error. I looked it up on the MS support webiste. Their recommendation is this ... ------------------
3
3340
by: AdamM | last post by:
Hi all, When I run my VbScript, I get the error: "ActiveX component can't create object: 'getobject'. Error 800A01AD". Any ideas what I did wrong? Here's my VBScript: dim o set o=getobject(,"ConsoleApplication2.Program") msgbox o.TestString
0
2262
by: Joergen Bech | last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running application on a web server outside of my control, but only the first time I run it: 1. After a long period of inactivity (or updating the code-behind dll) accessing any aspx page in the application causes the application to run for the first time. Some of the initialization involves reading and writing some text and xml files using simple streamreader and streamwriter...
2
390
by: Terry Holland | last post by:
I posted a follow up to an earlier post but did not receive response so here it is again (with original post and response) > This could be because you are running the index service over this web > application. try to stop indexing this application (from IIS management > console, clear "Index this resource") or stop the index service to test if > you still get error or not. I removed this option but still get the error. The error...
4
6112
by: Kaush | last post by:
Hi all, I am creating a webservice to accept SOAP messages, parse the message and send a SOAP response back to the client accessing my web service using WSE-2 in ASP.NET. I am creating a class which derives from "SoapReceiver" class and do the processing here. To register this class by using the HTTP protocol, I am editing the "web.config" file. I am adding an "add" element to this config file as follows: <httpHandlers>
5
3630
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As New System.Diagnostics.Process 'p.Start(MDEPDirStr & "macrun.exe", sPPTOut) p.Start("C:\WINDOWS\SYSTEM32\CALC.EXE") 'p.Start("C:\WINDOWS\SYSTEM32\macrun.exe", sPPTOut)
13
2868
by: Praveen_db2 | last post by:
Hi All db2 8.1.3 Windows I am getting this error in db2diag.log.Please tell why is this error (-444) always there and how to go about for removing it. Diag.log output: ---------------------------------------------- 2006-01-28-19.48.05.816000 Instance:DB2 Node:000 PID:1628(db2syscs.exe) TID:1524 Appid:none base sys utilities startdbm Probe:911
3
6141
by: fniles | last post by:
In our ASP page, we call XMLHttp to download XML files. When calling our page using localhost (localhost/myWebSite/myPage.htm), it works, but when calling using the IP address of the web server (xx.x.x.xxx/myWebSite/myPage.htm), I got "Permission denied" error in the HTTP.Open statement. Set http = CreateObject("Microsoft.XmlHttp") http.open "Get", "http://" & "xx.x.x.xxx" & "/XMLFiles/N-1min.xml", ALSE --> permission denied error
8
10991
by: MikeJ | last post by:
In my office, we have workstations with standard Win 2000 images (OS plus standard apps like Office, etc.) as developers, we then install our development tools on top of those images. other developers in my office have installed VS8 and use it with no problems. however, on a new workstation that I recently got, I have installed VS8, and get this error whenever I try to access a C# project or create a new C# project: "Project 'XYZ'...
1
1625
by: David Schrader | last post by:
Hello all, Let me start by saying that I'm not certain whether this belongs here, in this notes group, or another more developmentally oriented one. I'll try starting here then go elsewhere if you decide otherwise. (Already forwarded here, sort-of, from: microsoft.public.windowsnt.registry.) I'm writing a Visual Basic program which stores and retrieves data in the registry - no big thing, I've got all that code written
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8898
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6524
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.