4. September 2018 11:18
$context = stream_context_create([
 'ssl' => [
 // set some SSL/TLS specific options
 'verify_peer' => false,
 'verify_peer_name' => false,
 'allow_self_signed' => true
 //'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT
 ]
]);
$options = array(
    'encoding' => 'UTF-8',
    'verifypeer' => false,
    'verifyhost' => false,
    'soap_version' => SOAP_1_2,
    'trace' => 1,
    'exceptions' => 1,
    'connection_timeout' => 180,
//                'cache_wsdl'=>WSDL_CACHE_NONE,
 "login" => $login, 
 "password" => $password, 
 "features" => SOAP_SINGLE_ELEMENT_ARRAYS, 
 "stream_context" => $context);
$page = new SoapClient($baseUrl, $options);
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'xxx' : failed to load external entity "xxx" in C:\Installation\xampp\htdocs\phptest\index.php:76 Stack trace: #0 C:\Installation\xampp\htdocs\phptest\index.php(76): SoapClient->SoapClient('http://....', Array) #1 {main} thrown in C:\Installation\xampp\htdocs\phptest\index.php on line 76
$ch = curl_init(); 
        
curl_setopt($ch, CURLOPT_URL, $baseUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);   
curl_setopt($ch, CURLOPT_USERPWD, 'xxx');   
curl_setopt($ch, CURLOPT_HTTPHEADER, [
//        'Method: GET', 
//      'User-Agent: PHP-SOAP-CURL',
//        'Content-Type: text/xml; charset=utf-8', 
//      'SOAPAction: Read', 
        'Connection: Keep-Alive',    
        'Accept: application/json',          
        'Content-Type: application/json; charset=utf-8',   
        "Accept:*"                       
]);   
$res = curl_exec($ch);
if( $res === false ) {
   echo 'Curl-Fehler (OData-Abfrage): ' . curl_error($ch).'<br />';
}
else {
   echo $res;
   $response = json_decode($res);
   echo json_encode($response, JSON_PRETTY_PRINT);
}
/* $response = json_decode(curl_exec($ch), TRUE);
echo json_encode($response, JSON_PRETTY_PRINT); */
// Close handle
curl_close($ch);
4. September 2018 13:08
4. September 2018 13:44
Error loading WDSL
There was something wrong with the WDSL you are trying to import
Error loading [http://xxx]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Unexpected end of file after nul
4. September 2018 13:58
HTTP/1.1 401 Unauthorized
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
WWW-Authenticate: NTLM
Date: Tue, 04 Sep 2018 11:55:01 GMT
4. September 2018 14:32
4. September 2018 17:39
5. September 2018 09:20
$baseUrl = "xxx"; // Pfad aus Navision Web Service
$usrpwd = "yyy"; // "user:pwd" > Domäne ist nicht mehr notwendig
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $baseUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_USERPWD, $usrpwd);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Connection: Keep-Alive',    
        'Accept: application/json',     
        'Content-Type: application/json; charset=utf-8'
]);   
$res = curl_exec($ch);
if ( curl_errno($ch) ) {
   print 'Curl-Fehler (OData-Abfrage):' . curl_error($ch);
}
else {
   $response = json_decode($res);
   curl_close($ch);
   
   echo '<br /><br /><pre>';
   print_r($response);
   echo '</pre><br /><br />';
   
}