Solved

Error when I try my server php

Posted on 2016-08-10
6
52 Views
Last Modified: 2016-08-10
Hello guys,

I am studying php soap server, but when I try to run it, I got this message:

"This service does not provide a Web description"

this is my script

<?php
  require_once('lib/nusoap.php');
  
  $servername = "mysql01.teachmenow1.hospedagemdesites.ws";
  $username   = "teachmenow1";
  $password   = "xxxxxxxx";
  $dbnome     = "teachmenow1";  

  $server = new nusoap_server;

  //register a function that works on server
  $server ->register('listadownloads', array('value' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:server', 'urn:server# listadownloads');

  // create the function to fetch Data’s from Database
  function listadownloads ()
  {
          $conn = mysql_connect($servername, $username, $password, false) or print (mysql_error());
          mysql_select_db($dbnome);
		  $sql = "SELECT * FROM CADDOWNLOAD";
		  $retval = mysql_query( $sql, $conn);
          
          $q = mysql_query($sql);

          $items = array();
          while($row = mysql_fetch_array($q))
          {

                $items [] = array(
                              'nome'=>$row['nome'],
                              'cidade'=>$row['cidade']
                           );
          }
          return $items;

   }

  $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
  $server ->service($HTTP_RAW_POST_DATA);
?>

Open in new window



What is wrong? This is my link:

http://www.teachmenow.com.br/nusoap/server.php

Thanks
Alexandre
0
Comment
Question by:hidrau
  • 2
  • 2
  • 2
6 Comments
 
LVL 54

Accepted Solution

by:
Julian Hansen earned 250 total points
ID: 41750270
Try adding this between line 9 and 12
  $server->configureWSDL("listadownloads");

Open in new window

Also you might want to consider migrating of the mysql library - it has been deprecated in later versions of PHP in favour of mysqli / PDO.
1
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 250 total points
ID: 41750271
I don't think I can debug this for you, but I can suggest an alternative to SOAP.  I recommend using RESTful client/server methods to communicate between applications.  SOAP has largely been abandoned because of its opaque complexity, and support (when it still exists) is usually relegated to "legacy" status.  REST, on the other hand, is popular, transparent, and easy to understand.  

Here's an introductory article that may help you get started with a RESTful API.
https://www.experts-exchange.com/articles/12239/Introduction-to-Application-Programming-Interfaces.html

Here's some background about how servers communicate.
https://www.experts-exchange.com/articles/11271/Understanding-Client-Server-Protocols-and-Web-Applications.html

Here's why Julian wisely recommends that you get away from MySQL.
https://www.experts-exchange.com/articles/11177/PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html

HTH, ~Ray
1
 
LVL 1

Author Comment

by:hidrau
ID: 41750289
Hello Julian Hansen,

thanks a lot for your example, it worked fine.

Ray Paseur

Thanks a lot for your advice, for me everything is new and the proposal of my task is to make a communication from a desktop aplication and web database to storage data from my application.

My application was developed by delphi tools and now I need that resource, I need to send data to my database and backup them into another application that is another place.

You gave me many thinks to read and check, if I need to invest time, I can do it in right way :)
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 1

Author Closing Comment

by:hidrau
ID: 41750291
Thanks a lot
1
 
LVL 54

Expert Comment

by:Julian Hansen
ID: 41750298
You are welcome.
2
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 41750404
Best of luck with your project!
1

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question