【发布时间】:2011-10-14 15:55:41
【问题描述】:
我正在尝试连接到这个网络服务:http://magnetledavet.com/GetStuffed/Service.asmx?WSDL
我正在使用这个简单的脚本来测试它,但我似乎没有得到任何回报,而且我不确定是什么导致了问题。
这是我的测试脚本,任何人都可以看到有什么问题吗?
<?php
if(!class_exists("SoapClient")){ die("Catch"); }
$client = new SoapClient('http://magnetledavet.com/GetStuffed/Service.asmx?WSDL', array('soap_version' => SOAP_1_2));
echo "test";
//var_dump($client->__getFunctions());
echo("Dump Start:<br>");
var_dump($client->SendOrder( array(
"merchant_id" => 1,
"order_id" => "445",
"username" => "test",
"password" => "test123",
"products" => array(
array("qty" => 1, "product_id" =>"1", "product_name" => "Product Test 1", "price" =>15),
array("qty" => 1, "product_id" =>"2", "product_name" => "Product Test 2", "price" =>25)
),
"order_details" => "Dont add cheese !!",
"amount" => 40,
"point" => 40,
"payment_type" => "test",
"webdate" => date("Y-m-d").'T'.date("H:i:s"),
"customer_name" => "Steve Jobs",
"address" => "4th Floor Grosvenor House, 1 High Street Edgware",
"state" => "test",
"phone" => "+447711111111",
"postcode" => "HA8 7TA",
"email" => "abc@abc.com",
"delivery_time" => date("Y-m-d").'T'.date("H:i:s"),
"delivery_notes" => "test"
)
));
//var_dump($client->__soapCall("SendOrder", array( 'merchant_id' => 1 )));
print("Dump End:<br>");
?>
得到以下soap错误:SOAP-ERROR: Parsing WSDL: Couldn't load from 'magnetledavet.com/GetStuffed/Service.asmx?WSDL'; :未能加载外部实体“magnetledavet.com/GetStuffed/Service.asmx?WSDL”;在 C:\xampp\htdocs\get_stuffed\webservice.php:6 堆栈跟踪:#0 C:\xampp\htdocs\get_stuffed\webservice.php(6): SoapClient->SoapClient('magnetle...';, Array ) #1 {main} 抛出 C:\xampp\htdocs\get_stuffed\webservice.php
【问题讨论】:
-
您是否遇到任何错误?变量转储显示什么?
-
根本没有显示没有错误或没有转储。
-
SOAP 客户端肯定有一些调试选项吗? php.net/manual/en/soapclient.soapcall.php
On error, a call to a SOAP function can cause PHP to throw exceptions or return a SoapFault object if exceptions are disabled. To check if the function call failed to catch the SoapFault exceptions, check the result with is_soap_fault(). -
这是我第一次使用 php soap,所以我不太确定。此行之后的所有内容,甚至 echo test $client = new SoapClient('magnetledavet.com/GetStuffed/Service.asmx?WSDL', array('soap_version' => SOAP_1_2));
-
是否启用错误报告?
error_reporting(E_ALL);
标签: php web-services soap