dnelson
dnelson

Reputation: 467

Why can't Soap connect to HTTPS?

I am trying to connect to a HTTPS location. Currently I get Could not connect to host error. I am testing on two Ubuntu servers. This error occurs on one Ubuntu server which is off site. The other server which is on a development server on site works fine. I searched the server files and have yet to find any differences in the systems that would cause this kind of issue. I have yet to find someone with a similar issue and tried many different solutions related to the same error message (e.g. disabling wsdl caching, etc...).

What should I look at next?

What testing can I do?

How can I get addition info about the error?

$sessionService = new SessionService('/path/to/local/file/SessionService.wsdl', array(
          'location' => "https://exampleurl.com/services/SessionService"
      ));

try {
    // throws SoapFault error   
    $token = @Login($sessionService, $username, $password);
}
catch (SoapFault $sf) {
    //echo $sf->getMessage());
    //echo $sf;
}

SessionService class:

class SessionService extends SoapClient {

    private static $classmap = array(
        'login' => 'login',
        'loginResponse' => 'loginResponse',
        ...
    );

    public function SessionService($wsdl = "http://localhost:8080/services/SessionService?wsdl", $options = array()) {
        foreach (self::$classmap as $key => $value) {
            if (!isset($options['classmap'][$key])) {
                $options['classmap'][$key] = $value;
            }
        }
        parent::__construct($wsdl, $options);
    }


    //fails here
    public function login(login $parameters) {
        return $this->__soapCall('login', array($parameters), array(
            'uri' => 'http://example.url.com',
            'soapaction' => ''
            )
        );
    }

    //... other functions

}

Upvotes: 0

Views: 1182

Answers (2)

WizardsOfWor
WizardsOfWor

Reputation: 3134

Make sure you have the openssl extension enabled in php.ini.

;for windows
extension=php_openssl.dll 
;for unix 
extension=openssl.so

Upvotes: 0

Sam Peck
Sam Peck

Reputation: 66

WireShark, tcpdump or a similar tool may be your best bet here, to understand what's going wrong with the http request(s). You're not going to be able to debug the actual http request from the client code in PHP as that's all in the SOAP extension (written in C).

Upvotes: 1

Related Questions