Chris McKnight
Chris McKnight

Reputation: 8590

PHP WSDL SOAP Can't Import Schema

I'm trying to use an external webservice but I get the error Parsing Schema: can't import schema from webservice_url. The service uses HTTP Basic authentication and is using SSL. I can login via a web browser and see the xml it produces but I can't change what is generated since it is not my code generating the xml. I have the following code.

$config = array('login' => $user_id, 'password' => $password);
$client = new SoapClient($url, $config);

Upvotes: 0

Views: 4510

Answers (2)

Chris McKnight
Chris McKnight

Reputation: 8590

Well after researching and reading a bunch of articles online it seems like this is a limitation of php-soap and some suggestions point at using curl to accomplish. I actually decided to avoid PHP entirely since I just learned Ruby and have been going away from PHP. I accomplished my above task by using the Savon gem which has some pretty good documentation on the authentication and setting the cookie. It works great using this gem.

Upvotes: 1

davidfmatheson
davidfmatheson

Reputation: 3567

I found this on the SoapClient manual page's comment section:

<?php 

$login = 'someone';
$password = 'secret';

$client = new SoapClient(
    'https://' . urlencode($login) . ':' . urlencode($password) . '@www.server.com/path/to/wsdl',
    array(
        'login' => $login,
        'password' => $password
    )
);

?>

Seems like the basic authentication is for the endpoint invocation, not the WSDL retrieval.

Upvotes: 0

Related Questions