I'm trying to test the module with a sample web service from http://www.thomas-bayer.com/sqlrest
An example query would be: http://www.thomas-bayer.com/sqlrest/CUSTOMER/51
I keep getting errors in dblog saying: Error invoking the REST service sqlrest, operation CUSTOMER: Not Found
Here is the export of my web service description:
{
"settings" : [],
"operations" : { "CUSTOMER" : {
"url" : "CUSTOMER\/@id",
"label" : "CUSTOMER",
"parameter" : { "id" : { "type" : "text" } },
"result" : { "type" : "CUSTOMER_RESULT", "label" : "CUSTOMER INFO" },
"name" : "CUSTOMER"
}
},
"datatypes" : { "CUSTOMER_RESULT" : {
"label" : "CUSTOMER_RESULT",
"property info" : {
"ID" : { "type" : "text", "label" : "ID" },
"FIRSTNAME" : { "type" : "text", "label" : "FIRSTNAME" },
"LASTNAME" : { "type" : "text", "label" : "LASTNAME" },
"STREET" : { "type" : "text", "label" : "STREET" },
"CITY" : { "type" : "text", "label" : "CITY" }
},
"name" : "CUSTOMER"
}
},
"global_parameters" : [],
"name" : "sqlrest",
"label" : "sqlrest",
"url" : "http:\/\/www.thomas-bayer.com\/sqlrest",
"type" : "rest",
"authentication" : null,
"rdf_mapping" : []
}
Comments
Comment #1
tko commentedHave also tried programatically (same error happening) with:
$service = new WSClientServiceDescription();
$service->name = 'sqlr';
$service->label = 'SQLRest';
$service->url = 'http://www.thomas-bayer.com/sqlrest';
$service->type = 'rest';
$service->datatypes = array(
'customer_result' => array(
'label' => 'Customer result',
'property info' => array(
'ID' => array(
'type' => 'integer',
'label' => 'ID',
),
'FIRSTNAME' => array(
'type' => 'text',
'label' => 'FIRSTNAME',
),
'LASTNAME' => array(
'type' => 'text',
'label' => 'LASTNAME',
),
),
),
);
$operation = array();
$operation['label'] = 'Customer';
$operation['url'] = 'CUSTOMER/@ID';
$operation['parameter']['ID'] = array('type' => 'integer', 'label' => 'ID');
$operation['result'] = array('type' => 'wsclient_sqlr_customer_result', 'label' => 'Customer result');
$service->operations['CUSTOMER'] = $operation;
$services[$service->name] = $service;
Comment #2
klausiYou forgot a slash "/" either at the end of the service URL of the beginning of the operation URL.
And this will not work with JSON, you need to specify the XML format in the web service description (currently not possible in the UI, see #1280332: Advanced REST service formatters + UI setting).