douji1877 2014-12-13 09:07
浏览 22

如何在PHP中使用经过验证的soap功能请提供任何工作示例

Fatal error: Uncaught SoapFault exception: [Client] Function ("AuthenticationHeader") is not a valid method for this service in D:\xampp\htdocs\soap\index_2.php:132 Stack trace: #0 D:\xampp\htdocs\soap\index_2.php(132): SoapClient->__call('AuthenticationH...', Array) #1 D:\xampp\htdocs\soap\index_2.php(132): SoapClient->AuthenticationHeader(Array) #2 {main} thrown in D:\xampp\htdocs\soap\index_2.php on line 132

  • 写回答

1条回答 默认 最新

  • dongliming2416 2014-12-13 09:20
    关注

    There are must be only one request, you send three. You must create something like this:

    1) Set header for authentication:

    $auth = $auth = new SOAPAuth('USERNAME', 'PASSWORD');
    $header = new SOAPHeader('urn:example.org/auth', 'AuthenticationHeader', $auth);
    $client->__setSoapHeaders($header);
    

    2) Create create request with message text and contacts.

    $result = $client->SendSMSToContacts(array("MessageText" => "some text", "contactIDs" => array(123456789, 123456789));
    
    P.S. For the debugging create client with:
    
    $client = new SoapClient($url, array('trace' => 1,
                'exceptions' => 1,));
    and after sending request, look on request that was sended and resopnse on it:
    
    var_dump("REQUEST=", $client->__getLastRequest());
    var_dump("RESPONSE=", $client->__getLastResponse());
    

    if you look at the error code you will see AuthenticationHeader is not a method! the error is very clear!

    use this

    or download soap ui. (google it!)

    and you will see what method are available!

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用