Hello Techies,
I am unable to load soap Customer Repository services
soap/default?wsdl&services=customerCustomerRepositoryV1
at magento 2.1 version,
Giving,
Hello,
after upgrade to 2.1 version, I can see same error "Consumer is not authorized to access %resources" when I trying load http://127.0.0.1/soap/default?wsdl=1&services=catalogProductRepositoryV1 or customerCustomerRepositoryV1 or another services. It worked fine, before upgrade to 2.1. Only customerAccountManagementV1 works fine.
Any ideas how to solve this issue?
thanks,
Ivan
Hi Ivan,
try the following process to consume.
$url = ' http://127.0.0.1/soap/default?wsdl=1&services=catalogProductRepositoryV1';
$opts = array(
'http'=>array(
'header' => 'Authorization: Bearer <Instance Magento Token>'
)
);
$context = stream_context_create($opts);
$client = new SoapClient($url, array('soap_version'=>SOAP_1_2, 'stream_context'=>$context));
// $soapResponse = $client->catalogProductRepositoryV1GetList(array('searchCriteria'=>''));
Thanks,
RaviSankar
Hi Ravi,
thanks, URL http://127.0.0.1/soap/default?wsdl=1&services=catalogProductRepositoryV1 works, when I allowed Anonymous Guest Access in menu Stores > Configuration > Services > Magento Web API > Web API Security. But some API URLs e.g. http://127.0.0.1/soap/default?wsdl&services=salesOrderRepositoryV1 doesn't works (I can see error 'Consumer is not authorized to access %resources') in the M2.1, but works fine in the M2.0 http://magento2.demo.ubertheme.com/soap/default?wsdl&services=salesOrderRepositoryV1 . I need to access this URL directly (before authentication), to be able add Service Reference in C#, in the Visual Studio 2016.
thanks,
Ivan
Hi Ivan,
To consume third party systems like C# applications. Try to download wsdl by passing token keys then you will be utilize respective methods of wsdl.
Thanks
Ravi
@RaviSankar wrote:Hi Ivan,
To consume third party systems like C# applications. Try to download wsdl by passing token keys then you will be utilize respective methods of wsdl.
Thanks
Ravi
Unfortunately it doesn't work like that, or at all, on Mage 2.1. The devs hid the WSDL behind an oAuth, which breaks the standard I think, so C# and I assume Java cannot create the intermediate objects to even start programming. The devs refuse to see it as a problem: