0
我試圖在3PL Central中使用那裏的SOAP API集成創建訂單。3PL中央PHP SOAP請求錯誤序列不包含元素
這裏是我的代碼::
//Request Array
$req_arr = [
'extLoginData' => [
'ThreePLKey' => 'key',
'Login' => 'user',
'Password' => 'pass',
'FacilityID' => 123,
'CustomerID' => 100
],
'orders' => [
'Order' => [
'TransInfo' => [
'ExpectedDate' => '2017-02-11T00:00:00',
'ReferenceNum' => 'TESTN%$',
],
'ShipTo' => [
'Name' => 'Test Test', //[OPTIONAL]
'CompanyName' => 'Test Address',
'Address' => [
'Address1' => '1212 Main Street',
'City' => 'Los Angeles',
'State' => 'CA',
'Zip' => '90010',
'Country' => 'US'
],
'PhoneNumber1' => '34343434324', //[OPTIONAL]
'Fax' => '9856326352', //[OPTIONAL]
'EmailAddress1' => '[email protected]', //[OPTIONAL]
'CustomerName' => 'test', //[OPTIONAL]
'Vendor' => 'Any', //[OPTIONAL]
'Dept' => 'Any', //[OPTIONAL]
'RetailerID' => 343 //[OPTIONAL – do not send if not matching with value in the 3PL Central]
],
'Notes' => 'Test',
'PalletCount' => 10, //[OPTIONAL – do not send if not matching with value in the 3PL Central]
]
],
'warnings' => 'test'
];
//SOAP options
$options = [
'uri' => 'http://schemas.xmlsoap.org/soap/envelope/',
'style' => SOAP_RPC,
'use' => SOAP_ENCODED,
'soap_version' => SOAP_1_2,
'trace' => true,
'cache' => WSDL_CACHE_NONE,
'exceptions' => true,
"features" => SOAP_SINGLE_ELEMENT_ARRAYS,
'encoding' => 'UTF-8',
'connection_timeout' => 15,
'Content-Type' => 'application/soap+xml; charset=utf-8',
'Content-Length' => strlen(json_encode($req_arr)),
'SOAPAction' => 'http://www.JOI.com/schemas/ViaSub.WMS/CreateOrders'
];
$client = new \SoapClient('https://secure-wms.com/webserviceexternal/contracts.asmx?wsdl', $options);
$result = $client->__soapCall('CreateOrders', $req_arr);
我得到一個錯誤
服務器無法處理請求。 --->序列不包含 元件
我谷歌配發,這和在得出結論,問題是與由所述陣列產生,但使用一些PHP腳本(數組XML轉換器)的XML我成功轉換的數組轉換爲XML,所以XML中可能沒有任何錯誤。
問題出在我設置的SOAP選項上嗎?
謝謝。
這是API Doc Link。
歡迎來到StackOverflow,ryo7689。感謝您提供這個問題的答案。 – David