I
I
Ivan Vekov2018-10-08 12:17:57
PHP
Ivan Vekov, 2018-10-08 12:17:57

What could be wrong with SOAP if there is access via cURL?

There is a certain wsdl server, let's say " https://192.168.333.3/LNetworkServer/LNetworkServi... " (the address for the post is fictitious).
Opens fine in browser.
When I try to use SOAP, I get an error:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://sh333skd1-dev/LNetworkServer/LNetworkService.svc?wsdl=wsdl0' : failed to load external entity "https://sh333skd1-dev/LNetworkServer/LNetworkService.svc?wsdl=wsdl0"

If I try cURL, there are no errors, I can easily get XML.
The developers are silent, they gave me this code:
$wsdl = "https://192.168.333.3/LNetworkServer/LNetworkService.svc?wsdl";
    	$arrContextOptions=array(
        'ssl'=>array(
            'verify_peer'=>false,
            'verify_peer_name'=>false,
            'allow_self_signed' => true
        ),
      'https' => array(
                'curl_verify_ssl_peer'  => false,
                'curl_verify_ssl_host'  => false)
    );
    	$options =array(
      'trace' => 1,
    	'soap_version' => SOAP_1_1,
    	'location'=>'https://192.168.333.3/LNetworkServer/LNetworkService.svc',
    	'exceptions' => 1,
    	'cache_wsdl'=>WSDL_CACHE_NONE,
    	'verifypeer' => false,
        'verifyhost' => false,
    	'stream_context' => stream_context_create($arrContextOptions),
    	'login'=>'root', 'password'=>'1234' ,
    	'classmap' => array('AcsEmployeeSaveData' => "AcsEmployeeSaveData")
    	);
        //подключение 
  $client = new SoapClient($wsdl, $options);

I tried this one myself:
try {
    $opts = array(
        'ssl'=>array(
            'verify_peer'=>false,
            'verify_peer_name'=>false,
            'allow_self_signed' => true
        ),
      'https' => array(
                'curl_verify_ssl_peer'  => false,
                'curl_verify_ssl_host'  => false,
            	'user_agent' => 'PHPSoapClient',
                'allow_self_signed' => true
      )
    );
    $context = stream_context_create($opts);

    $wsdlUrl = 'https://192.168.333.3/LNetworkServer/LNetworkService.svc?wsdl';
    $soapClientOptions = array(
      'trace' => 1,
    	'location'=>'https://192.168.333.3/LNetworkServer/LNetworkService.svc',
    	'exceptions' => 1,
    	'cache_wsdl'=>0,
    	'verifypeer' => false,
        'verifyhost' => false,
    	'stream_context' => $context,
    	'login'=>'root', 'password'=>'1234' ,
    	'classmap' => array('AcsEmployeeSaveData' => "AcsEmployeeSaveData")
    );

    $client = new SoapClient($wsdlUrl, $soapClientOptions);
}
catch(Exception $e) {
  echo $e->getMessage();
}

Both options give the same error as described above.
SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://sh333skd1-dev/LNetworkServer/LNetworkService.svc?wsdl=wsdl0' : failed to load external entity "https://sh333skd1-dev/LNetworkServer/LNetworkService.svc?wsdl=wsdl0"

What is the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-10-08
@sxq

You need to check the address $wsdl = " https://192.168.333.3/LNetworkServer/LNetworkServi... "; it should open in a normal browser.
Are you sending a SOAP envelope with CURL or just making a GET/POST request?
perhaps you are not forming the correct envelope for yourself, bring the WSDL fragment of the function you are calling and the SOAP envelope you are sending

H
hack0013, 2019-10-04
@hack0013

Set
before $client = new SoapClient($wsdl, $options);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question