PHP SOAP 致命错误消息

发布于 2024-12-02 03:30:50 字数 1665 浏览 1 评论 0原文

我的网络服务器已正确安装 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

此处的代码片段:

$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;

有什么想法吗?

谢谢,

My webserver has SOAP installed correctly (phpinfo has Soap Client/Server - Enabled).

I'm trying to create a SOAP request to a remote magento store, and I'm getting this error message:

[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

Code snippet here:

$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;

Any ideas?

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪痕残 2024-12-09 03:30:50

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

更新:

  • PHP
  • PHP-SOAP

和依赖项;-)

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

Try to updating Server side of WSDL (where SoapServer runs)

update :

  • PHP
  • PHP-SOAP

and dependencies ;-)

maybe outdated version of php (and/or soap) on server side

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文