<i id='YCtM9'><tr id='YCtM9'><dt id='YCtM9'><q id='YCtM9'><span id='YCtM9'><b id='YCtM9'><form id='YCtM9'><ins id='YCtM9'></ins><ul id='YCtM9'></ul><sub id='YCtM9'></sub></form><legend id='YCtM9'></legend><bdo id='YCtM9'><pre id='YCtM9'><center id='YCtM9'></center></pre></bdo></b><th id='YCtM9'></th></span></q></dt></tr></i><div id='YCtM9'><tfoot id='YCtM9'></tfoot><dl id='YCtM9'><fieldset id='YCtM9'></fieldset></dl></div>
    <bdo id='YCtM9'></bdo><ul id='YCtM9'></ul>
<tfoot id='YCtM9'></tfoot>

  • <small id='YCtM9'></small><noframes id='YCtM9'>

      1. <legend id='YCtM9'><style id='YCtM9'><dir id='YCtM9'><q id='YCtM9'></q></dir></style></legend>

        “未将对象引用设置为对象的实例"从 PHP 连接

        时间:2023-05-22
          <bdo id='toBjJ'></bdo><ul id='toBjJ'></ul>
            1. <small id='toBjJ'></small><noframes id='toBjJ'>

                <tfoot id='toBjJ'></tfoot>

              1. <i id='toBjJ'><tr id='toBjJ'><dt id='toBjJ'><q id='toBjJ'><span id='toBjJ'><b id='toBjJ'><form id='toBjJ'><ins id='toBjJ'></ins><ul id='toBjJ'></ul><sub id='toBjJ'></sub></form><legend id='toBjJ'></legend><bdo id='toBjJ'><pre id='toBjJ'><center id='toBjJ'></center></pre></bdo></b><th id='toBjJ'></th></span></q></dt></tr></i><div id='toBjJ'><tfoot id='toBjJ'></tfoot><dl id='toBjJ'><fieldset id='toBjJ'></fieldset></dl></div>
                <legend id='toBjJ'><style id='toBjJ'><dir id='toBjJ'><q id='toBjJ'></q></dir></style></legend>

                    <tbody id='toBjJ'></tbody>
                • 本文介绍了“未将对象引用设置为对象的实例"从 PHP 连接到 SOAP 服务器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我第一次尝试从 PHP 连接到 SOAP 服务器,但我不明白如何登录并获取我需要的数据.我尝试连接的服务是 Hawley USA 服务 http://hawleyusa.com/thcServices/StoreServices.asmx).我一直在看一些关于如何连接的帖子,我了解了一些基础知识.我已经确认我在我的 PHP 中启用了 SOAP,我只是想获取一个库存列表.这是我正在使用的代码:

                  ";print($client->InventoryList(array("LoginID" => $login_id, "Password" => $password)));回声
                  ";}捕获(SoapFault $exception){回声 $exception;}

                  但是,当我运行此代码时,出现此错误:

                  SoapFault 异常:[soap:Server] 服务器无法处理请求.--->你调用的对象是空的.在/Users/steve/Sites/mysite/hawley_client.php:12

                  在调试时,我可以看到 $client 实例已启动,所以我不确定为什么会出现此错误.

                  第二个问题:我是否正确传递了用户名和密码?

                  谢谢.

                  更新:我输入了 $client->__getLastRequest,这就是我得到的:

                  所以我可以看到我丢失了我的登录 ID 和密码.如何将它们添加到我的 InventoryList 调用中?

                  解决方案

                  离你很近了.查看 WSDL,InventoryList 方法采用一个名为请求"的对象.稍微修改您的电话线路:

                  $client->InventoryList(array("request" => array("LoginId" => $login_id, "Password" => $password));

                  I'm making my first attempt to connect to a SOAP server from PHP, and I'm not understanding how to log in and get the data I need. The service I'm trying to connect to is the Hawley USA service http://hawleyusa.com/thcServices/StoreServices.asmx). I've been looking at a few posts on how to connect, and I get the basics. I've verified that I have SOAP enabled in my PHP, and I'm just trying to get an inventory list. Here's the code I'm using:

                  <?php
                  ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
                  $wsdl_path = "http://hawleyusa.com/thcServices/StoreServices.asmx?WSDL";
                  
                  $login_id = 'mylogin_id';
                  $password = 'mypassword';
                  
                  $client = new SoapClient($wsdl_path);
                  
                  try {
                    echo "<pre>
                  ";
                    print($client->InventoryList(array("LoginID" => $login_id, "Password" => $password)));
                    echo "
                  ";
                  }
                  catch (SoapFault $exception) {
                    echo $exception;      
                  } 
                  

                  However, when I run this code, I get this error:

                  SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in /Users/steve/Sites/mysite/hawley_client.php:12
                  

                  When debugging, I can see the $client instance initiated, so I'm not sure why I'm getting this error.

                  Second question: Am I passing the user ID and password correctly?

                  Thanks.

                  Update: I threw in $client->__getLastRequest, and this is what I got:

                  <?xml version="1.0" encoding="UTF-8"?>
                  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"              xmlns:ns1="http://hawleyusa.com/thcServices/">
                  <SOAP-ENV:Body>
                  <ns1:InventoryList/>
                  </SOAP-ENV:Body>
                  </SOAP-ENV:Envelope>
                  

                  So I can see that I'm missing my login ID and password. How do I add them to my InventoryList call?

                  解决方案

                  You're close. Looking at the WSDL the InventoryList method takes an object called "request". Modify your call line slightly:

                  $client->InventoryList(array("request" => array("LoginId" => $login_id, "Password" => $password));
                  

                  这篇关于“未将对象引用设置为对象的实例"从 PHP 连接到 SOAP 服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                    <bdo id='OreMy'></bdo><ul id='OreMy'></ul>
                    <tfoot id='OreMy'></tfoot>
                    <i id='OreMy'><tr id='OreMy'><dt id='OreMy'><q id='OreMy'><span id='OreMy'><b id='OreMy'><form id='OreMy'><ins id='OreMy'></ins><ul id='OreMy'></ul><sub id='OreMy'></sub></form><legend id='OreMy'></legend><bdo id='OreMy'><pre id='OreMy'><center id='OreMy'></center></pre></bdo></b><th id='OreMy'></th></span></q></dt></tr></i><div id='OreMy'><tfoot id='OreMy'></tfoot><dl id='OreMy'><fieldset id='OreMy'></fieldset></dl></div>

                        • <legend id='OreMy'><style id='OreMy'><dir id='OreMy'><q id='OreMy'></q></dir></style></legend>

                          <small id='OreMy'></small><noframes id='OreMy'>

                            <tbody id='OreMy'></tbody>