$server -> register with class method instead of function |
Site Admin
|
It would required to register both: instance and class method.
No, this is not supported. |
||||||||||||
_________________ The PHP IDE team |
|
ok, so i will wrap the class methods in standalone functions.
thanx |
||||||||||||
|
Site Admin
|
I'm not sure if it is of any help, but you may try with static methods as they don't require object instance.
|
||||||||||||
_________________ The PHP IDE team |
|
no, that's not an option. But that doesn't matter anyway since in the wrapper functions i catch thrown exceptions to convert them to soap faults. The classes used can be used locally too but there an exception handler takes care of the exceptions. After all not a bad thing.
|
||||||||||||
|
|
Hi,
You can try following, It has worked for me.
After this check you wsdl, you we see all the required things there. Regards, Dave Naimish |
||||||||||||||
|
Site Admin
|
if you have 100 instances of myclass, which one will be called with myfunction? so it does not look like your suggestion will do. |
||||||||||||||
_________________ The PHP IDE team |
|
the original question was:
is it possible to register a class method instead of a standalone function? Yes it is....do the following: class ClassName { function myfunction() { // do something return true; } } $server -> register(ClassName..myfunction); // Here's the magic...use two periods to separate the className from the function you want to expose. Side Note: Although this worked for me I am having a problem getting the function I register to access it's brother and sister functions in the class. example: class myclass { function myfunction() { // do something return $this->sayHello(); } function sayHello(){ return 'Hello'; } } $server -> register(ClassNameHere..myfunction); When I try to call the function in soap it returns: HTTP Error: no data present after HTTP headers The function call works if I don't reference it's sibling function. So instead of return $this->sayHello(), I put return 'Hello' and I get a successful reply. I would imagine this is caused by "Context Confusion". Maybe I'm registering this Class Function wrong. Any advise would be welcome. Sincerely, Kokopelli |
||||||||||||
|
$server -> register with class method instead of function |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by