Solved

Error when I try my server php

Posted on 2016-08-10
6
39 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 51

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 108

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Closing Comment

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

Expert Comment

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

Expert Comment

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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now