external_function_parameters, if two

external_function_parameters, if two

by JunOh Lee -
Number of replies: 0

 

// /local/[pluginame]/db/external.php

public static function get_someInfo_parameters() {
    return new external_function_parameters(array(
      'PARAM1' => new external_single_structure(
         array(
            'VAL1-1' => new external_value(PARAM_TEXT, '', VALUE_REQUIRED),
            'VAL1-2' => new external_value(PARAM_TEXT, '', VALUE_REQUIRED),
            'VAL1-3' => new external_value(PARAM_TEXT, '', VALUE_REQUIRED),
            'VAL1-4' => new external_value(PARAM_TEXT, '', VALUE_REQUIRED)
         )
      ),
      'PARAM2' => new external_single_structure(
         array(
            'VAL2-1' => new external_value(PARAM_TEXT),
            'VAL2-2' => new external_value(PARAM_TEXT),
            'VAL2-3' => new external_value(PARAM_TEXT),
            'VAL2-4' => new external_value(PARAM_TEXT)
         )
      )
   ));
}

 

public static function get_someInfo($PARAM1, $PARAM2) {

    $params = self::validate_parameters(self::get_users_lectures_parameters(), array("PARAM1"=>$PARAM1, "PARAM2" => $PARAM2));

    ....

    return $someResult;

}

 

public static function get_someInfo_returns() {
   return new external_multiple_structure(
      new external_single_structure(
         array(

            ...
         
         )
      )
   );
}

 

// /local/[pluginname]/test.php

 

$token = "....";
$serverurl = "....";

 

$param_1 = new stdClass();

$param_1_wrap = new stdClass();

$param_2 = new stdClass();

$param_2_wrap = new stdClass();

 

$param_1 -> $VAL1-1 = "...";

$param_1 -> $VAL1-2 = "...";

$param_1 -> $VAL1-3 = "...";

$param_1 -> $VAL1-4 = "...";

 

$param_1_wrap->PARAM1 = $param_1;

 

$param_2 -> $VAL2-1 = "...";

$param_2 -> $VAL2-2 = "...";

$param_2 -> $VAL2-3 = "...";

$param_2 -> $VAL2-4 = "...";

 

$param_2_wrap->PARAM2 = $param_2;

 

$client = new webservice_soapfda_client($serverurl, $token);

$client->setWsdlCache(false);

 

$response = $client->__call("local_[pluginname]_get_someInfo", array($param_1, $param_2));

 

 

 

 

 

 sad sad sad

\lib\zend\Zend\Soap\Client.php : 1113  __soapCall
SOAP-ERROR: Encoding: object has no 'PARAM2' property

 

 

 

Average of ratings: -