PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Old May 10th, 2007, 10:35 AM
tcarnes tcarnes is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 5 tcarnes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 24 m 4 sec
Reputation Power: 0
Smile [RESOLVED] Trying to call .NET function (have vb example)

I am trying to call a .NET module from a php5 script. My code is:

PHP Code:
 $transaction = new DOTNET("Paymentech""Transaction");
$response = new DOTNET("Paymentech""Response"); 


My script dies on the first line with the error:

Quote:
PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80070002] The system cannot find the file specified. ' in C:\Terry\OrdCen\PHPTEST.php:3 Stack trace: #0 C:\Terry\OrdCen\PHPTEST.php(3): dotnet->dotnet('Paymentech', 'Response') #1 {main} thrown in C:\Terry\OrdCen\PHPTEST.php on line 3


The sample VB code that came with the module states:

Code:
Dim response AS Paymentech.Response
Dim transaction As New Paymentech.Transaction(RequestType.CC_AUTHORIZE)


This is my first real foray into .NET with PHP. Hopefully someone can help me.

I believe my server is set up properly as the sample code given in the PHP manual does work:

PHP Code:
<?php
  $stack 
= new DOTNET("mscorlib""System.Collections.Stack");
  
$stack->Push(".Net");
  
$stack->Push("Hello ");
  echo 
$stack->Pop() . $stack->Pop();
?>


And the sample compiled vb app also works. The sample vb app is in the same directory (on the server) as several paymentech dll's. Could that have something to do with this? How does my PHP script know where to get the information on the paymentech object?

Thank you for any help anyone can offer!

Terry

Last edited by tcarnes : May 15th, 2007 at 10:20 AM.

Reply With Quote
Old May 10th, 2007, 12:57 PM
bluephoenix's Avatar
bluephoenix bluephoenix is offline
Levelheaded Curmudgeon
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Syracuse, NY
Posts: 508 bluephoenix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 24 m 56 sec
Reputation Power: 8
Send a message via AIM to bluephoenix
PHP cannot find the assembly file to load the object. Notice how in the example from the documentation it provides the assembly/dll name and the full namespace. The assembly may also need to be in the global assembly cache, but I'm not 100% certain on that.
__________________
www.saltcitytech.com
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth
Remember kids, it's mysql_real_escape_string, not mysql_fake_escape_string.

Reply With Quote
Old May 10th, 2007, 01:12 PM
tcarnes tcarnes is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 5 tcarnes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 24 m 4 sec
Reputation Power: 0
How do I find the full namespace? I'm working with .NET components that only come with VB and C# examples, so I'm kinda winging it to try and do this in PHP.

The VB example seems to only refer to "Paymentech.Response" as in "Dim response AS Paymentech.Response". Perhaps the VB code explains things more fully elsewhere?

Is there a way to see if the assembly is already in the global assembly cache?

Reply With Quote
Old May 10th, 2007, 03:23 PM
tcarnes tcarnes is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 5 tcarnes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 24 m 4 sec
Reputation Power: 0
Question

What I don't understand is that this .NET module works with the sample compiled vb program that is supplied. If this sample program is using .NET (which it is supposed to be doing), then doesn't that mean that everything is properly registered?

Reply With Quote
Old May 15th, 2007, 10:03 AM
tcarnes tcarnes is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 5 tcarnes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 24 m 4 sec
Reputation Power: 0
Turns out the PHP couldn't find the dll because it wasn't in the Global Assembly Cache, and I couldn't use gacutil to put it there because it didn't have a strong name.

So I got around that by placing the dll in the PHP directory on the web server.

My next problem is trying to pass parameters using DOTNET, but that is a subject for another post. The problem of not being able to locate the file is solved.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Trying to call .NET function (have vb example)


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap