Answer the question
In order to leave comments, you need to log in
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();
?>
<?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;
}
?>
<?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");
?>
<?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>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question