Question

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>

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top