2

I just had a brief look at the Magento 2 WSDL file.

Until 1.9 I used the WSDL file as part of my development (Delphi win 32) to have access to the functions, arrays, objects etc... This was very helpful.

I already found the functions again... totally different names though, so I have to redevelop everything... which is time-consuming, but possible.

But what I haven't understood until now is the login credentials with the token system. In V1.9 I had an API-User and the corresponding password, which I could use to get my session ID: e.g. mage.login(myLoginParam)

I already found the extension settings in the Magento backend. But I really don't have a clue how to submit those consumer key, secrets... etc.. I am connecting to Magento using the HTTPRIO component from Delphi.

Can anyone enlighten me?

b/r Holger

3 Answers 3

0

You can use [SOAP Reference](http://devdocs.magento.com/guides/v2.0/soap/bk-soap.html Magento 2 have api functional tests, they use also sSOAP to testing work with all APIs

3
  • Thanks for the hints, though its not answering any of my questions. I already new the link for the list of service endpoints... But i need a hint on how to use the consumer and access token and secrets. I dont have a clue how to use them in the connection method i mentioned above.
    – Holger
    Commented Dec 9, 2015 at 13:49
  • please see documentation about authentication
    – KAndy
    Commented Dec 9, 2015 at 15:01
  • also see related question stackoverflow.com/questions/4459637/…
    – KAndy
    Commented Dec 9, 2015 at 15:26
0

Example For PHP SOAP Client CALL For Magento 2 : Change your magento path , service name and accecs tocken in place of key after word 'Barear'

$request = new SoapClient(
    'http://magento2.ce/index.php/soap/? wsdl&services=foggylineSliderSlideRepositoryV1',
    array(
        'soap_version' => SOAP_1_2,
        'stream_context' => stream_context_create(array(
            'http' => array(
                'header' => 'Authorization: Bearer pk8h93nq9cevaw55bohkjbp0o7kpl4d3')
        ))
    )
);
$response = $request-> foggylineSliderSlideRepositoryV1GetById(array('slideId'=>1));

If you magento 2 with having order in database than this will shows you detail of order having id 1 because salesOrderRepositoryV1 is default api provided by magento 2 , for more default apis : http://devdocs.magento.com/guides/v2.0/soap/bk-soap.html

$request = new SoapClient(
    'http://192.168.0.54/magento20sample/index.php/soap/default?wsdl&services=salesOrderRepositoryV1',
    array(
        'soap_version' => SOAP_1_2,
        'stream_context' => stream_context_create(array(
            'http'=> array('header' => 'Authorization: Bearer w9vqx2uyenkbvbim6mwochwapq714yox')
        ))
    )
);
$response = $request->SalesOrderRepositoryV1Get(array('id' => 1));

hope this will help you ..

0

You can use this sample file changing your credentials and the request URL.

<?php
$request = new SoapClient("http://magento.m2/index.php/soap/?wsdl&services=integrationAdminTokenServiceV1", array("soap_version" => SOAP_1_2));
$token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username"=>"admin", "password"=>"GN2vKgfsszz43u"));

$opts = array(
    'http'=>array(
        'header' => 'Authorization: Bearer '.json_decode($token->result)
    )
);

$wsdlUrl = 'http://magento.m2/soap/default?wsdl&services=directoryCurrencyInformationAcquirerV1';
$context = stream_context_create($opts);
$soapClient = new SoapClient(
    $wsdlUrl,
    array('version' => SOAP_1_2, 'context' => $context])
);

$soapResponse = $soapClient->__getFunctions();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.