Answer the question
In order to leave comments, you need to log in
PHP problem with request to SOAP service
Hi people!
Such a problem. There is a certain remote WSDL service, it is required to execute one of its functions.
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl',0);
$client = new SoapClient() connects;
print_r( $client->__getFunctions() ); prints all available functions, in particular the one to be called:
Array ( [0] =>… [3] => string create(string $label, string $sender, ArrayOfString $data) )
Forming array data
$data_param = array( 'str1', 'str2' );
When trying to call
$results = $client->create( "Label here", "Sender", $data_param );
I get
Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host
It turns out to get a list of functions, it can be cut, but not to execute a request.
I tried calling the function differently, to no avail:
$results = $client->__SoapCall('create', "Label here", "Sender", array('parameters' => $data_param));
$results = $client->__SoapCall('create', "Label here", "Sender", $data_param);
$results = $client->__SoapCall('create', array( 'parameters' => array("Label here", "Sender", $data_param ) ) );
Also tried increasing `default_socket_timeout`
ini_set('default_socket_timeout',820);
uselessly.
Communication with another service is normal, i.e. on the server with SOAP functions everything seems to be normal.
Tell me where to dig.
Answer the question
In order to leave comments, you need to log in
OK. It turned out that the URL of the description of the service to which we connect in $client = new SoapClient( URL?WSDL ) differs from the one we need to work with. For this case, the SoapClient constructor has a second parameter in which you can pass an associative array, and in particular "location"
$client = new SoapClient(
'URL?WSDL',
array(
"location" => "URL"
)
);
Things like this :)
I had a similar problem, but it was the other way around. In the crooked wsdl for actions, the local ip was specified
<wsdl:port name="VersionHttpSoap12Endpoint" binding="ns:VersionSoap12Binding">
<soap12:address location=" 192.168.0.1 :8080/axis2/services/Version.VersionHttpSoap12Endpoint"/>
< /wsdl:port>
like this
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question