A
A
AlexEternal2015-03-29 19:00:24
PHP
AlexEternal, 2015-03-29 19:00:24

Soap-server doesn't return anything. How to fix this error?

Hello guys. I developed, well, how I developed, did everything according to the schemes on the Internet, my Soap-server application. I also wrote WSDL according to the scheme. Here are the sources.
News.php

<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
require_once("DB_Connect.php");
class news {
    function getByID ($id) {
        $ret=mysql_query("select * from followers where id=$id");
        $ret=mysql_fetch_row($ret);
        return $ret;
   }
}
#$rt=new news();
#echo "<pre>";
#print_r($rt->getByID(1));
#    echo "</pre>";
$server = new SoapServer("news.wsdl");
$server->setClass("news");
$server->handle();
?>

client.php
<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
$client = new SoapClient("http://bigben.ru/news.wsdl");
  try {
    $req="ibm";
    echo "<pre>[Request] =></b>\n[Answer] => <b>";
    print_r($client->getByID(1));
    echo "</b>\n</pre>\n";
  } catch (SoapFault $exception) {
    echo $exception;
  }
?>

DB_Connect.php
<?php 
$db=mysql_connect('localhost','root');
if (!$db)
    {
        echo "Unable to connect to DB: " . mysql_error();
        exit;
    }
if (!mysql_select_db('test'))
    {
        echo "Unable to select mydbname: " . mysql_error();
        exit;
    }
mysql_query("set character set utf8");
?>

news.wsdl
<?xml version='1.0' encoding='UTF-8'?>
<definitions 
name="news" 
targetNamespace="urn:news" 
xmlns:typens="urn:news" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns="http://schemas.xmlsoap.org/wsdl/" 
xmlns:typens0="http://bigben.ru/news.php">
    <message name="getByID">
        <part name="id"/>
    </message>
    <message name="getByIDResponse">
        <part name="getByIDReturn"/>
    </message>
    <portType name="newsPortType">
        <operation name="getByID">
            <input message="typens:getByID"/>
            <output message="typens:getByIDResponse"/>
        </operation>
    </portType>
    <binding name="newsBinding" type="typens:newsPortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="getByID">
            <soap:operation soapAction="urn:newsAction"/>
            <input>
                <soap:body namespace="urn:news" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:news" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
    </binding>
    <service name="newsService">
        <port name="newsPort" binding="typens:newsBinding">
            <soap:address location="http://bigben.ru/news.php"/>
        </port>
    </service>
</definitions>

I created a followers table in muscle. I added data to it. I turn to bigben.ru/news.php using the local machine - it seems to be a client in my case. So, initially there were errors with authorization, then I solved them, now when I contact the client, there is just an empty window. Can you tell me what I did wrong or what is causing this problem. Do not swear strongly, but I welcome criticism.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Centrino, 2015-03-29
@Centrino

Try to pledge first what you get when there is a request to the server, whether there is a request to your server at all, whether there is an attempt to select a database from the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question