douxi2011 2014-12-02 11:31
浏览 66

创建客户端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!!";
}
  • 写回答

1条回答 默认 最新

  • dousi2013 2014-12-02 11:37
    关注

    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/"));
    
    评论

报告相同问题?

悬赏问题

  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了