Active
Project:
Web service client
Version:
7.x-1.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Apr 2015 at 05:04 UTC
Updated:
10 Apr 2015 at 05:25 UTC
Jump to comment: Most recent
Comments
Comment #1
dman commentedWell, views is for extracting info from your local data,
and a web service create is for writing to a remote one.
It's not too hard to see some glue that would sit between them - but that glue would be your own, and would act as the mediator that uses views to read, sorts out what to do with that, and then writes via wsclient. What will not happen here is "telling views to write" for you. It's your own glue that will talk to both, you can't get them to talk to each other for you.
Given the broader task though...
I would be setting something up with Views Bulk Operations, actions and rules.
This keeps your unique code to a minimum and produces synergy with the later multipliers.
From the bottom
* create an action that will take data from a single entity and invoke wsclient CREATE on your service. Just once.
Build that working first as - eg, a button on the entity page you can press that invokes the push of a single entry. That's the unique code that may be needed from your end.
* Given that, add the hook_action support to that one action. That will mean you can use content management UI to select one or more items and say 'publish all of these using my mechanism.
* Once that is done, you will find you can also use that action as a button in Views Bulk Operations.
* After that, you will also find you can create a 'Rule' that can be triggered to run your push action every time an item is added (or updated)
Once all those bits are done, you may find that the need to 'build the query in views' may have dissolved. VBO probably did that for you already,
All those later steps are already built. The only thing you have to figure out is
: given an entity data object, map its values into your needed wsclient data packet as args.
: invoke a wsclient action call. ( $response = $service->invoke($operation['name'], $args); )
: .. and how to publish actions to Drupal via hooks