在php中使用ASP.NET WebService并返回soap错误

发布于 2024-11-08 07:27:55 字数 2172 浏览 0 评论 0原文

我正在尝试在 php 中调用 .net webservice 下面是我的代码。

<?php
    $client = new SoapClient("http://test.etech.net/PanelIntegration/PanelIntegration.asmx?wsdl");

         <?php  
         $sh_param = array( 
                            'Username'    =>    'IntegratorLPI', 
                            'Password'    =>    'password531'); 
                $headers = new SoapHeader('http://wms.etech.net/', 'UserCredentials', $sh_param);
                 $client->__setSoapHeaders($headers);   



                $params = array('CustomerName' => 'Mr Smith','ContactMobileNo' => '01237 376347',
                                'AddressLine1' => '33 Amblecote Road',
                                'AddressTown' => 'Cambridgeshire',
                                'AddressPostCode' => 'NW23 6TR',
                                'VendorAddressLine1' => '80 Norton Road',
                                'VendorAddressTown' => 'Hickley ',
                                'VendorAddressCounty' => 'Cambridgeshire',
                                'VendorAddressPostCode' => 'NW23 2AQ',
                                'RegionalOfficeID' => '3',
                                'ExternalNotes' => 'Case Accepted',
                                'UPRN' => '',
                                'InstructionTypeID' => '2',
                                'PropertyTypeID' => '11',
                                'PropertyTenure' => '2',
                                'SurveyorID' => '23',
                                'RRN' => '0240-9002-0391-3520-0020',
                                'NewInstruction'=> 'true',
                                'StatusID' => '1'
                                );
                $result = $client->__soapCall("UpdateInstruction", $params );

                print_r(    $result);

    ?>

我有这个错误 致命错误:未捕获 SoapFault 异常:[soap:Server] 服务器无法处理请求。 --->你调用的对象是空的。在 C:\xampp\htdocs\test2.php:33 堆栈跟踪: #0 C:\xampp\htdocs\test2.php(33): SoapClient->__soapCall('UpdateInstructi...', Array) #1 { main} 抛出在 C:\xampp\htdocs\test2.php 第 33 行

i am trying to calling .net webservice in php
below is my code.

<?php
    $client = new SoapClient("http://test.etech.net/PanelIntegration/PanelIntegration.asmx?wsdl");

         <?php  
         $sh_param = array( 
                            'Username'    =>    'IntegratorLPI', 
                            'Password'    =>    'password531'); 
                $headers = new SoapHeader('http://wms.etech.net/', 'UserCredentials', $sh_param);
                 $client->__setSoapHeaders($headers);   



                $params = array('CustomerName' => 'Mr Smith','ContactMobileNo' => '01237 376347',
                                'AddressLine1' => '33 Amblecote Road',
                                'AddressTown' => 'Cambridgeshire',
                                'AddressPostCode' => 'NW23 6TR',
                                'VendorAddressLine1' => '80 Norton Road',
                                'VendorAddressTown' => 'Hickley ',
                                'VendorAddressCounty' => 'Cambridgeshire',
                                'VendorAddressPostCode' => 'NW23 2AQ',
                                'RegionalOfficeID' => '3',
                                'ExternalNotes' => 'Case Accepted',
                                'UPRN' => '',
                                'InstructionTypeID' => '2',
                                'PropertyTypeID' => '11',
                                'PropertyTenure' => '2',
                                'SurveyorID' => '23',
                                'RRN' => '0240-9002-0391-3520-0020',
                                'NewInstruction'=> 'true',
                                'StatusID' => '1'
                                );
                $result = $client->__soapCall("UpdateInstruction", $params );

                print_r(    $result);

    ?>

i have got this error
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:\xampp\htdocs\test2.php:33 Stack trace: #0 C:\xampp\htdocs\test2.php(33): SoapClient->__soapCall('UpdateInstructi...', Array) #1 {main} thrown in C:\xampp\htdocs\test2.php on line 33

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我的黑色迷你裙 2024-11-15 07:27:55

您可能需要发送类似以下内容:

 $result = $client->__soapCall("UpdateInstruction", array('Instruction' => $params );

其中指令是您正在传递的对象的名称。

You probably need to send something like:

 $result = $client->__soapCall("UpdateInstruction", array('Instruction' => $params );

Where Instruction is the name of the object that you are passing.

你又不是我 2024-11-15 07:27:55

看起来服务器端抛出了 NullReferenceException 。因此,这是服务器端发生的任何函数的参数问题,产生该错误。

不管为什么,根据最佳实践,这是 .NET 服务中的错误。 NullReferenceException 确实应该替换为更具体的内容。

您能否与编写该服务的人员联系以获取更多信息以进行故障排除?您的 $params 数组中很可能有一个参数命名错误,但您可能需要服务编写者的一些帮助。

It looks like a NullReferenceException was thrown on the server side. So, it's a matter of the parameters to whatever function is occurring on the server side generating that error.

Regardless of why, per best practices, this is an error in the .NET service. The NullReferenceException should really be replaced with something more specific.

Can you get in touch with whomever wrote the service to get more information to troubleshoot? It's quite possible that you have a parameter misnamed in your $params array, but you're probably going to need some help from the service writer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文