Hi Simon,
Funny, I came up with the same SCRIPT_FILENAME hack, although I
implemented it slightly differently. Instead I put it in the class
service file so that SCA normal bootstrap process (based on the
debug_backtrace()) will still work:
My public file includes my bootstrap, and then includes the non public
class file:
<?php
require('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR .
'bootstrap.php');
require(LABNET_SERVICES . DIRECTORY_SEPARATOR . 'online' .
DIRECTORY_SEPARATOR . 'LabnetOnline001.php');
?>
The class service file then does the SCRIPT_FILENAME hack:
<?php
$_SERVER['SCRIPT_FILENAME'] = realpath(__FILE__);
require(LABNET_LIB . 'SCA' . DIRECTORY_SEPARATOR . 'SCA.php');
/**
* @service
* @binding.soap
*/
class LabnetOnline001
{
}
?>
I like your idea of implementing a SCA dispatcher (and decupling the
bootstrap process from any debug_backtrace() call). However, one issue
for me would be the mapping of filenames to class names. I'm working
with the PEAR standard for class file naming and directory placement
(which seems to be a standard that has traction in many facets of the
PHP world, and what the SCA code mostly follows). So a class names
My_Service_Things, would be placed in the library directory like this:
Library/
My/
Service/
Things.php
Therefore, having a dispatcher that assumed mappings between filename
and class would just not cut it.
If the dispatcher took the class name instead of the filename, and
assumed PEAR style conventions, you could resolve class names to files
easily.
Anyway, my $0.02.
Best,
Mike
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of [EMAIL PROTECTED]
> Sent: May 4, 2007 9:53 AM
> To: phpsoa
> Subject: [phpsoa] Re: SCA Server Programming: Layout Issues
>
>
> Hi Mike
>
> I had to do a presentation this morning so just got back to looking at
> this. I started thinking about the API approach and thought I would
> mock it up with what we have already before making changes. So
> repeated the SCA initialization call that happens internally. I had a
> HelloWorld test where I moved the service file into a lib directory
> and constructd a php file that includes it.
>
> <?php
> include 'lib/HelloWorld.php';
>
> $_SERVER['SCRIPT_FILENAME'] = 'C:\phpscripts\lib\HelloWorld.php';
> SCA::initComponent('C:\phpscripts\lib\HelloWorld.php');
> ?>
>
> So I'm sure resetting SCRIPT_FILENAME is a dodgy thing to do and I
> wouln't recommend it but I just allows me to sidestep the SCA test and
> get it running. So we could replace this with some SCA api like
>
> SCA:dispatch("filename");
>
> Where filename is the name of the file/service you want to dispatch
> to. Does that sound OK. I would like to make filename servicename
> instead but not sure I can do that yet.
>
> Regards
>
> Simon
>
>
> E-mail messages may contain viruses, worms, or other malicious code. By
> reading the message and opening any attachments, the recipient accepts full
> responsibility for taking protective action against such code. Henry Schein
> is not liable for any loss or damage arising from this message.
The information in this email is confidential and may be legally privileged. It
is intended solely for the addressee(s). Access to this e-mail by anyone else
is unauthorized.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"phpsoa" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---