1

How to invoke soap wsdl request for magento2 in SOAPUI.

I have created a soap wsdl request in SOAPUI using my URL http://192.168.0.1/Magento2/soap/default?wsdl&services=customerCustomerRepositoryV1.
When i invoke request its giving error Consumer is not authorized to access %resources. To overcome this i have found another request http://192.168.0.183/M2EE/soap/default?wsdl&services=integrationAdminTokenServiceV1 which is giving token.

But how to send token in customerrepository request.

Customer Save Request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:def="http://192.168.0.1/M2EE/soap/default?services=customerCustomerRepositoryV1"> <soap:Header/> <soap:Body> <def:customerCustomerRepositoryV1SaveRequest> <customer>
<email>pprasad@gmail.com</email> <firstname>prasad</firstname> <lastname>p</lastname> </customer> </def:customerCustomerRepositoryV1SaveRequest> </soap:Body> </soap:Envelope>

Customer Save Response
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="http%3A%2F%2F192.168.0.1%2FM2EE%2Fsoap%2Fdefault%3Fservices%3DcustomerCustomerRepositoryV1%26wsdl%3D1"> <env:Body> <env:Fault> <env:Code> <env:Value>env:Sender</env:Value> </env:Code> <env:Reason> <env:Text xml:lang="en">Consumer is not authorized to access %resources</env:Text> </env:Reason> <env:Detail> <m:GenericFault> <m:Parameters> <m:GenericFaultParameter> <m:key>resources</m:key> <m:value>Magento_Customer::manage, self</m:value> </m:GenericFaultParameter> </m:Parameters> </m:GenericFault> </env:Detail> </env:Fault> </env:Body> </env:Envelope>

1

To send a token, that you get from http://192.168.0.183/M2EE/soap/default?wsdl&services=integrationAdminTokenServiceV1 , you need to add the HTTP authorization header e.g. "Authorization: Bearer <put your token here>" "" should be replaced with your token.

8
  • Can you please specify where should i declare "Authorization: Bearer <your token>" in my xml request – prasad maganti Feb 5 '16 at 10:40
  • How do you send your request? What kind of utility do you use? – Arkadii Chyzhov Feb 5 '16 at 10:42
  • SOAPUI version 5.2.1 – prasad maganti Feb 5 '16 at 10:46
  • At the bottom of the request window in XML mode you should see "Headers (0)". Then proceed to that tab and add a custom header with the name "Authorization" and the value "Bearer <put your token>". "<put your token>" should be replaced with a token. – Arkadii Chyzhov Feb 5 '16 at 10:49
  • You are awesome, thank you. can you please let me know how should i add this header if i'm sending from any other utility like third party applications? – prasad maganti Feb 5 '16 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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