473,396 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Error While Accessing VB COM from PHP.

3
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 1699
Markus
6,050 Expert 4TB
Does the error come as a PHP error or a VB error?
Feb 5 '09 #2
amey72
3
the error comes as a VB error.
Feb 6 '09 #3
amey72
3
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 Expert 4TB
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
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...
3
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...
0
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...
2
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...
4
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...
5
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...
13
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:...
3
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...
8
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.