Hi
I wanted to create a soap server for my project and I am planning to user the services module along with soap_server.
But when testing these Im getting an error message which says
"XML error parsing SOAP payload on line 1: Space required"
These are the modules I have installed
Drupal 6.17
Services - 6.x-2.4
soap_server - 6.x-1.2-beta1 with the patch from http://drupal.org/files/issues/751326.patch
Followed the steps mentioned in the link http://drupal.org/node/1101362
After this enabled the 'system' module services and tried accessing the method 'system.getServices' using a PHP.
Im getting the above mentioned XML error message and the output.
The PHP code is
<?php
require_once('nusoap/lib/nusoap.php');
$domain = 'test.localhost';
$kid = '2df30b8f761ab301b12dc4973d2edf9d';
$nonce = user_password();
$method_name = 'system.getServices';
$timestamp = (string) strtotime("now");
// now prepare a hash
$hash_parameters = array(
$timestamp,
$domain,
$nonce,
$method_name,
);
// create a hash using our API key
$hash = hash_hmac("sha256", implode(';', $hash_parameters), $kid);
$useCURL = '1';
$client = new nusoap_client("http://soap_server.localhost/services/soap?wsdl", true);
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
exit();
}
$client->setUseCurl($useCURL);
$client->soap_defencoding = 'UTF-8';
$params = array(
'hash' => $hash,
'domain_name' => $domain,
'domain_time_stamp' => $timestamp,
'nonce' => $nonce
);
$result = $client->call($method_name, $params, '', '');
if ($client->fault) {
echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>'; print_r($result); echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
}
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
?>
Could anyone please help me on this.
Comments
On further analysis is seems
On further analysis is seems that the XML parsing is getting failed and hence the above error is coming
when checking the XML which is getting parsed, is having tags as
<access callback xsi:type="xsd:string">user_access</access callback>
<access arguments xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[1]"><item xsi:type="xsd:string">get available services</item></access arguments>
from these it can be seen that the tags are having 'space' value eg: access callback; which might be causing the issue
Is this a normal scenario? How can I remove these tags?