Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

php - SOAP-ERROR: Parsing WSDL: Couldn't load from <URL>

In PHP: I am getting an error:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://xxx.xxxx.asmx?WSDL' : failed to load external entity "http://xxx.xxxx.asmx?WSDL"

My code is:

<?php
header('Content-Type: text/plain');
if (!class_exists('SoapClient')) {
    die ("You haven't installed the PHP-Soap module.");
}

ini_set('max_execution_time', 1);
try {
    $options = array(
        'soap_version' => SOAP_1_2,
        'exceptions'   => true,
        'trace'        => 1,
        'cache_wsdl'   => WSDL_CACHE_NONE
    );
    $client = new SoapClient('http://xxx.xxxx.asmx?WSDL', $options);
    // Note where 'CreateIncident' and 'request' tags are in the XML
    $results = $client->CreateIncident(
        array(
            'FirstName'         => 'gyaan',
            'LastName'          => 'p',
            'Email'             => 'aa@gmail.com',
            'QueryProductClass' => 'QueryProductClass',
            'ChannelCode'       => 12,
            'CampaignCode'      => 234,
            'Lob'               => 'Lob',
            'PackageName'       => 'SEONI',
            'PackageCode'       => 'SMP',
            'TravelYear'        => 2012,
            'TravelMonth'       => 06,
            'TravelDay'         => 29,
            'CityOfResidence'   => 'Jabalpur',
            'ncidentNotes'      => 'testing ignor this',
            'MobilePhone'       => '1234567890',
            'DepartureCity'     => 'bangalore',
            'NoOfDaysTravel'    => '3 Days',
            'VendorName'        => 'TEST HIQ'
        )
    );
}
catch (Exception $e) {
    echo "<h2>Exception Error!</h2>";
    echo $e->getMessage();
}
?>

Please tell me where i am making mistake i am new in WSDL and soap

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I solved this on my WAMP setup by enabling the php_openssl extension, since the URL I was loading from used https://.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...