2 // Pull in the NuSOAP code
3 require_once('nusoap/lib/nusoap.php');
4 require("siap_ws_utils.php");
6 // Create the server instance
7 $server = new soap_server();
8 // Initialize WSDL support
9 $server->configureWSDL('siapwsdl', 'urn:siapwsdl');
12 // Register the data structures used by the service
13 $server->wsdl->addComplexType(
21 'palavra' => array('name' => 'palavra', 'type' => 'xsd:string'),
22 'procedencia' => array('name' => 'procedencia', 'type' => 'xsd:int'),
23 'sistema' => array('name' => 'sistema', 'type' => 'xsd:int'),
24 'patologia' => array('name' => 'patologia', 'type' => 'xsd:int'),
28 $server->wsdl->addComplexType(
36 'nome' => array('name' => 'nome', 'type' => 'xsd:string'),
37 'url'=> array('name'=> 'url', 'type'=> 'xsd:string'),
38 'procedencia' => array('name' => 'procedencia', 'type' => 'xsd:string'),
39 'sistema' => array('name' => 'sistema', 'type' => 'xsd:string'),
40 'patologia' => array('name' => 'patologia', 'type' => 'xsd:string'),
44 $server->wsdl->addComplexType(
51 'id' => array('name' => 'id', 'type' => 'xsd:int'),
52 'nome' => array('name' => 'nome', 'type' => 'xsd:string')
56 $server->register('get_search_types', // method name
57 array(), // input parameters
58 array('return' => 'tns:WordList'), // output parameters
59 'urn:siapwsdl', // namespace
60 'urn:siapwsdl#get_search_types', // soapaction
63 'Get an image from the SIAP database' // documentation
66 $server->register('get_search_type_keywords', // method name
67 array('search_type' => 'xsd:int'), // input parameters
68 array('return' => 'tns:WordList'), // output parameters
69 'urn:siapwsdl', // namespace
70 'urn:siapwsdl#get_search_type_keywords', // soapaction
73 'Get an image from the SIAP database' // documentation
76 $server->register('search', // method name
77 array('search_request' => 'tns:SearchRequest'), // input parameters
78 array('return' => 'tns:SearchResults'), // output parameters
79 'urn:siapwsdl', // namespace
80 'urn:siapwsdl#search', // soapaction
83 'Perform a search in the SIAP database' // documentation
86 function get_search_types()
88 // Not available in the database.
89 // Those are the search types available for images.
90 $search_types = array();
91 $search_types[] = array('id' => 1, 'nome' => 'Procedência');
92 $search_types[] = array('id' => 2, 'nome' => 'Sistema');
93 $search_types[] = array('id' => 3, 'nome' => 'Patologia');
97 function get_search_type_keywords($search_type)
103 $ret = get_keywords_by_search_type("procedencia");
106 $ret = get_keywords_by_search_type("sistema");
109 $ret = get_keywords_by_search_type("patologia");
117 function search($search_request) {
118 $result = simple_search($search_request['palavra'], $search_request['procedencia'], $search_request['sistema'], $search_request['patologia']);
123 // Use the request to (try to) invoke the service
124 $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
125 $server->service($HTTP_RAW_POST_DATA);