2012-02-16 3 views
0

サービスを登録しましたが、呼び出したときには呼び出し自体は機能しますが、返されるデータは「false」です。私は何が間違っているのか分からず、私はそれについての情報を見つけることができません。誰でも私を助けてくれますか?Drupalカスタムサービス(サービスモジュール)

私はそれを呼び出すためにどこかにこのコードを使用
function services_sso_server_extension_services_resources() { 
    return array(
     'mia' => array(
      'actions' => array(
       'retrieve' => array(
        //'help' => 'retrieves the corresponding user on the server', 
        'file' => array('type' => 'inc', 'module' => 'services_sso_server_extension', 'name' => 'resources/extension'), 
        'callback' => '_sso_server_retrieve', 
        'args' => array(
         array(
          'name' => 'id', 
          'type' => 'int', 
          'description' => 'The id of the note to get', 
          'source' => array('path' => '0'), 
          'optional' => TRUE, 
         ), 
        ), 
        'access callback' => '_sso_server_access', 
        'file' => array('type' => 'inc', 'module' => 'services_sso_server_extension', 'name' => 'resources/extension'), 
        'access arguments' => array('view'), 
        'access arguments append' => TRUE, 
       ), 
       'action' => array(
        //'help' => 'retrieves the corresponding user on the server', 
        'file' => array('type' => 'inc', 'module' => 'services_sso_server_extension', 'name' => 'resources/extension'), 
        'callback' => '_sso_server_get_action', 
        'args' => array(
         array(
          'name' => 'clientsid', 
          'type' => 'varchar', 
          'description' => 'The sid of the client to which the communication is bound', 
          'source' => array('path' => '0'), 
          'optional' => TRUE, 
         ), 
        ), 
        'access callback' => '_sso_server_access', 
        'file' => array('type' => 'inc', 'module' => 'services_sso_server_extension', 'name' => 'resources/extension'), 
        'access arguments' => array('view'), 
        'access arguments append' => TRUE, 
       ), 
      ), 
     ), 
    ); 
} 

function services_checkuser() { 
    global $user; 
    $sid = $user->sid; 

    $options = array(
     'headers' => array(
      'Cookie' => $_SESSION['gsid'], 
      'Accept' => 'application/json', 
      'clientsid' => $sid 
     ), 
     'method' => 'POST', 
    ); 

    $response = drupal_http_request('http://sso.server:8080/usercheck/mia/action', $options); 
    $data = json_decode($response->data); 
} 

答えて

0

[OK]を、私はデータをポストする方法を見つけた:

$data = array('gsid' => $gsid); 

$options = array(
    'headers' => array(
     'Cookie' => $_SESSION['broker_sid'], 
     'Accept' => 'application/json', 
    ), 
    'method' => 'POST', 
    'data' => http_build_query($data) 
); 
関連する問題