dpo69086 2017-03-01 10:52
浏览 67

使用SOAP和PHP获取身份验证

I try to connect to SOAP with php and here is my code:

$wsdl = 'http://websiteservicesvplus.mpfrance.fr/WebServicesVPlus.asmx?wsdl';
$soap = new SoapClient($wsdl, $options);
$data = $soap->CheckConnection(
    array(
        'ApiKey'=>'63156585fd3e7a69d6e66c67a92b095b0b8b1478bedffc9137ba9cf8c1dc5088',
        'ApiTokenUserId'=>'5',
        'ApiTokenTypeId'=>'8'
    )
);
var_dump($data);
die;

After I run it on the browser, I got this message error only :

"Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\wamp\www\test\webservices\server1.php:23 Stack trace: #0 C:\wamp\www\test\webservices\server1.php(23): SoapClient->__call('CheckConnection', Array) #1 C:\wamp\www\test\webservices\server1.php(23): SoapClient->CheckConnection(Array) #2 {main} thrown in C:\wamp\www\test\webservices\server1.php on line 23"

Anyone can help me?

  • 写回答

1条回答 默认 最新

  • drj58429 2017-03-02 14:59
    关注

    First, I would use a WSDL to php generator to ease the SOAP Web Service consumption (like using the PackageGenerator project),

    Second, you're missing the SOAPHeader declared in:

    <wsdl:operation name="CheckConnection"> <soap12:operation soapAction="http://qpc.ebp.be/CheckConnection" style="document"/> <wsdl:input> <soap12:body use="literal"/> <soap12:header message="tns:CheckConnectionAuthHeader" part="AuthHeader" use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation>. Once again, using the project references before, it will be defined in the tutorial.php file in order to send it easily.

    评论

报告相同问题?

悬赏问题

  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?