简体   繁体   中英

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);

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM