Solved

Error when I try my server php

Posted on 2016-08-10
6
62 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 57

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 110

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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 1

Author Closing Comment

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

Expert Comment

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

Expert Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

738 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