【问题标题】:PHP SOAP fatal error messagePHP SOAP 致命错误消息
【发布时间】:2011-08-29 20:18:57
【问题描述】:

我的网络服务器已正确安装 SOAP(phpinfo 已启用 Soap 客户端/服务器)。

我正在尝试向远程 magento 商店创建 SOAP 请求,但收到以下错误消息:

[Mon Aug 29 20:13:59 2011] [error] [client 79.178.13.67] PHP Fatal error:  Uncaught SoapFault exception: [0] Unable to load Soap extension on the server in /home/example/public_html/mag/index.php:3

Stack trace:
#0 [internal function]: SoapClient->__call('login', Array)
#1 /home/example/public_html/mag/index.php(3): SoapClient->login('user', 'pass')
#2 {main}\n  thrown in /home/example/public_html/mag/index.php on line 3

代码 sn-p 在这里:

$client = new SoapClient('http://www.example.com/api/soap/?wsdl=1');
$session = $client->login('user','pass');
$attributeSets = $client->call($session,'product_attribute_set.list');
$set = current($attributeSets);
$sku = 'iphone-12345';
$imagePath="../image.jpg";
$newProductData = array(
'name'              => 'iPhone',
'websites'          => array(1),
'short_description' => 'short description',
'description'       => 'description',
'price'             => 150,
'status'            => '1',
);
$newImage = array(
'file' => array(
'name' => 'file_name',
'content' => base64_encode(file_get_contents($imagePath)),
'mime'    => 'image/jpeg'
),
'label'    => 'Cool Image',
'position' => 0,
'types'    => array('image','small_image','thumbnail'),
'exclude'  => 0
);
$imageFilename = $client->call($sessionId, 'product_media.create', array($sku,$newImage));

$productId = $client->call($session,'product.create',array('simple', $set['set_id'],$sku,$newProductData));
echo $productId;

有什么想法吗?

谢谢,

【问题讨论】:

  • 检查您的服务器安装和配置。 magentocommerce.com/boards/viewthread/20556
  • @Marek Sebera - 我从与我的 Magento 服务器不同的服务器运行脚本,这会影响什么吗?我知道 SOAP 已正确安装在 magento 服务器上,因为我在加载 wsdl url 时得到了正确的 XML 响应
  • 在另一台服务器上意味着另一台 VirtualHost 或整个服务器(整个 apache、httpd、nginx、...实例)?该错误表示加载 SOAP 扩展存在问题,因此可能存在一些错误配置。
  • @Marek Sebera - 完全不同的服务器。
  • 所以再次检查您的服务器配置,检查 HTTP 服务器(apache 或其他)的启动消息,检查 php.ini、httpd.conf 中的配置...检查包依赖关系并在之后重新启动您的 Web 服务器成功更新您的 php* 包

标签: php magento soap


【解决方案1】:

尝试更新 WSDL 的服务器端(SoapServer 运行的地方)

更新:

  • PHP
  • PHP-SOAP

和依赖 ;-)

可能是服务器端的 php(和/或 soap)版本过时

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多