Answer the question
In order to leave comments, you need to log in
Pass parameter from PHP to 1C web service?
There is a web service in 1C, it has a method that should take 2 parameters.
I'm trying to call a method in php, but I'm doing something wrong with the parameters
Attempt #1
PHP code:
$SoapClient1C = new SoapClient("http://test.1c/WEB/ws/webservice?wsdl");
$BeginDate = date_create('2000-01-01');
$EndDate = date_create('2014-12-12');
$List = $SoapClient1C->getDDSFact($BeginDate,$EndDate);
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'BDate' property in C:\xampp\htdocs\site.dd\index.php:149 Stack trace: #0 C:\xampp\ htdocs\site.dd\index.php(149): SoapClient->__call('getDDSFact', Array) #1 C:\xampp\htdocs\site.dd\index.php(149): SoapClient->getDDSFact(Object (DateTime), Object(DateTime)) #2 {main} thrown in C:\xampp\htdocs\site.dd\index.php on line 149
$SoapClient1C = new SoapClient("http://test.1c/WEB/ws/webservice?wsdl");
$BeginDate = date_create('2000-01-01');
$EndDate = date_create('2014-12-12');
$List = $SoapClient1C->getDDSFact(array("BDate" => $BeginDate, "EDate" => $EndDate));
Fatal error: Uncaught SoapFault exception: [soap:Client] Unknown error. XDTO data validation failed: Value: '' does not match simple type: { http://www.w3.org/2001/XMLSchema}dateTime due to: XDTO data validation failed: Value: '' does not match simple type: { http: //www.w3.org/2001/XMLSchema}dateTime in C:\xampp\htdocs\site.dd\index.php:149 Stack trace: #0 C:\xampp\htdocs\site.dd\index.php( 149): SoapClient->__call('getDDSFact', Array) #1 C:\xampp\htdocs\site.dd\index.php(149): SoapClient->getDDSFact(Array) #2 {main} thrown in C: \xampp\htdocs\site.dd\index.php on line 149
Answer the question
In order to leave comments, you need to log in
You are passing dates as a DateTime object, and the method is likely expecting them to be a string. Try this option:
$SoapClient1C = new SoapClient("http://test.1c/WEB/ws/webservice?wsdl");
$List = $SoapClient1C->getDDSFact(array("BDate" => '2000-01-01', "EDate" => '2014-12-12'));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question