PHP SoapClient not working - no error

17,721

I would check the installed PHP packages on the dev server and compare to the Prod server. fr2.php.net/manual/en/soap.setup.php

Share:
17,721
EmmyS
Author by

EmmyS

SOreadytohelp

Updated on June 28, 2022

Comments

  • EmmyS
    EmmyS almost 2 years

    I have some code that connects to a newsletter service via SOAP. It works with no problem on our dev server, but on our live server it doesn't work at all. It's not returning any errors; just a blank white page. I've put some error_logs into the code and found exactly where it stops working - on the line creating the new SoapClient. Is there some kind of server config that needs to be set? Our code is identical between dev and prod, so the only thing I can figure is a server issue. (Note that the first chunk of code below was provided by the newsletter service, not written by me.)

    # bronto API session/connection setup
    ini_set("soap.wsdl_cache_enabled", "0");
    date_default_timezone_set('America/Chicago');
    
    $wsdl = "https://api.bronto.com/v4?wsdl";
    $url = "https://api.bronto.com/v4";
    
    /*error log statements up to this point return what is expected; 
      an error log after the following line (starting with $client = new SoapClient) 
      does not get triggered at all. */
    
    $client = new SoapClient($wsdl, array('trace' => 1, 'encoding' => 'UTF-8')); 
    $client->__setLocation($url);
    
    $token = "XXX";
    $sessionId = $client->login(array("apiToken" => $token))->return;
    $client->__setSoapHeaders(array(new SoapHeader("http://api.bronto.com/v4",
            'sessionHeader',
             array('sessionId' => $sessionId))));
    

    I've also tried something like this to explicitly see any errors, but no luck - still nothing in the error log.

    try {  
      $client = @new SoapClient($wsdl, array('trace' => 1, 'encoding' => 'UTF-8')); 
    } 
      catch (SoapFault $E) {  
        error_log($E->faultstring) ;
    }  
    error_log("ok");