我正在尝试与SOAP服务进行通信,以便将一些数据发布到数据库中。
正如您所看到的,所需数据非常繁琐,因此对代码长度表示道歉,您需要滚动查看所有内容。以下是我尝试与服务进行通信的方式,但是我收到错误System.NullReferenceException: Object reference not set to an instance of an object
PHP:
$soapClient = new soapClient("https://secure.quickflora.com/Admin/scripts/ws/QuickfloraOrders.asmx?WSDL");
$orderArray = array(
"Token" => $token,
"OrderErrorEmail" => "edwardsalexk@gmail.com",
"Billing" => array("CustomerID" => "1",
"FullName" => "Jack Nichols",
"FirstName" => "Jack",
"LastName" => "Nichols",
"Address1" => "9725 E Windrose Drive",
"Address2" => "",
"Address3" => "",
"City" => "Scottsdale",
"State" => "Arizona",
"Zip" => "85260",
"Phone"=> "4807218374",
"PhoneExt" => "123",
"Fax" => "1234",
"Email"=> "edwardsalexk@gmail.com",
"Cell" =>"480 721 8374",
),
"Shipping" => array("Attention "=> "Alexander",
"Salutation" => "Alexander",
"FirstName" => "Alexander",
"LastName" => "Edwards",
"Address1"=> "9725 E Windrose Drive",
"Address2" => "",
"Address3" => "",
"City"=>"Scottsdale",
"State" =>"Arizona",
"Zip" => "85260",
"Country" => "United States",
"Phone" => "480 721 8374",
"PhoneExt" => "123",
"Fax" => "123",
"Email" => "edwardsalexk@gmail.com",
"Cell" => "480 721 8374",
"CardMessage" => "I hope these flowers find you well!",
"DestinationType" => "House",
"DriverRouteInfo" => "None",
"Priority" => "Highest",
"Order Ship Date" => "4/20/2017",
),
"Payment" => array("MethodID" => "1",
"Check" =>array("Number" => "123",
"CheckID" => "1",
"ChkDate" => "4/20/2017,"),
"CreditCard" => array("TypeID" => "1",
"Name" => "Alexander Edwards",
"Account Number" => "12345678",
"Expiration Date" => "11/14/1993",
"SecurityCode" => "123",
"ApprovalCode" => "123")),
"WireServiceInfo" => array("WireService" => "Alexander Service",
"WireServiceCode" => "123",
"ReferenceID" => "123",
"TransmitMethod" => "123",
"RepresentativeTalkedTo" => "Alexander",
"FloristName" => "Alexander",
"FloristPhone" => "480 721 8734",
"FloristCity" => "Scottsdale",
"FloristState" => "Arizona"),
"Orderdetails" => array("OccasionCodeID" => "123",
"SourceCodeID" => "123",
"Comments" => "Hello",
"TaxGroupID" => "123",
"Currency" => array("ID" => "123",
"ExchangeRate" => 1.2),
"DeliveryCharge" => 12.5,
"ServiceCharge" => 12.5,
"Discounts" => array("Percentage" => 12.5,
"Amount" => 12.5),
"Tax" => array("Percentage" => 12.5,
"Amount" => 12.5),
"GSTTax" => array("Percentage" => 12.5,
"Amount" => 12.5),
"PSTTax" => array("Percentage" => 12.5,
"Amount" => 12.5),
"Total" => 123.34
),
"OrderItemsdetails" => array(
"Itemno" => array("String", "String"),
"Itemid" => array("String", "String"),
"UpcCode" => array("String", "String"),
"ItemName" => array("String", "String"),
"Description" => array("String", "String"),
"Quantity" => array("String", "String"),
"UnitOfMeasurement" => array("String", "String"),
"DiscountPercentage" => array("String", "String"),
"UnitPrice" => array("String", "String")
)
);
$response = $soapClient->PostOrder($orderArray);
echo var_dump($response);