1

I am programing an API Client with Filemaker and MBS Plug-in.

With Magento1 Soap API I could use a client called "Web Service Studio" https://webservicestudio.codeplex.com/ to try things out. Later i could use the XML a use within Filemaker.

Using an URL under Magento1 like

www.url.com/api/v2_soap/?wsdl 

gave me a result with which I could request a Token and could login with token I got.

To request a Token within Magento2 Soap Api I found this URL:

www.url.com/soap/?wsdl&services=integrationAdminTokenServiceV1

If I request a WSDL like I did before like

www.url.com/soap/default?wsdl&services=catalogProductRepositoryV1

I only get a 401 Unauthorised.

So where do I place my token or where do I get a WSDL like before in Magento1?

2 Answers 2

0

Try to request a token within Magento 2.

Then add the authorization token in the HTTP header

Authorization: Bearer YOURTOKEN

With this URL : www.url.com/soap/default?wsdl&services=catalogProductRepositoryV1

Documentation reference : http://devdocs.magento.com/guides/v2.1/get-started/authentication/gs-authentication-token.html http://devdocs.magento.com/guides/v2.0/get-started/soap/soap-web-api-calls.html

Code example in PHP :

<?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); ?>
9
  • I guess that is the problem, I dont find a way to chnage the header in this programm. Is there a way to add the token into the URL? Feb 22, 2017 at 12:41
  • No it is an HTTP header. You can test your webservice with SOAP UI. You can change the header. Feb 22, 2017 at 12:41
  • I got it: soapui.org/soap-and-wsdl/… Feb 22, 2017 at 13:11
  • So its working ? Feb 22, 2017 at 13:26
  • Yes that works. Would be nice to have it in "Web Service Studio" because the GUI is not that complex. Feb 22, 2017 at 14:04
0

I could not find a way to add the

Authorization: Bearer <token>

to run it directly in WSS. So I found a way arround. I did load a WSDL page like

www.url.com/soap/default?wsdl&services=catalogProductRepositoryV1

into SOAP UI and then after saving it as .wsdl I could load it into WebServiceStudio.

Your Answer

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

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