http://services.pduda.waw.pl/
Tutaj jest kod index.php mojego serwera soap
CODE
<?php
$url = trim($_SERVER['REQUEST_URI'], "/");
$url=explode("?", $url);
$url = explode("/", $url[0]);
switch ($url[0])
{
case "websites": { require_once("includes/websitesApi.inc"); die();} break;
case "detection": { require_once("includes/detectionApi.inc"); } die(); break;
case "group": { require_once("includes/groupApi.inc"); } die(); break;
case "mobiles": { require_once("includes/mobilesApi.inc"); } die(); break;
default: { phpinfo();} break;
}
?>
$url = trim($_SERVER['REQUEST_URI'], "/");
$url=explode("?", $url);
$url = explode("/", $url[0]);
switch ($url[0])
{
case "websites": { require_once("includes/websitesApi.inc"); die();} break;
case "detection": { require_once("includes/detectionApi.inc"); } die(); break;
case "group": { require_once("includes/groupApi.inc"); } die(); break;
case "mobiles": { require_once("includes/mobilesApi.inc"); } die(); break;
default: { phpinfo();} break;
}
?>
Tutaj jest kod detectionApi.inc uprzedzając pytania reszta albo działa ( websitesApi działa a jest napisane w podobnym stylu tylko, że tutaj mamy client i serwer w PHP), albo na razie jest pusta, albo ropi co innego
CODE
<?php
require_once("lib/nusoap.php");
require_once("config/general.inc");
require_once("config/sql.inc");
ini_set("soap.wsdl_cache_enabled", "0");
$ns="http://services.pduda.waw.pl/detection";
$server = new soap_server();
$server->configureWSDL('DetectionServices');
$server->wsdl->schemaTargetNamespace = $ns;
$server->soap_defencoding='utf-8';
$server->xml_encoding = "utf-8";
$server->decode_utf8=true;
$server->wsdl->addComplexType
(
'RoadObject',
'complexType',
'struct',
'sequence',
'',
array
(
'Id' => array('name'=>'Id', 'type'=>'xsd:int'),
'Type' => array('name'=>'Type', 'type'=>'xsd:int'),
'Latitude' => array('name'=>'Latitude','type'=>'xsd:int'),
'Longitude' => array('name'=>'Longitude','type'=>'xsd:int')
)
);
function addRoadObject($who)
{
$test=print_r($who,true);
$query="INSERT INTO `road_services`.`UserType` (`IdUserType`, `Name`, `Description`) VALUES (1, '', '$test');";
Database::sqlQuery($query);
return 0;
}
$server->register
(
'addRoadObject',
array('who'=>'tns:RoadObject'),
array('return'=>'xsd:int'),
$ns,
false,
'rpc',
'literal',
'Adds RoadObject to database'
);
$server->wsdl->addComplexType
(
'RoadObjectsList',
'complexType',
'array',
'sequence',
'',
array(
array(
'name'=>'x',
'type'=>'tns:RoadObject',
'minOccurs'=>'0',
'maxOccurs'=>'unbounded'
)
)
);
function getVerifiedRoadObjects()
{
return array
(
array('Id'=>1, 'Type'=>1, 'Latitude'=>'52.09537619', 'Longitude'=>'21.029355'),
array('Id'=>2, 'Type'=>2, 'Latitude'=>'52.09614776', 'Longitude'=>'21.02913225')
);
}
$server->register
(
'getVerifiedRoadObjects',
array(),
array('return'=>'tns:RoadObjectsList'),
$ns,
false,
'rpc',
'literal',
'Returns RoadObjects List'
);
$myFile = "detectionApiTest.txt";
$fh = fopen($myFile, 'w');
fwrite($fh, print_r($server,true));
fclose($fh);
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
require_once("lib/nusoap.php");
require_once("config/general.inc");
require_once("config/sql.inc");
ini_set("soap.wsdl_cache_enabled", "0");
$ns="http://services.pduda.waw.pl/detection";
$server = new soap_server();
$server->configureWSDL('DetectionServices');
$server->wsdl->schemaTargetNamespace = $ns;
$server->soap_defencoding='utf-8';
$server->xml_encoding = "utf-8";
$server->decode_utf8=true;
$server->wsdl->addComplexType
(
'RoadObject',
'complexType',
'struct',
'sequence',
'',
array
(
'Id' => array('name'=>'Id', 'type'=>'xsd:int'),
'Type' => array('name'=>'Type', 'type'=>'xsd:int'),
'Latitude' => array('name'=>'Latitude','type'=>'xsd:int'),
'Longitude' => array('name'=>'Longitude','type'=>'xsd:int')
)
);
function addRoadObject($who)
{
$test=print_r($who,true);
$query="INSERT INTO `road_services`.`UserType` (`IdUserType`, `Name`, `Description`) VALUES (1, '', '$test');";
Database::sqlQuery($query);
return 0;
}
$server->register
(
'addRoadObject',
array('who'=>'tns:RoadObject'),
array('return'=>'xsd:int'),
$ns,
false,
'rpc',
'literal',
'Adds RoadObject to database'
);
$server->wsdl->addComplexType
(
'RoadObjectsList',
'complexType',
'array',
'sequence',
'',
array(
array(
'name'=>'x',
'type'=>'tns:RoadObject',
'minOccurs'=>'0',
'maxOccurs'=>'unbounded'
)
)
);
function getVerifiedRoadObjects()
{
return array
(
array('Id'=>1, 'Type'=>1, 'Latitude'=>'52.09537619', 'Longitude'=>'21.029355'),
array('Id'=>2, 'Type'=>2, 'Latitude'=>'52.09614776', 'Longitude'=>'21.02913225')
);
}
$server->register
(
'getVerifiedRoadObjects',
array(),
array('return'=>'tns:RoadObjectsList'),
$ns,
false,
'rpc',
'literal',
'Returns RoadObjects List'
);
$myFile = "detectionApiTest.txt";
$fh = fopen($myFile, 'w');
fwrite($fh, print_r($server,true));
fclose($fh);
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
Kody klas javowych wygenerowalem przy użyciu Axis2 i JAX-WS, zaś klienta C# tworzyłem przy użyciu narzędzi VS2010. Wszystko kody załączone są niżej w paczce z dodatkiem plików wire sharkowych pobranych podczas próby komunikacji między klientem a serwerem.
http://uplodzik.pl/download.php?uid=P9RNDZUP
Widzicie, gdzie może tkwić błąd ? lub może ktoś rozwiązywał podobny problem, ale w inny sposób i jest w stanie doradzić jakieś inne podejście
Z góry dzięki za pomoc