0

当我在 sopaUI 中使用 XML 时,结果很好,但是当我使用以下 php 代码时,结果显示为空白,并且出现此错误:Fatal error: Uncaught SoapFault exception: [soap:Server] System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Saia.Presentation. 我认为问题出在 Soap 标题或其他地方,因为当我注释掉参数时,结果没有变化。

获取 wsdl 文件和架构的链接:http: //www.saiasecure.com/webservice/pickup/n_Create.asp

$client = new SoapClient("http://www.saiasecure.com/webservice/pickup/soap.asmx?wsdl",array( 'trace' => 1,
'exceptions' => true,'features' => SOAP_SINGLE_ELEMENT_ARRAYS, ));

$params = array("UserID" => '*******',
        "Password" => '*****',
        "TestMode" => "Y",
        "AccountNumber" => '******',
        "CompanyName" => 'TESTING NAME',
        "Street" => 'TESTING STREET',
        "Box" => 'TESTING BOX',
        "City" => 'LOS ANGELES',
        "State" => 'CA',
        "Zipcode" => '90001',
        "ContactName" => 'TESTING CONTACT',
        "ContactPhone" => '1234567890',
        "PickupDate" => '2013-09-24',
        "ReadyTime" => '13:00:00',
        "CloseTime" => '17:00:00',
        "SpecialInstructions" => 'Nothing',
         "Details" => array("DetailItem" => array("DestinationZipcode" => '70364', "Pieces" => '5', "Package" => 'SK',"Weight" => '100', "Freezable" => 'N') ));
    //print('<pre>');print_r($params);  
$return = $client->Create($params);
4

1 回答 1

0

如果您查看 WSDL,您会发现Create操作参数必须包含一个request指向实际Create对象参数的元素(您可以像使用关联数组一样发送该参数)。

我必须说 WSDL 不是很正确,因为相同的元素名称,意思Create是两次用于不同的定义。一次作为element,一次作为complexType

需要明确的是,您必须使用实际代码来执行此操作:$return = $client->Create(array('request'=>$params));它应该可以工作。

于 2013-09-06T07:37:12.777 回答