0

сервер

$server->wsdl->addComplexType(
    'complexReturn', 'complexType', 'struct', 'all', '',
    array(
    'id' => array('name' => 'id', 'type' => 'xsd:string'),
    'param' => array('name' => 'param', 'type' => 'xsd:string')
    )
);

$server->register('get', array('id' => 'xsd:string', 'param' => 'xsd:string'), //parameters
    array('return' => 'tns:complexReturn'), //output
    'urn:server', //namespace
    'urn:server#getServer', //soapaction
    'rpc', // style
    'encoded', // use
    'description');  //description

function get($id, $param)
{
  return array(
      'id' => $id,
      'param' => $param
  );
}

клиент

$client = new SoapClient("http://inner_work/test/nusoap/samples/server.php?wsdl",
      array(
      "trace" => 1,
      "exceptions" => 1,
      "cache_wsdl" => 0,
      "encoding" => "UTF-8",
      'soap_version' => SOAP_1_1,
      'style' => SOAP_DOCUMENT,
      'use' => SOAP_LITERAL,
      ));

  var_dump($client->get(array('id'=>'john', 'param'=>'doe')));

на выходе object(stdClass)#2 (2) { ["id"]=> string(5) "Array" ["param"]=> NULL }

как я могу в функции get использовать полученные переменные?

1

1 ответ 1

0

SOAP не принимает массивы. Должно быть описано через комплексный тип

   $server->register('get', array('data' => 'tns:complexRequest'), //parameters

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.