P
P
Pan Propan2015-05-16 12:33:31
PHP
Pan Propan, 2015-05-16 12:33:31

How to access the web service 1s ??

Published a web service for 1s.
When accessing a web service from SOAP UI,

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:sam="http://www.sample-package.org">
   <soap:Header/>
   <soap:Body>
      <sam:PoschitatDoxod>
         <sam:Data1>2015-01-01</sam:Data1>
         <sam:Data2>2015-05-01</sam:Data2>
      </sam:PoschitatDoxod>
   </soap:Body>
</soap:Envelope>

it produces the XML of the view.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
   <soap:Header/>
   <soap:Body>
      <m:PoschitatDoxodResponse xmlns:m="http://www.sample-package.org">
         <m:return xsi:type="m:Otchet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <m:strokaOtcheta>
               <m:doxod>7777777</m:doxod>
               <m:razxod>7777777</m:razxod>
               <m:podrazdelenie>Тест</m:podrazdelenie>
            </m:strokaOtcheta>
            <m:strokaOtcheta>
               <m:doxod>7777777</m:doxod>
               <m:razxod>7777777</m:razxod>
               <m:podrazdelenie>Тест</m:podrazdelenie>
            </m:strokaOtcheta>
            <m:strokaOtcheta>
               <m:doxod>7777777</m:doxod>
               <m:razxod>7777777</m:razxod>
               <m:podrazdelenie>Тест</m:podrazdelenie>
            </m:strokaOtcheta>
            <m:strokaOtcheta>
               <m:doxod>7777777</m:doxod>
               <m:razxod>7777777</m:razxod>
               <m:podrazdelenie>Тест</m:podrazdelenie>
            </m:strokaOtcheta>
         </m:return>
      </m:PoschitatDoxodResponse>
   </soap:Body>
</soap:Envelope>

That is, everything works out fine.
Now I'm trying to access the web service from PHP.
<?php 
error_reporting( E_ERROR ); // 1. Отключаем лишние сообщения 
ini_set("soap.wsdl_cache_enabled", "0" ); 
// 3. Устанавливаем soap-соединение 
$client = new SoapClient("http://localhost/doxod/ws/doxod.1cws?wsdl", 
array( 
'login' => null, //логин, аутентификацию выполнять не будем 
'password' => null, //пароль 
'trace' => true, 
'features' => SOAP_USE_XSI_ARRAY_TYPE, 
//'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5 
) 
); 

$params["Data1"] = 2015-01-01; 
$params["Data2"] = 2015-05-01; 

// 5. Выполняем операцию 
$result = $client->PoschitatDoxod($params)->return->strokaOtcheta;
// 6. Выводим результат на экран 
var_dump($result); 
?>

In the answer I receive only NULL. What did I do wrong?
If it's easy to receive
$result = $client->PoschitatDoxod($params)
, then the answer will be like this
object(stdClass)#2 (1) { ["return"]=> object(stdClass)#3 (0) { } }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pan Propan, 2015-05-16
@mgis

"Nubanul" something ...
It was necessary to enclose the parameters in quotation marks.

$params["Data1"] = "2015-01-01"; 
$params["Data2"] = "2015-05-01";

6
65536, 2015-05-16
@65536

I'm not sure, but maybe that's the problem. there, according to the scheme for single parameters, it is supposed to be sent as an array with I don’t remember which index, that is, something like $params["Data1"] = array('???' => 2015-01-01); I don’t remember how exactly, but I broke my head myself, then I forgot and broke it again

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question