Stuck on this. Hope someone can shed some light on it.
The issues involves Drupal 7 Rules and Web Service Client (wsclient) when consuming SOAP results. The Rule breaks when trying to loop on any SOAP object array result set. In this case, FindServiceTickets
.
The Rule works fine when the I use an action that returns only a single object, such as GetServiceTicket
. Yet it breaks specifically when I attempt to loop over a SOAP object array result set, in this case the FindServiceTicketsResponse
result. It breaks even if I do nothing in the loop at all.
I perform the FindServiceTickets
action, pull 10 Tickets. The FindServiceTicketsResponse
result contains an array of Ticket objects. I can even see the correct 10 Ticket and their field details in the error drump, actually, so the Web Service Client appears to work fine.
When it breaks Drupal throws the following:
Warning: array_keys() expects parameter 1 to be array, object given in array_keys() (line 1040 of /Applications/MAMP/htdocs/drupal/sites/all/modules/entity/includes/entity.wrapper.inc). =>...
Recoverable fatal error: Argument 2 passed to EntityMetadataWrapperIterator::__construct() must be of the type array, null given, called in /Applications/MAMP/htdocs/drupal/sites/all/modules/entity/includes/entity.wrapper.inc on line 1040 and defined in __construct() (line 1118 of /Applications/MAMP/htdocs/drupal/sites/all/modules/entity/includes/entity.wrapper.inc). =>....
What do I miss? Do I need to cast the stdClass Object into into a List of Ticket
Object, or ArrayOfTicket
? If so, where and how do I do that, where do I cast it? I have not solved this.
Any suggestions or links to a solution would be greatly, greatly appreciated!
Comment | File | Size | Author |
---|---|---|---|
#7 | var_dump on result.txt | 3.36 KB | agp1001001 |
#7 | ContactApi.wsdl_.txt | 72.5 KB | agp1001001 |
#7 | devel_debug_output_part1.txt | 1.87 MB | agp1001001 |
#7 | devel_debug_output_part2.txt | 1.91 MB | agp1001001 |
#7 | Screen Shot 2013-06-05-e1.png | 430.17 KB | agp1001001 |
Issue fork rules-2008334
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
agp1001001 CreditAttribution: agp1001001 commentedComment #2
cweagansA few things:
1) Support requests are never major or critical. The priority is not representative of the importance it has to you, but the importance to the project.
2) In order to help you, you're going to need to provide code, not just screenshots of errors.
3) This is not an issue with Drupal core, and should probably be taken up in either the Rules or wsclient queue. I'm going to let you decide which queue to move it to, but I'm certain that it does not belong here.
Thanks, and sorry I wasn't more help.
Comment #3
agp1001001 CreditAttribution: agp1001001 commentedThanks for your replay, cweagans. Please excuse the post faux pas. I hadn't posted here before.
I posted it here because Web Service Client (wsclient) author Klaus Purer (
https://drupal.org/user/262198
) suggested I post this here when I wrote it to him. He replied:Prior to that a few days ago I had posted this same post as a Forums Topic, yet it received no replies.
You suggest I post it to the Rules or wsclient queue, yet do I find that on this same Issues board by designating which type of Component under which it falls? (I saw neither in the list.) Or is there another location?
Hope to find some support. Thanks for the guidance.
Comment #4
agp1001001 CreditAttribution: agp1001001 commentedComment #5
agp1001001 CreditAttribution: agp1001001 commentedThe exported rule:
Comment #6
agp1001001 CreditAttribution: agp1001001 commentedComment #7
agp1001001 CreditAttribution: agp1001001 commentedStill getting this error:
array_keys() expects parameter 1 to be array, object given
It happens when trying to iterate within a Rule loop over a SOAP result of an array using wsclient module (Web Service Client).
I generated outputs using PHP var_dump() on each of the variables within the rule, referring to Option 3 on https://drupal.org/node/1114308.
Attached, you will find:
Please note: I have no var_dump() output from the list_item iterator variable of the rule loop because the error occurs before any next step can happen within the loop, before it can output a message.
Please note: I created this Drupal rule on different SOAP action and different SOAP endpoint than first posted. I created it on the SOAP ContactsApi instead of on the SOAP ServiceTicketApi. Both are from the same web services provider. I performed the action FindContacts instead of FindServiceTicket.
The same issue occurs with Contacts as with ServiceTicket.
Top of error message part 1 (full file attached):
<em class="placeholder">Warning</em>: <em class="placeholder">array_keys() expects parameter 1 to be array, object given</em> in <em class="placeholder">array_keys()</em> (line <em class="placeholder">1040</em> of <em class="placeholder">/Applications/MAMP/htdocs/drupal/sites/all/modules/entity/includes/entity.wrapper.inc</em>). => Array
and top of error message part 2 (full file attached):
<em class="placeholder">Recoverable fatal error</em>: <em class="placeholder">Argument 2 passed to EntityMetadataWrapperIterator::__construct() must be of the type array, null given, called in /Applications/MAMP/htdocs/drupal/sites/all/modules/entity/includes/entity.wrapper.inc on line 1040 and defined</em> in <em class="placeholder">__construct()</em> (line <em class="placeholder">1118</em> of <em class="placeholder">/Applications/MAMP/htdocs/drupal/sites/all/modules/entity/includes/entity.wrapper.inc</em>). => Array
I replaced my client's text fields with "xxxxxx" in the attached files.
I very much hope someone might identity what does not work here. Please let me know if I can clarify any of the above. Thanks.
Comment #8
agp1001001 CreditAttribution: agp1001001 commentedAlso, this only occurs on an array result, not on a non-array result.
The issue occurs on the iteration over the array, not on getting the array result.
e.g. I get back a single complexType ServiceTicket when I perform a GetServiceTicket (which does not return an array, but just one complexType) and I can use it to, say, create a node with its fields. FindServiceTickets, returns an array of ServiceTicket. I get the array back fine but I cannot iterate over it.
Comment #10
solideogloria CreditAttribution: solideogloria commented