简体   繁体   English

创建客户端NuSoap时出错

[英]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 . 我必须使用一个Web服务,创建它的程序员为我提供了端点以及wsdl的链接。

How do I create the client ? 如何创建客户端? Using the wsdl link or the endpoint ? 使用wsdl链接还是端点?

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. new SoapClient的第一个参数期望您没有为其提供WSDL的WSDL。 Either change it to WSDL or give in the location/uri in the second parameter: 将其更改为WSDL或在第二个参数中输入location / uri:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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