[development] Continued Services woes
bsenftner at earthlink.net
Fri Mar 4 23:42:00 UTC 2011
Here's some example code I posed at d.o showing how to communicate between two Drupal 6 sites using Services 2.2 thru 2.4, & the XMLRPC server:
you'll want to examine the "send()" routine, which is used to call any xmlrpc method. The example code uses the Drupal API, rather than cURL, as you are attempting to use. However, the key logic you'll want to see is the "send()" routine, which is the handling & packaging of the method arguments before calling the remote method. Your code you show below is incorrect for XMLRPC parameter packaging.
Additionally, as an aid for you to convert between the logic I give above and your attempts to use cURL, I have another post at g.o showing how to communicate with a Services 3.0 REST remote API - with two examples: one using cURL and one using the Drupal API. Granted, my second example is for a REST server in Services 3.0, but it demonstrates the cURL handling - you'll just need to translate the first code example's packaging of the method parameters for XMLRPC transport.
And for your assurance, both code examples I've posted are taken directly from live sites using those implementations.
bsenftner at earthlink.net
On Mar 4, 2011, at 2:30 PM, jeff at ayendesigns.com wrote:
> After hours of searching, scouring, absorbing it was determined that there was little hope of (currently) getting past Services 2.4 and REST returning a 404 error, so I switched to xmlrpc.
> I have a simple script to hit my service from outside the site, fine-tuned a couple dozen times based on various recommendations, to currently be:
> $url = "http://localhost/mydomain/services/xmlrpc";
> $ch = curl_init();
> $data = 'method=my.method&id=12345&text=hello';
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($ch, CURLOPT_URL, $url);
> $response = curl_exec($ch);
> with $data as a string like above, I continuously receive: faultCode -32700 faultString Parse error. Request not well formed.
> If I change the postfields to be an array('method'=>'my.method','id'=>12345... I instead continuously receive a message that xmlrpc will only handle Post transactions.
> I am a non sequitur. Beware, the contents were packaged where peanuts are processed.
> <ayenlogo.jpeg>Ayen Designs
> 388 Bullsboro Drive #105 · Newnan, Georgia 30263
> Blog: theAccidentalCoder.com
> Drupal: j. ayen green (367108)
> IRQ: j_ayen_green
> IM (Yahoo) baalwww (MSN) baalwww at yahoo.com
> Skype: ayendesigns | Facebook: ayendesigns | Twitter: @ayendesigns
> Ayen Designs is the computer services division of <acmelogo.jpeg>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the development