Frost
Новичок
SOAP server
Здравствуйте! Из каких-то примеров взял кусок кода для создания SOAP-сервера. Ошибок синтаксических не дает, но при попытке вызывать клиент выдает
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://mytest.ru/soap-server.php' in /var/www/mytest/soap-client.php:6 Stack trace: #0 /var/www/mytest/soap-client.php(6): SoapClient->SoapClient('http://my.orion...') #1 {main} thrown in /var/www/mytest/soap-client.php on line 6
Вот код сервера:
Вот код клиента:
Здравствуйте! Из каких-то примеров взял кусок кода для создания SOAP-сервера. Ошибок синтаксических не дает, но при попытке вызывать клиент выдает
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://mytest.ru/soap-server.php' in /var/www/mytest/soap-client.php:6 Stack trace: #0 /var/www/mytest/soap-client.php(6): SoapClient->SoapClient('http://my.orion...') #1 {main} thrown in /var/www/mytest/soap-client.php on line 6
Вот код сервера:
PHP:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
require_once('SOAP/Server.php');
class SOAP_Hello_Server
{
var $dispatch_map = array();
/* dispatch mapping is optional. It is used in non-wsdl servers to allow for being more explicit with what arguments and types are passed in and out.*/
/* Here's the constructor for out class. It is used to define
$dispath_map: */
function SOAP_Hello_Server()
{
$this->dispatch_map['helloWorld'] = array(
'in' => array('inmessage'=>'string'),
'out' => array('outmessage'=>'string')
);
}
function helloWorld($inmessage)
{
/* Generate a SOAP error if the argument was not valid: */
if($inmessage == '')
{
/* The SOAP error is generated by the SOAP_Fault class: */
$fault = new SOAP_Fault('You must supply a valid string!','12345');
return $fault->message();
}
else
{
/* If the argument is okay, we submit out return message: */
return "Hello $inmessage!";
}
}
}
$server = new SOAP_Server();
$soaphelloserver = new SOAP_Hello_Server();
$server->addObjectMap($soaphelloserver,array('namespace'=> 'urn:helloworld')););
$server->service($HTTP_RAW_POST_DATA);
?>
PHP:
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$client = new
SoapClient("http://my.orion-express.ru/soap-server.php");
$r = $client->helloWorld(array('inmessage' => 'asdasd'));