This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Call eZOperationHandler::execute from...
expandshrink

Call eZOperationHandler::execute from Soap

Call eZOperationHandler::execute from Soap

Sunday 11 September 2011 5:12:57 pm - 9 replies

Hello Friends,

I am new to EZpublish and current using 4.3 version of Wzpublish. I am trying to find a way to call eZOperationHandler::execute from Soap service of Ezpublish so that it can be called from other system using webservices.

I have managed to call the method but it is not performing the required updates in the system. I do not know how to proceed further.

Please help me on this.

Thanks in advance.

Dhiraj Jain.

Monday 12 September 2011 3:44:36 am

Hello dhiraj,

Please do not post duplicate messages to the forums.

Cheers,

Heath

Monday 12 September 2011 9:29:24 am

Hi Dhiraj and welcome to the eZ Community,

Which operation are you calling exactly ? In other words, could you give us the full snippet of where you are calling eZOperationHandler::execute ?

Cheers,

Monday 12 September 2011 2:27:15 pm

Hello Dhiraj,

you probably need a user with valid access rights to do some of the things you want to do. For example, the operation of adding a location to content object requires certain rights to be successful.

The easiest way for you to achieve this is to login with a user that has that rights, for example:

$user = eZUser::fetchByName('admin');
$user->loginCurrent();

and when you're finished with you work, do:

eZUser::logoutCurrent();

You need to be careful with this however, consider what can be done with your web service and the fact that admin user has unlimited access to your web.

The best would be to create a specific user with very limited policies (but just enough to get the job done), and use that account instead of admin.

Modified on Monday 12 September 2011 2:28:13 pm by Edi Modrić

Monday 12 September 2011 5:52:50 pm

Hello dhiraj,

Please do not post duplicate messages to the forums.

Cheers,

Heath

Hi Heath,

I am sorry for the duplicate post, 

Thanks

Dhiraj Jain

Modified on Monday 12 September 2011 5:54:16 pm by dhiraj Jain

Monday 12 September 2011 6:14:16 pm

Hi Dhiraj and welcome to the eZ Community,

Which operation are you calling exactly ? In other words, could you give us the full snippet of where you are calling eZOperationHandler::execute ?

Cheers,

Hi Nicolas,

Actually we are using Ezpublish to deploy contents and for that we are using execute method of ezoperationhandler. It is working fine from the web interface but we want to call it from Soap service as an asynchronous request.

We have also tried using login with a user having admin access before calling this method but no success.

Code snippet looks as below: -

$user = eZUser::fetch(1111);

$user->loginCurrent();

eZOperationHandler::execute ('content','updateObjectState',$operationParameters);

I hope this provides you enough information.

Please let me know in case of any further information.

Thanks

Dhiraj Jain

Monday 12 September 2011 6:20:07 pm

updateObjectState operation in content module is disabled in workflow.ini by default so this won't work.

Either enable it in OperationSettings/AvailableOperationList in workflow.ini, or you can use eZContentOperationCollection::updateObjectState method to achieve the same result.

Tuesday 13 September 2011 6:13:06 am

updateObjectState operation in content module is disabled in workflow.ini by default so this won't work.

Either enable it in OperationSettings/AvailableOperationList in workflow.ini, or you can use eZContentOperationCollection::updateObjectState method to achieve the same result.

Hi Edi,

Thanks for such a fast response.

I have verified and found that the updateObjectState is enabled in workflow.ini.

Also, we tried calling through eZContentOperationCollection::updateObjectState.

In both cases we found that it is updating records in one table (ezcobj_state_link) but not in other tables (ezstatechange, ezdates_cron, ez_dates).

Please let me know if you need any other information.

Thanks

Dhiraj Jain

Tuesday 13 September 2011 10:22:04 am

Are you using the soap.php file to execute your webservices?

It might be that that controller file has problems in reloading all ini files for the correct siteaccess environment (there have been a couple such bugs in the past, you can look them up in the issue tracker)

If you use the ggwebservices extension, you should be able to use a module/view instead of a custom controller file (ie. /webservices/execute/soap) - without changing a line in your php code exposed as soap service. This means a bit of a performance hit, but you will probably be running your code in a more "standard" ez environment, where operations should work fine. Also, you get better authorization support (eg. allow clients by IP address), logging and wsdl support

Thursday 15 September 2011 3:20:51 pm

Are you using the soap.php file to execute your webservices?

It might be that that controller file has problems in reloading all ini files for the correct siteaccess environment (there have been a couple such bugs in the past, you can look them up in the issue tracker)

If you use the ggwebservices extension, you should be able to use a module/view instead of a custom controller file (ie. /webservices/execute/soap) - without changing a line in your php code exposed as soap service. This means a bit of a performance hit, but you will probably be running your code in a more "standard" ez environment, where operations should work fine. Also, you get better authorization support (eg. allow clients by IP address), logging and wsdl support

Hi Gaetano,

Thanks for your response.

I have tried this approach but not able to expose the method from ggwebservice as soap object.

I will be very thankful if you provide me some examples to do so.

Thanks

Dhiraj Jain

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from