PHP XML error parsing SOAP payload on line 3: Reserved XML Name -
this question has answer here:
i'm quite new webservices , soap, , followed tutorial , came code:
soap server :
<?php include("lib/nusoap.php"); include("getdb.php"); function getusers() { $user_id = $_get['user_id']; $result = mysql_query("select * -table name- user_id = '$user_id'"); $try = mysql_fetch_array($result); return join(",", array( $result['username'], $result['password'] )); } $server = new soap_server(); $server->register("getusers"); $server->service($http_raw_post_data); ?>
soap client :
<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title></title> <!-- error reporting --> <?php error_reporting(e_all); ini_set('display_errors', '1'); ?> </head> <body> <?php include("lib/nusoap.php"); $client = new nusoap_client("http://localhost/wp-content/themes/blackbird/phpwizard/html5application/public_html/webservice.php?user_id=4"); $error = $client->geterror(); if ($error) { echo "<h2>constructor error</h2><pre>" . $error . "</pre>"; } $result = $client->call("getusers", array("category" => "books")); if ($client->fault) { echo "<h2>fault</h2><pre>"; print_r($result); echo "</pre>"; } else { $error = $client->geterror(); if ($error) { echo "<h2>error</h2><pre>" . $error . "</pre>"; } else { echo "<h2>books</h2><pre>"; echo $result; echo "</pre>"; } } ?> </body> </html>
now when loading soap client i'm getting error:
xml error parsing soap payload on line 3: reserved xml name
i have no idea why happening.
try remove whitespace before <?xml
mentioned in question
xml error parsing soap payload: reserved xml name
also possible paste dump of nusoap client, in question can see whats being rendered. lets start debugging there , respond see on example.
additionally, here tutorial have used in past. php works soap give try before adding in layer of separate library unless need fancy it. try example see if works you.
ibm opensource php soapserverclient example.
Comments
Post a Comment