在php中使用ASP.NET WebService并返回soap错误
我正在尝试用php调用.NETWebService 下面是我的代码在php中使用ASP.NET WebService并返回soap错误,php,asp.net,web-services,Php,Asp.net,Web Services,我正在尝试用php调用.NETWebService 下面是我的代码 <?php $client = new SoapClient("http://test.etech.net/PanelIntegration/PanelIntegration.asmx?wsdl"); <?php $sh_param = array( 'Username' => 'Integr
<?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->uu soapCall('UpdateInstructi…',Array)#1{main}在C:\xampp\htdocs\test2.php的第33行抛出看起来服务器端抛出了一个
NullReferenceException
。所以,这是服务器端生成错误的任何函数的参数问题
不管为什么,按照最佳实践,这都是.NET服务中的错误。NullReferenceException
确实应该被更具体的内容所取代
您能否与编写该服务的人联系以获取更多信息以进行故障排除?很可能您的
$params
数组中有一个参数命名错误,但您可能需要服务编写器的帮助。看起来服务器端抛出了NullReferenceException
。所以,这是服务器端生成错误的任何函数的参数问题
不管为什么,按照最佳实践,这都是.NET服务中的错误。NullReferenceException
确实应该被更具体的内容所取代
您能否与编写该服务的人联系以获取更多信息以进行故障排除?很可能您的
$params
数组中有一个参数命名错误,但您可能需要服务编写器的帮助。您可能需要发送以下内容:
$result = $client->__soapCall("UpdateInstruction", array('Instruction' => $params );
其中,指令是您要传递的对象的名称。您可能需要发送以下内容:
$result = $client->__soapCall("UpdateInstruction", array('Instruction' => $params );
其中Instruction是您要传递的对象的名称。谢谢您的回复,但是当我使用相同的参数调用.net时,这个web服务工作得很好。在php中调用这个服务还有其他方法吗。谢谢你的回复,但是当我用相同的参数调用.net时,这个web服务工作得很好。用php调用这个服务还有其他方法吗。谢谢