簡體   English   中英

在php中使用ASP.NET WebService並返回soap錯誤

[英]Consume ASP.NET WebService In php and return soap error

我試圖在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 }在第33行的C:\\ xampp \\ htdocs \\ test2.php中拋出

您可能需要發送以下內容:

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

其中指令是您要傳遞的對象的名稱。

好像在服務器端引發了NullReferenceException 因此,與產生該錯誤的服務器端發生的任何功能有關的參數都是問題。

無論為什么,按照最佳實踐,這都是.NET服務中的錯誤。 NullReferenceException實際上應該替換為更具體的東西。

您可以與編寫服務的任何人聯系以獲得更多信息以進行故障排除嗎? $params數組中的參數很可能被錯誤命名,但是您可能需要服務編寫者的一些幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM