3 Replies - 3299 Views - Last Post: 30 March 2013 - 08:31 AM Rate Topic: -----

#1 Keylogger  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 344
  • Joined: 14-February 11

PHP + MySQL + WebServices (nusoap)

Posted 30 March 2013 - 07:27 AM

Hi there,

I'm trying to create a 'wsdl' file which will contain all the information from database. So, in the server Nusoap I have:

<?php 
   mysql_connect('localhost','root'); 
   mysql_select_db('test'); 
   $query = "SELECT * FROM test"; 
   $result = mysql_query($query); 
   $all = array();
   while($row = mysql_fetch_assoc($result)){
	   $all[] = $row;
    }
  
require('nusoap/lib/nusoap.php'); 
$server = new nusoap_server(); 
$namespace = "http://localhost/test/server.php";
$server->configureWSDL('all_results', $namespace);
$server->schemaTargetNamespace = $namespace;
for($i = 0; $i < count($all); $i++){
	$server->register("results", 
            array('id' => 'xsd:int', $all[$i]["id"]), 
            array('name' => 'xsd:string', $all[$i]["name"]), $namespace); 
}


if(!isset($HTTP_RAW_POST_DATA)) {
   $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
}
$server->service($HTTP_RAW_POST_DATA); 
?>


First: Am I doing right in the server file?

Then, in the Client file:
<?php 
   require_once('nusoap/lib/nusoap.php'); 
   $namespace = 'http://localhost/test/server.php?wsdl'; 
   $client = new nusoap_client($namespace, 'wsdl');
   $param = array();
   $response = $client->call('results', $param);
   echo "<prev>";
   var_dump($response);
   echo "</prev>";
 ?>


It gives me the following error on client.php:

Quote

array (size=4)
'faultcode' => string 'SOAP-ENV:Client' (length=15)
'faultactor' => string '' (length=0)
'faultstring' => string 'error in msg parsing:
XML error parsing SOAP payload on line 1: XML_ERR_NAME_REQUIRED' (length=85)
'detail' => string '' (length=0)


Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: PHP + MySQL + WebServices (nusoap)

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6112
  • View blog
  • Posts: 23,672
  • Joined: 23-August 08

Re: PHP + MySQL + WebServices (nusoap)

Posted 30 March 2013 - 07:38 AM

Unless you're using PHP 4.x, there's no good reason to prefer nusoap over the builtin SOAPClient.
Was This Post Helpful? 0
  • +
  • -

#3 Keylogger  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 344
  • Joined: 14-February 11

Re: PHP + MySQL + WebServices (nusoap)

Posted 30 March 2013 - 07:56 AM

Well, it's the same for me, the problem is I want to do this. I've been searching alot alot..and nothing.
Was This Post Helpful? 0
  • +
  • -

#4 Keylogger  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 344
  • Joined: 14-February 11

Re: PHP + MySQL + WebServices (nusoap)

Posted 30 March 2013 - 08:31 AM

Nobody?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1