magento2使用SOAP服务 - magento教程

WSDL 文件

仅为您请求的服务生成WSDL文件。这意味着,不同的客户可能使用不同的服务,因此使用不同的WSDLs。

Magento 2 Web API使用WSDL 1.2,符合WS-I 2.0基本概要。

每个Magento 2的服务接口,是服务合同的一部分,是一个服务的WSDL。

若要消耗多个服务,必须在WSDL endpoint URL中指定它们。

服务WSDL endpoint URL可用的服务
customerhttp://magentohost/soap?wsdl&services=customerV1\Magento\Customer\Service\V1\CustomerService
customer, catalogProduct

http://magentohost/soap/custom_store?wsdl&services=customerCusto

merAccountServiceV1,catalogProductV2

\Magento\Customer\Service\V1\CustomerAccountServiceInterface, \Magento\Catalog\Service\V2\ProductInterface
原始服务接口名称服务名称
\Magento\Customer\Service\V1\CustomerInterfacecustomerV1
\Magento\Customer\Service\V1\CustomerAccountServiceInterfacecustomerCustomerAccountServiceV1
\Enterprise\Customer\Service\V3\Customer\AddressInterfaceenterpriseCustomerAddressV3

认证

更多信息, 查看OAuth-based 认证

下面的PHP脚本说明如何获取access token:

<?php
$opts = array(
            'http'=>array(
                'header' => 'Authorization: Bearer 36849300bca4fbff758d93a3379f1b8e'
            )
        );
$wsdlUrl = 'http://magento.ll/soap/default?wsdl=1&services=testModule1AllSoapAndRestV1';
$serviceArgs = array("id"=>1);

$context = stream_context_create($opts);
$soapClient = new SoapClient($wsdlUrl, ['version' => SOAP_1_2, 'context' => $context]);

$soapResponse = $soapClient->testModule1AllSoapAndRestV1Item($serviceArgs); ?>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值