简体   繁体   中英

Error creating client NuSoap

I have to consume a webservice , the programmer who created it gave me the endpoint and also the link of the wsdl .

How do I create the client ? Using the wsdl link or the endpoint ?

When I try to connect I have the following return

"Warning: SoapClient::SoapClient(http://mv114.agraria.coop.br:50000/XISOAPAdapter/MessageServlet?channel=:BC_SOAP_CV:CC_SOAP_CV_Sender) [function.SoapClient-SoapClient]: failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized in /srv/www/htdocs/wwwintranet/nusoap_ex/sap_xml.php on line 6

Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/O warning : failed to load external entity "http://mv114.agraria.coop.br:50000/XISOAPAdapter/MessageServlet?channel=:BC_SOAP_CV:CC_SOAP_CV_Sender" in /srv/www/htdocs/wwwintranet/nusoap_ex/sap_xml.php on line 6

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://mv114.agraria.coop.br:50000/XISOAPAdapter/MessageServlet?channel=:BC_SOAP_CV:CC_SOAP_CV_Sender' in /srv/www/htdocs/wwwintranet/nusoap_ex/sap_xml.php:6 Stack trace: #0 /srv/www/htdocs/wwwintranet/nusoap_ex/sap_xml.php(6): SoapClient->SoapClient('http://mv114.ag...') #1 {main} thrown in /srv/www/htdocs/wwwintranet/nusoap_ex/sap_xml.php on line 6"

The code:

require_once('nusoap.php');

$client = new SoapClient('http://mv114.agraria.coop.br:50000/XISOAPAdapter/MessageServlet?channel=:BC_SOAP_CV:CC_SOAP_CV_Sender');

//$client = new SoapClient('http: //mv114.agraria.coop.br:50000/dir/wsdl?p=ic/55b6a9155f353207b6e7c92f548bbb98');
$client->setHTTPProxy("http: //wmv114.agraria.coop.br",50000,"WSPO","WAgr9876");

$err = $client->getError();
if ($err){
    echo "Error". $err.;
}
else
{
    echo "OK!!";
}

The first parameters in new SoapClient expects a WSDL you're not giving it a WSDL. Either change it to WSDL or give in the location/uri in the second parameter:

$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
                                     'uri'      => "http://test-uri/"));

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