Again - Error in SoapUI, but NOT Postman
Hi,
I have a request that works in Postman but doesn't in SoapUI, and I'm trying to convert all our Postman tests into SoapUI.
The Postman settings are as follows:
POST - https://login.XXXX.com/XXX.onmicrosoft.com/oauth2/token No Auth Headers = Cache-Control:no-cache, Content-Type:application/x-www-form-urlencoded Body (application/x-www-form-urlencoded) is blank but when I select the edit text
option it reveals the following: client_id:ac353c3b-249c-4615-900f-7fb0dc748e07 resource:https://XXX.crm4.dynamics.com username:muleservice@XXX.onmicrosoft.com password:YKbaa436Regi4178 grant_type:password
I tried to emulate this in SoapUI with the following:
POST - https://login.XXXX.com/XXX.onmicrosoft.com/oauth2/token No Auth
Headers = Cache-Control:no-cache MediaType = 'application/x-www-form-urlencoded' In the Request body I copied the contents from Postman request 'body' straight into
the Request body section in SoapUI client_id:ac353c3b-249c-4615-900f-7fb0dc748e07 resource:https://XXX.crm4.dynamics.com username:muleservice@XXX.onmicrosoft.com password:YKbaa436Regi4178 grant_type:password
NOW - when I run it in Postman - it runs fine - but when I run it in SoapUI I get a response stating the response is invalid and that
'The request body must contain the following parameter: 'grant_type''
HOWEVER - as you can see - my request body DOES include a 'grant_type' parameter!!
Does anyone know what I'm doing wrong?
I didn't know anything about this 'application/x-www-form-urlencoded' mediatype and I did some reading and it stated that POST requests use this and another type (multipart-formdata) is just lie having loads of parameters in your URI string so I tried adding the parameters into a query string at the end of the URI I was submitting - but this didn't work
I've installed fiddler and I'm going to see if I can see a difference between what's being posted Postman vs SoapUI.
I'd welcome any help/guidance/advice you can give me.
I've attached some screenshots of Postman and SoapUI settings and I've also attached an extract of my ReadyAPI! Log file - no application errors are reported.
Thanks to all!
richie
Hey!
I got it sorted (finally) thanks to some more reading about the content-type value and help via (https://www.soapui.org/rest-testing/understanding-rest-parameters.html)
Within SoapUI
'Mediatype' = x-www-form-urlencoded (ensuring I didn't select 'Post Querystring' checkbox - it doesn't work if I check this)
Postman provided the request body's name/value pairs separated by a colon on separate lines
e.g.
password:whatever username:rich grant_type:admin
This didn't work in SoapUI so I stuck all the parms in one line in the Request body and separated the parms with an ampersand and replaced the colons with equals signs
e.g.
password=whatever&username=rich&grant_type=admin
This worked!
Thanks!