PHP SOAP-ERROR: Parsing WSDL: Could not load

3

How are you?

I am making a connection to a Webservice server. Through PHP

To perform a test use SOAP-UI and the service responds correctly, but when making the connection with PHP I get the error

  

SOAP-ERROR: Parsing WSDL: Could not load from ' link ': failed to load external entity " link "

I already tried sending the context in PHP

    $opts = array('http'=>array('user_agent' => 'PHPSoapClient'));
    $context = stream_context_create($opts);
    $client = new SoapClient('http://urlwebservice',array('stream_context' => $context,'cache_wsdl' => WSDL_CACHE_NONE));

    $result = $client->WS_cotiza($xml);
    print_r($result);

I have searched several PHP codes to connect but nothing, and it still works in SOAP-IU and the url of the webservices if it is accessible from the browser

I hope your comments and hopefully you can help us.

Greetings

    
asked by Fernando 14.05.2017 в 21:34
source

1 answer

1

The URL is wrong; You should be able to see the WSDL if you open that URL in a browser and http://urlwebservice does not exist. Also create a SOAP client in a more simple way using the WSDL, the following names the functions configured in a public WSDL for test purposes:

$ws = new SoapClient('http://www.webservicex.com/globalweather.asmx?wsdl', ['trace' => 1, 'cache_wsdl' => WSDL_CACHE_NONE, 'user_agent' => 'Mi cliente SOAP']);
var_dump($ws->__getFunctions());

Only replace the URL with the one in your WSDL and you'll be fine.

    
answered by 15.05.2017 в 07:57